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: 

Reset ribbon when switching between documents

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
gert-leonvanlier
218 Views, 2 Replies

Reset ribbon when switching between documents

I found a small bug in an addin I developed for Inventor. I have buttons on the ribbon specific for the drawing environment that switch the size of the drawing sheet. If the user reaches the A4 paper, the downsize button is disabled and vice versa when reaching paper A0. That works all fine, except when the user switches between different drawing documents. Inventor "remembers" the button settings from the previous file. So when in document 1 the paper size is A4, the size down button is disabled. If you then switch to document 2, the button will still be disabled, even if the paper size is not A4.

 

So what I am looking for is a way to 'reset' the ribbon when switching between documents. As it is now, the disable ribbon buttons is done On Document Change.

2 REPLIES 2
Message 2 of 3

Hi @gert-leonvanlier.  I haven't worked with the OnDocumentChange Event that much before, but from the sounds of the situation, I would guess that the ApplicationEvents.OnDeactivateDocument Event might be a better choice for re-setting the ribbon.  Then maybe use the ApplicationEvents.OnActiateDocument Event to set it back to custom again, when conditions are met.  But I am not an expert on creating AddIns yet myself, so I may be wrong.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 3 of 3

On Activate Document indeed did the trick. I hadn't found that method yet. Thank you!

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

Post to forums  

Autodesk Design & Make Report