Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Issue with OnSaveDocument Event (BeforeOrAfter = kAbort)

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
etckerry
640 Views, 2 Replies

Issue with OnSaveDocument Event (BeforeOrAfter = kAbort)

Hello,

 

I have an add-in that catches FileUIEvent.OnFileSaveAsDialog and also InventorEvent.OnSaveDocument events.  We've been using this add-in for about 5 years (with minor tweaking here and there) on everything form Inventor 2009 through 2012 and everything seems to work fine.

 

Recently we added a button to automate the process of exporting .dwfs.  This button also works OK, but now intermittently, after clicking the "Export DWF" button, users are unable to save.  I added some logging functions to try to figure out what is going on, and it turns out that the InventorEvent.OnSaveDocument event is being called with BeforeOrAfter set to kAbort.  The only fix seems to be restarting Inventor, which of course causes us to loose work.

 

I added logging to the other methods in the add-in, too, to try to figure out where the mistake is occuring, but it looks like the ONLY method being called in the InventorEvent.OnSaveDocument method.  After this starts happening, I can even create a new document (so it didn't exist at the time that the dwf was created) and I cannot save this documetn either.

 

I think the flow would normally be:

InventorEvent.OnSaveDocument wiht BeforeOrAfter = kBefore

FileUIEvent.OnSaveAsDialog

InventorEvent.OnSaveDocument with BeforeOrAfter = kAfter

 

Since the Save As dialog never appears, it's failing even prior to the first call to OnSaveDocument.

 

Periodically, users report these symptoms without having created dwfs, but that seems to be the most reliable way to make it fail.

 

I'm thinking there may be some variable/flag that needs to be initialized somewhere?  Any ideas?

 

Thanks,

 

Kerry

 

EDIT:  When this happens, I can still save the document that was exported to a dwf using the new button.  No dice on saving any other documents, regardless of whether they were open or even existed before or after the export

2 REPLIES 2
Message 2 of 3
etckerry
in reply to: etckerry

It appears that having InventorApplication.SilentOperation set to True is bad...  I forgot the line at the end of the DWF exporting routine that sets this back to False.  I added it, and the issue seems to have stopped.  Hopefully this is the root cause, and hopefully this information is helpful to someone else.

 

Thanks,

 

Kerry

Message 3 of 3
petter.moldestad
in reply to: etckerry

Thanks.

The information was very helpful for me. I’ve spent a lot of time trying to figure out what was wrong with my code. When I read your post I understood. I tried to set SilentOperation to true at the start of OnSaveDocument and to false at the end. It seems to me as a bug in Inventor. So if Autodesk can fix it, it would be great.

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

Post to forums  

Autodesk Design & Make Report