Inventor Ribbon Customization

Inventor Ribbon Customization

Jason.Rugg
Collaborator Collaborator
3,288 Views
22 Replies
Message 1 of 23

Inventor Ribbon Customization

Jason.Rugg
Collaborator
Collaborator

I have developed many external ilogic rules/commands that are fired from customized buttons in the ribbon menu. I need to push these buttons out to all users, to do this I have been exporting out the "Customization Settings" and then manually importing them on all other machines. Is there a way to automate this so I don't have to do this manually on all machines?

3,289 Views
22 Replies
Replies (22)
Message 2 of 23

bradeneuropeArthur
Mentor
Mentor

what do you understand under Customized buttons?

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 3 of 23

Jason.Rugg
Collaborator
Collaborator

What do you mean by that question?

0 Likes
Message 4 of 23

bradeneuropeArthur
Mentor
Mentor

how did you create your custom buttons in the inventor ribbon.

With:

-Vba or

-Vb.net?

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 5 of 23

Jason.Rugg
Collaborator
Collaborator

I just use the built in VBA Editor in Inventor.

0 Likes
Message 6 of 23

bradeneuropeArthur
Mentor
Mentor

You can run the inventor exe with the xml setting!

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 7 of 23

Jason.Rugg
Collaborator
Collaborator

Can you elaborate on that? Not sure what you mean by running the the .exe with the .xml.

0 Likes
Message 8 of 23

Jason.Rugg
Collaborator
Collaborator

The following is what I am envisioning but not sure what switch to use for the customization settings.

 

https://knowledge.autodesk.com/support/inventor-products/learn-explore/caas/simplecontent/content/co...

0 Likes
Message 9 of 23

bradeneuropeArthur
Mentor
Mentor

put this in your inventor exe shortcut:

 

"C:\Program Files\Autodesk\Inventor 20yy\Bin\Inventor.exe" /importcustomizations="C:\Preferences\test.xml"

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 10 of 23

Jason.Rugg
Collaborator
Collaborator

I found some switches and tried them but they didn't work, Inventor launched without any errors but the settings were not imported. Here are the two commands I tried:

 

"C:\Program Files\Autodesk\Inventor 2019\Bin\Inventor.exe" /IMPORTCUSTOMIZATIONS="\\kcidata\cad\cad\Inventor Customizations\2019\Migration Settings\CustomizeUserCommands 10-31-2018.XML

 

"C:\Program Files\Autodesk\Inventor 2019\Bin\Inventor.exe" /IMPORTRIBBONCUSTOMIZATIONS="\\kcidata\cad\cad\Inventor Customizations\2019\Migration Settings\CustomizeUserCommands 10-31-2018.XML

0 Likes
Message 11 of 23

bradeneuropeArthur
Mentor
Mentor

I will test it tomorrow  and will let you know. I am far from my desk right know.

 

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 12 of 23

Jason.Rugg
Collaborator
Collaborator

According to the following post for Inventor 2018, the command line switch(s) may not be working. I am using 2019 and they are working, so maybe this is still an issue that is still being investigated.

 

https://knowledge.autodesk.com/support/inventor-products/troubleshooting/caas/sfdcarticles/sfdcartic...

0 Likes
Message 13 of 23

DRoam
Mentor
Mentor

I'm in the exact same boat, @Jason.Rugg. I want to automate the process of adding VBA macros to the ribbon. There seem to be only two ways of doing this currently, and both of them have their issues.

 

You can add the command line switch to import customization settings, but that still requires manually setting that up, and even worse, it wipes out any customizations that the user may have done... this is a deal-breaker in my opinion.

 

The other method is using the methods avaialbe under ThisApplication.UserInterfaceManager (see this thread). However, I've experienced some issues with this. I've read that these changes don't persist from session to session. And I haven't fully tested this because, the last time I tried using this to add Ribbon buttons, my Customizations XML file ended up corrupted I had to reset it.

 

So I'm with you and would really like to know if someone out there has developed a stable iLogic/VBA solution for automatically adding buttons to the ribbon...

0 Likes
Message 14 of 23

bradeneuropeArthur
Mentor
Mentor

The Very best option is to start writing your first add in for this.

All the questions and issues with ilogic are solved then.

I could guide you in the right direction of needed...

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 15 of 23

Curtis_Waguespack
Consultant
Consultant

@DRoam wrote: 

So I'm with you and would really like to know if someone out there has developed a stable iLogic/VBA solution for automatically adding buttons to the ribbon...


 

 

I've got this in place, but it's a bit involved... I'll try to put something together that makes sense.

EESignature

0 Likes
Message 16 of 23

DRoam
Mentor
Mentor

Thanks very much, Curtis, I'd appreciate it.

 


@Curtis_Waguespack wrote:

I've got this in place, but it's a bit involved...


Perhaps if you try imagining it as a spoon...

Message 17 of 23

DRoam
Mentor
Mentor

@bradeneuropeArthur wrote:

The Very best option is to start writing your first add in for this.

All the questions and issues with ilogic are solved then.

I could guide you in the right direction of needed...


That's what I would ultimately like to do but I'm not quite ready to go down that hole yet. I don't have any experience with add-ins, and I need to get this deployed soon (and be confident that it will be stable for our many users.). I mostly have the iLogic infrastructure in place, I just need to make it more accessible in a user-friendly way.

 

Would appreciate any resources you have though, for when I do decide to tackle this.

0 Likes
Message 18 of 23

Curtis_Waguespack
Consultant
Consultant

 

This example expects to find 3 external rules called:

  • Spoon Rule
  • Fork Rule
  • Knife Rule

you would change the names in the sub routines to match the name of your rules, and add subs as needed to add more buttons to the ribbon.

 

This example creates a "My  _____ Tools' Panel on the tools tab of the ribbon for the file type of the active file.

 

Start the VBA editor

 

Ribbon2.png

 

  • Locate the Modules folder in the Application Project and right click on it and choose Insert > Module
  • Rename the Module something like Module_CustomRibbon
  • Paste in this code:
Sub Customize_Ribbon()

    ThisApplication.SilentOperation = True
    
    'silently create file of type
    'set the custom ribbon panel
    'then close the file

   
    ' Create a new Assembly document, using the default Assembly template.
    Dim oAssemblyDoc As AssemblyDocument
    Set oAssemblyDoc = ThisApplication.Documents.Add(kAssemblyDocumentObject, _
                ThisApplication.FileManager.GetTemplateFile(kAssemblyDocumentObject), True)
    Call SetRibbon
    oAssemblyDoc.Close
                
    ' Create a new Drawing document, using the default Drawing template.
    Dim oDrawDoc As DrawingDocument
    sTemplate = "\\SERVER\Departments\CAD\Inventor\Macros\Macro_Template.idw"
    Set oDrawDoc = ThisApplication.Documents.Add(kDrawingDocumentObject, _
                sTemplate, True)
                
    Call SetRibbon
    oDrawDoc.Close
    
    
    ' Create a new part document, using the default part template.
    Dim oPartDoc As PartDocument
    Set oPartDoc = ThisApplication.Documents.Add(kPartDocumentObject, _
                ThisApplication.FileManager.GetTemplateFile(kPartDocumentObject), True)
                
    Call SetRibbon
    oPartDoc.Close

    
    ThisApplication.SilentOperation = False

                
 End Sub
                


Sub SetRibbon()
    
    Dim oRibbon  As Inventor.Ribbon
    
    'determine file type
    If ThisApplication.ActiveDocumentType = DocumentTypeEnum.kAssemblyDocumentObject Then
        Set oRibbon = ThisApplication.UserInterfaceManager.Ribbons.Item("Assembly")
        oType = "Assembly"
    ElseIf ThisApplication.ActiveDocumentType = DocumentTypeEnum.kPartDocumentObject Then
        Set oRibbon = ThisApplication.UserInterfaceManager.Ribbons.Item("Part")
        oType = "Part"
    ElseIf ThisApplication.ActiveDocumentType = DocumentTypeEnum.kDrawingDocumentObject Then
        Set oRibbon = ThisApplication.UserInterfaceManager.Ribbons.Item("Drawing")
        oType = "Drawing"
    Else
        oType = "Unknown"
    End If
    
    
    If oType = "Unknown" Then
        Exit Sub
    End If
    
    
    'Get the "Tools" tabs
    Dim oTab As RibbonTab
    Set oTab = oRibbon.RibbonTabs.Item("id_TabTools")
    oTab.Active = True
    

    'clean up existing custom panels
    'this prevents errors when panels
    'already exists
    Dim oPanel As RibbonPanel
    For Each oPanel In oTab.RibbonPanels
        If oPanel.DisplayName = "My Assembly Tools" _
        Or oPanel.DisplayName = "My Drawing Tools" _
        Or oPanel.DisplayName = "My Part Tools" Then
            oPanel.Delete 'remove it
        
        End If
    Next

    ' Create a panels
    Dim oPanel_Assem As RibbonPanel
    Set oPanel_Assem = oTab.RibbonPanels.Add("My Assembly Tools", "ToolsTabAssemPanel", "SampleClientId")
    Dim oPanel_Draw As RibbonPanel
    Set oPanel_Draw = oTab.RibbonPanels.Add("My Drawing Tools", "ToolsTabDrawPanel", "SampleClientId")
    Dim oPanel_Part As RibbonPanel
    Set oPanel_Part = oTab.RibbonPanels.Add("My Part Tools", "ToolsTabPartPanel", "SampleClientId-3")
    
    
Dim oMacroDef As MacroControlDefinition

If oType = "Assembly" Then
    
    Set oMacroDef = ThisApplication.CommandManager.ControlDefinitions. _
    AddMacroControlDefinition("Module_iLogicRules.Bend Spoon Rule")
    
    oPanel_Assem.CommandControls.AddMacro oMacroDef, False
    
    Set oMacroDef = ThisApplication.CommandManager.ControlDefinitions. _
    AddMacroControlDefinition("Module_iLogicRules.Bend Fork Rule")
    
    oPanel_Assem.CommandControls.AddMacro oMacroDef, False
    
    Set oMacroDef = ThisApplication.CommandManager.ControlDefinitions. _
    AddMacroControlDefinition("Module_iLogicRules.Bend Knife Rule")
    
    oPanel_Assem.CommandControls.AddMacro oMacroDef, False

ElseIf oType = "Drawing" Then
    'add drawing rules code here
    
ElseIf oType = "Part" Then
     'add part rules code here
    
End If

End Sub
  • Again locate the Modules folder in the Application Project and right click on it and choose Insert > Module
  • Rename the Module something like "Module_iLogicRules"
  • Paste in this code:
'Module_iLogicRules
'this module allows iLogic rules to be triggered
'from a VBA macro, fired from a ribbon button

Public Sub Spoon_rule()
    'ilogic rule name:
     RuniLogicExt "Bend Spoon Rule"
End Sub
Public Sub Fork_Rule()
    'ilogic rule name:
     RuniLogicExt "Bend Fork Rule"
End Sub
Public Sub Knife_Rule()
    'ilogic rule name:
     RuniLogicExt "Bend Knife Rule"
End Sub

Public Sub RuniLogicExt(ByVal RuleName As String)

   Dim oPath As String
   oPath = "\\server\departments\CAD\Inventor\iLogic\"
   
   Dim iLogicAuto As Object
   Dim oDoc As Document
   Set oDoc = ThisApplication.ActiveDocument
   If oDoc Is Nothing Then
      MsgBox "Missing Inventor Document"
      Exit Sub
   End If
   Set iLogicAuto = GetiLogicAddin(ThisApplication)
   If (iLogicAuto Is Nothing) Then
   MsgBox "iLogicAuto Is Nothing"
   Exit Sub
   End If

   iLogicAuto.RunExternalRule oDoc, oPath & RuleName & ".iLogicVb"
End Sub

Function GetiLogicAddin(oApplication As Inventor.Application) As Object
   Set addIns = oApplication.ApplicationAddIns
   Dim addIn As ApplicationAddIn
   On Error GoTo NotFound
   Set addIn = oApplication.ApplicationAddIns.ItemById("{3bdd8d79-2179-4b11-8a5a-257b1c0263ac}")
   If (addIn Is Nothing) Then Exit Function
   addIn.Activate
   Set GetiLogicAddin = addIn.Automation
   Exit Function
NotFound:
End Function

 

Example result for an assembly file 

Ribbon.PNG

 

EESignature

Message 19 of 23

Jason.Rugg
Collaborator
Collaborator

Thanks Curtis, I will also give this a try and see if I can adapt it to my customizations. Can you shoot me a private message when you have a chance?

0 Likes
Message 20 of 23

DRoam
Mentor
Mentor

Haha, thanks a ton, Curtis. What, no cutlery icons for the macro buttons? 😉

 

Question about this... in this blog post: Rename the "User Commands" panel, Mr. Nagy says that "programmatically added UI elements are not persisted. So you would have to run your command that adds the extra ribbon panel each time Inventor starts."

 

Does it apply to your rule as well? If not, what makes his rule different?

 

If programmatically-added UI elements ARE persisted, can you tell me how/where they are stored, and is there any way to reset the UI if anything goes wrong?