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: 

OnSaveDocument Event

4 REPLIES 4
Reply
Message 1 of 5
erik.martinsson
441 Views, 4 Replies

OnSaveDocument Event

I am building a small addin for Inventor, and I have a problem when attatching a delegate to the Application.ApplicationEvents.OnSaveDocument-event. 

 

Setting a breakpoint on this line of code when debugging:

 

Application.ApplicationEvents.OnSaveDocument += new ApplicationEventsSink_OnSaveDocumentEventHandler(OnSaveDocument_Delegate);

 

 

and continuing the execution after the breakpoint was hit, will result in a working addin, i.e the OnSaveDocumentEvent fires as it should.

 

BUT. When not having the breakpoint enabled the event doesn't work...it's almost as if things moves too fast for it to register?! 

I've tried executing the adding of the delegate on a separate thread, but that's not working.

 

Anyone got an idea what I can do about this?.

4 REPLIES 4
Message 2 of 5

Use BeforeOrAfter

Input indicating if the notification is being sent before the document is saved (kBefore), after a change is made (kAfter), or when a change has been aborted (kAbort).

Message 3 of 5

I am using BeforeOrAfter, executing my code "kAfter" a successful save, or "kAbort" when no change is made to the document:

 

switch (BeforeOrAfter)
            {
                case EventTimingEnum.kAfter:
                    SetDocumentRotation();
                    HandlingCode = HandlingCodeEnum.kEventHandled;
                    break;
                case EventTimingEnum.kAbort:
                    SetDocumentRotation();
                    HandlingCode = HandlingCodeEnum.kEventHandled;
                    break;
                default:
                    HandlingCode = HandlingCodeEnum.kEventNotHandled;
                    break;
            }

 The event doesn't trigger at all when not using that stupid breakpoint...

Message 4 of 5

It seems that the reason it's not working is not my code =). Got a pluginloader working to load about 10 plugins and I suspect somethings wrong in that one!

Message 5 of 5

 

Check your Add-in definition file

addname.Addin

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

Post to forums  

Autodesk Design & Make Report