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.
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!
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!
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?