Inventor Ribbon Customization

Inventor Ribbon Customization

Jason.Rugg
Collaborator Collaborator
3,313 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,314 Views
22 Replies
Replies (22)
Message 21 of 23

Curtis_Waguespack
Consultant
Consultant

@DRoam wrote:

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."

 


Hi @DRoam

 

Ahh, good point here are some links concerning macro button setup for those that might find this in the future and have not done this before:

https://modthemachine.typepad.com/my_weblog/2016/02/creating-a-button-for-a-vba-macro.html

https://modthemachine.typepad.com/my_weblog/2010/03/buttons-for-vba-macros-in-the-ribbon-user-interf...

 

As for getting the custom ribbon panels to persist, Mr. Nagy is correct. What I have done is to load them using an Event Trigger.


With Inventor 2017 and previous, it's a bit more difficult, but with  2018 and on there is an All Documents event trigger category, that you can use for this:

  • Create an external ilogic rule and add this: (where project name, module name, and macro name match)
    •  InventorVb.RunMacro("ApplicationProject", "Module_CustomRibbon", "Customize_Ribbon")
  • Then add this external rule to the All Documents > After Open  Document and New Document event triggers
  • And then finally you'll likely want to make a modification to the example code I posted yesterday and replace this:
    '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

With this:

    'check for existing custom panels
    'and exit sub when found
    '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
           Exit Sub
        End If
    Next

This prevents the macro from running fully, when the tool panels already exist.

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

 

EESignature

0 Likes
Message 22 of 23

DRoam
Mentor
Mentor

 Ah ok, perfect, thank you.

 

So I assume that means if I accidentally screw anything up with my UI customizations, it'll simply be wiped out when Inventor is closed? So I don't need to worry about corrupting anything while experimenting with this?

0 Likes
Message 23 of 23

Jason.Rugg
Collaborator
Collaborator

@Curtis_Waguespack

This seems to be working well so far, the one thing I'm not crazy about is every time a new document is started Inventor very quickly opens and closes a new ipt, iam, dwg. Is there a way to get it to do this in the background so it's not flashing new documents on screen? I am hesitant about pushing this out to other users with that behavior.

 

Thanks,

Jason

0 Likes