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

AutoLisp Integration with Database.SaveAs results in eFileAccessErr

1 REPLY 1
Reply
Message 1 of 2
Millerni456
449 Views, 1 Reply

AutoLisp Integration with Database.SaveAs results in eFileAccessErr

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.

 

 

AutoLisp

Method Attribute:

[LispFunction("BOMGEN")]

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!

 

 

 

Command:

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:

(bomgen)

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! 🙂

 

 

Thanks much,

-Nicholas

1 REPLY 1
Message 2 of 2
Millerni456
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?

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

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost