CADtoDWG.SaveAsDWG -> Exception Error
Moderators: SDS, support, admin
-
- Posts: 1
- Joined: 26 Jan 2024, 18:22
CADtoDWG.SaveAsDWG -> Exception Error
I have written a small amount of test code to simply open a DWG file and then save it - Essentially making a copy. I wanted to ensure that I am not causing any issue by editting the file, so it's very simple:
I am using .NET (version 8.0) windows forms with CAD.NET 15.0.0.57290.
When I call this function, the following error is presented:
Code: Select all
void SaveFile()
{
CADImage cadImage = CADImage.CreateImageByExtension(selectFile.FileName);
cadImage.LoadFromFile(selectFile.FileName);
CADtoDWG.SaveAsDWG(cadImage, Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "output.dwg"));
}
When I call this function, the following error is presented:
It's a shame, because the library has some great tools - But I cannot save the file. Is there a known issue around saving .DWG files?The type initializer for 'CADImport.Export.CADExportFrame' threw an exception.
Re: CADtoDWG.SaveAsDWG -> Exception Error
Hi,Wahid Massan wrote: ↑26 Jan 2024, 18:36I have written a small amount of test code to simply open a DWG file and then save it - Essentially making a copy. I wanted to ensure that I am not causing any issue by editting the file, so it's very simple:
I am using .NET (version 8.0) windows forms with CAD.NET 15.0.0.57290.Code: Select all
void SaveFile() { CADImage cadImage = CADImage.CreateImageByExtension(selectFile.FileName); cadImage.LoadFromFile(selectFile.FileName); CADtoDWG.SaveAsDWG(cadImage, Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "output.dwg")); }
When I call this function, the following error is presented:
It's a shame, because the library has some great tools - But I cannot save the file. Is there a known issue around saving .DWG files?The type initializer for 'CADImport.Export.CADExportFrame' threw an exception.
Unfortunately, this information is not enough to help you out, we need more details on the error. Is Cadimage null? What is your file extension? Does the external sgcadexp.dll library lie in the execution folder?
Please, try saving selected file in the Editor_NetCore demo. By the way, we released a newer CAD .NET version, that is available at https://cadsofttools.com/company/news/c ... -released/.
Also, I'd like to note that if an input file is raster then it will be saved as a raster image (not CADImage).
Best wishes,
Catherine.
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support
Chat support on Skype: cadsofttools.support