.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

eFileAccessError when saving to dwg files in custom code

0 REPLIES 0
Reply
Message 1 of 1
TXACDE24
82 Views, 0 Replies

eFileAccessError when saving to dwg files in custom code

I have the eFileAccessError when running a custom code using the netload command to load the .dll file after starting AutoCAD Electrical.

TXACDE24_1-1717673130505.png

 

However, the same code runs well when in visual studio debugging mode starting AutoCAD Electrical as an external program.

TXACDE24_0-1717673113735.png

Below is the code to save to dwg files.


//assign file name and determine if its is named
string strDWGName = acDoc.Name;
object obj = Autodesk.AutoCAD.ApplicationServices.Application.GetSystemVariable("DWGTITLED");
// Check to see if the drawing has been named
if (System.Convert.ToInt16(obj) == 0)
{
// If the drawing is using a default name (Drawing1, Drawing2, etc)
// then provide a new name
strDWGName = $"{symbol.Name}.dwg";
}

try
{
acCurDb.SaveAs(strDWGName, true, DwgVersion.Current, acDoc.Database.SecurityParameters);
}
catch (System.Exception e)
{
MessageBox.Show(e.Message);
}

 

0 REPLIES 0

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Forma Design Contest


AutoCAD Beta