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: 

Trouble getting OnViewUpdate to fire

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
rjay75
293 Views, 4 Replies

Trouble getting OnViewUpdate to fire

The event OnViewUpdate in the drawing view events seems to never fire. Subscribing to the event doesn't through any errors.

 

Does the event need to be enabled? If this event doesn't work is there another event the can notify of drawing updates?

4 REPLIES 4
Message 2 of 5
adam.nagy
in reply to: rjay75

Hi Rodney,

 

The easiest way to see which event fires when is to track all the events in this sample from the SDK:

C:\Users\Public\Documents\Autodesk\Inventor 2014\SDK\DeveloperTools\Tools\EventWatcher

 

Cheers,



Adam Nagy
Autodesk Platform Services
Message 3 of 5
rjay75
in reply to: adam.nagy

Thanks Adam, using the Event Watcher I could see that the event was firing.

 

After examining the event watcher code I determined it had to do with the how I was handling the DrawingViewObjects I was attaching the events to. For some reason (that I can't figure out) it seems as if a DrawingViewEvents object variable must be referenced from an object at global scope or a scope that is always persistant in order for the OnViewUpdate event to fire.

Message 4 of 5
rjay75
in reply to: adam.nagy

Along with the OnViewUpdate, is there a way to determine what drawing view the event has fired for? I want to examine and update certain Dimensions but only after the DrawingView they are attached to has updated.

 

Thanks

Message 5 of 5
adam.nagy
in reply to: rjay75

Hi Rodney,

 

First I thought you just missed the fact that these events are DrawingView specific, but then realized that even knowing that does not make the answer straight forward, so I had to think about it 🙂

 

Here is what I came up with:
http://adndevblog.typepad.com/manufacturing/2014/10/which-drawingview-triggered-onviewupdate.html

 

And concerning declaring the variables globally. 
That is as designed. If a variable goes out of scope then it will be destroyed and so cannot handle events:
http://msdn.microsoft.com/en-us/library/hks5e2k6.aspx

 

Cheers,



Adam Nagy
Autodesk Platform Services

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

Post to forums  

Autodesk Design & Make Report