Valued Contributor
Posts: 55
Registered: ‎01-23-2013
Message 1 of 2 (192 Views)

AutoLisp Integration with Database.SaveAs results in eFileAccessErr

192 Views, 1 Replies
09-13-2013 01:18 PM

Hey all,


I've been having some strange things happen ever since I changed my program to start from AutoLisp rather than a command.


Below I will describe what happens when I call Document.CloseAndSave and Database.SaveAs when I run my program from either AutoLisp or from a command.




Method Attribute:


When I call Database.SaveAs(), I get an eFileAccessErr and a message box pops us saying "Error Writing/Closing File"


When I call Document.CloseAndSave(), while omitting Database.SaveAs(), my drawing appears to close properly expect I find that when I open it back up no changes were saved!





Method Attribute:

[CommandMethod("BOMGEN", CommandFlags.Session)]


When I call Database.SaveAs(), my drawing saves properly.


When I call Document.CloseAndSave(), in succession with Database.SaveAs(), the drawing closes (no idea if it actually saves twice, but to be honest I don't care!  Once is all I need.)  



So, I'm looking to run my program from an AutoLisp command:


However, I cannot save the drawings using the methods described above.  Is there an alternate way to save drawings? Or do I need to make further steps when switching to an AutoLisp command?



I believe I read something that generally stated that .NET dlls had some quirks when used from AutoLisp regarding connectivity to the Documents collection.  I don't know where I read this or if it's accurate, but in case it helps, I've got it up here! :smileyhappy:



Thanks much,


Valued Contributor
Posts: 55
Registered: ‎01-23-2013
Message 2 of 2 (118 Views)

Re: AutoLisp Integration with Database.SaveAs results in eFileAccessErr

09-18-2013 05:08 AM in reply to: Millerni456

Perhaps I should give a little bit more detail as to what my program does...


The program opens a list of drawings and reads data.  If a drawing references another drawing, then (without closing the first drawing), the referenced drawing is opened in a recursive manner.  When that referenced drawing closes, the drawing which referenced it will also close.


When using a Command Line entry point, this works fine, but when using an AutoLisp Command, it doesn't.


Can AutoLisp only interact with the current document (MdiActiveDocument)?  Can anyone verify if this behaviour happens to them as well?

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.