Modify Ribbon "Customize" settings using iLogic/VBA

Modify Ribbon "Customize" settings using iLogic/VBA

DRoam
Mentor Mentor
921 Views
4 Replies
Message 1 of 5

Modify Ribbon "Customize" settings using iLogic/VBA

DRoam
Mentor
Mentor

The application options can be easily set with iLogic using the "ThisApplication.<tabname>options" properties. However, I haven't been able to find anything similar for the "Customize" settings (the ones in the "Tools" tab --> "Options" panel --> "Customize" dialog.)

 

Specifically, it's the ribbon customization that I'm after. I've managed to write an iLogic script that automates the process of getting everyone accessing the same iLogic External Directories and "Default VBA Project", which means we're || this close to giving everyone access to the same toolset of External iLogic rules via macro buttons in the Ribbon. They now have the VBA macros and iLogic scripts--all they're missing is the Ribbon buttons themselves.

 

I did discover that I can isolate just the "Custom Panels" portion of the Customize XML file, and if a user imports that XML file via the Customize dialog, the custom buttons are added to their ribbon while the rest of their customizations are left alone. So that's a good first step.

 

So to accomplish what I want, I'd be happy with one of two solutions:

  1. A way to directly edit ribbon customization using iLogic/VBA (like we can with the Application Options), or
  2. A way to automatically import a customization XML file using iLogic/VBA

Thanks for any help or nudges in the right direction.

0 Likes
922 Views
4 Replies
Replies (4)
Message 2 of 5

clutsa
Collaborator
Collaborator

This is not correct but it is where you need to be looking.

ThisApplication.UserInterfaceManager.Ribbons("Drawing").RibbonTabs("Place Views").RibbonPanels("User Commands").CommandControls.AddButton()

 

 

If I've helped you, please help me by supporting this idea.
Mass Override for Each Model State

Custom Glyph Icon for iMates

0 Likes
Message 3 of 5

clutsa
Collaborator
Collaborator

Here i took more time to get something that works. (keep in mind I already had all these tabs and pannels in place)

Sub AddMacro()
Dim app As Application
Dim Doc As Document

Set app = ThisApplication
Set Doc = app.ActiveDocument

Dim MCD As MacroControlDefinition
Set MCD = app.CommandManager.ControlDefinitions.AddMacroControlDefinition("macro:iPropFunctions.FillPropWithoutApproval") 'macro:modules.sub

Dim drwRibbon As Ribbon
Dim ribTab As RibbonTab
Dim ribPan As RibbonPanel
'based on ThisApplication.UserInterfaceManager.Ribbons("Drawing").RibbonTabs("Place Views").RibbonPanels("User Commands").CommandControls.AddButton
Set drwRibbon = ThisApplication.UserInterfaceManager.Ribbons.Item(4) 'Drawing
Set ribTab = drwRibbon.RibbonTabs.Item(1) 'Place Views
Set ribPan = ribTab.RibbonPanels.Item(6) 'UserCommands
Call ribPan.CommandControls.AddMacro(MCD)
End Sub
If I've helped you, please help me by supporting this idea.
Mass Override for Each Model State

Custom Glyph Icon for iMates

0 Likes
Message 4 of 5

DRoam
Mentor
Mentor

@clutsa, sorry for the delay, and thanks for the information. Do you know where I could find some additional documentation about how these commands work?

 

Specifically, I'm wondering where these customizations are stored. I'm worried about corrupting something, either in the InventorCustomization.xml file, or (worse) in the Inventor installation itself.

 

Are these iLogic commands officially documented or described in detail anywhere that you know of?

 

Thanks again.

0 Likes
Message 5 of 5

clutsa
Collaborator
Collaborator

@DRoam

There is documentation but it can be tricky to find if you don't know were to look.

 

https://knowledge.autodesk.com/support/inventor-products/learn-explore/caas/sfdcarticles/sfdcarticle...

The above link (kind of) tells you what to install (from Autodesk) so you can find something like the below link. 

https://knowledge.autodesk.com/akn-aknsite-article-attachments/d20aa033-13a7-4b23-a790-1897b317c523....

 

From there you can use the "Object Model" to look up more detail about functions and objects. 

The object model can be accessed from the VBA Editor.

 

 

 

Don't forget if your question is answered to click "Accept as Solution"

If I've helped you, please help me by supporting this idea.
Mass Override for Each Model State

Custom Glyph Icon for iMates

0 Likes