Inventor Ribbon

Inventor Ribbon

3DAli
Collaborator Collaborator
1,267 Views
6 Replies
Message 1 of 7

Inventor Ribbon

3DAli
Collaborator
Collaborator

HI , 

 

is ther any way to alter the "User Commands" default name for macros added to the ribbon in inventor?  (see attached)

 

Thanks

0 Likes
1,268 Views
6 Replies
Replies (6)
Message 2 of 7

adam.nagy
Autodesk Support
Autodesk Support

Hi,

 

The name of the panel does not seem customizable, and you cannot even modify it through the API.

 

You could create your own panel instead - you would have to do it though each time Inventor starts because these changes are not persisted:
http://adndevblog.typepad.com/manufacturing/2016/04/rename-the-user-commands-panel.html

 

Cheers,



Adam Nagy
Autodesk Platform Services
Message 3 of 7

3DAli
Collaborator
Collaborator

Thanks Adam, 

 

I will go through the link you sent and see what I can find.

 

Cheers

Ali

0 Likes
Message 4 of 7

3DAli
Collaborator
Collaborator

Hi Adam, 

 

once again thanks for the info. I was wondering I I can set up an iLogic rule with an event trigger, so that every time you open a new document, it runs the macro and the panel is added that way.

 

Regards

0 Likes
Message 5 of 7

adam.nagy
Autodesk Support
Autodesk Support

Hi,

 

iLogic events are only for Rules residing in Documents, so it would be difficult to achieve it that way because the Rule would need to be available in all Documents you open.

 

If you want to do UI customisation the best might be to migrate your code to an add-in: http://modthemachine.typepad.com/my_weblog/2008/10/converting-vba-auto-macros-to-an-add-in.html


Now it's even simpler than in the article I've pointed out because of the RegFree registration: http://adndevblog.typepad.com/manufacturing/2012/05/creating-or-migrating-your-inventor-add-ins-to-t...

 

Cheers,



Adam Nagy
Autodesk Platform Services
0 Likes
Message 6 of 7

MechMachineMan
Advisor
Advisor

Adam, as it is along the same topic I will just ask here:

 

Is there any easy way to make the changes persist to ribbon tab changes? I just want to create a rule for deployment that sets up macro buttons, mimicing what the user would do.

 

Here is the code I'm using to accomplish what I have so far, however; it doesn't persist even though I am using the default "User Commands Tab"

 

ThisApplication.FileOptions.DefaultVBAProjectFileFullFilename = "X:\CAD Library\iLogic\Default.ivb"

Dim oControlDefinitions As ControlDefinitions = ThisApplication.CommandManager.ControlDefinitions
Dim oMacroControlDef As MacroControlDefinition = oControlDefinitions.AddMacroControlDefinition("Module1.ToggleWorkFeatures")
	oMacroControlDef.OverrideShortcut = "Ctrl+D"
Dim oMacroControlDef2 As MacroControlDefinition = oControlDefinitions.AddMacroControlDefinition("Module3.OpenWorkspaceFolder")
Dim oMacroControlDef3 As MacroControlDefinition = oControlDefinitions.AddMacroControlDefinition("Module4.OpenDynaParts")



'Assembly Tab
'[
Dim oAssyToolsTab As RibbonTab = ThisApplication.UserInterfaceManager.Ribbons.Item("Assembly").RibbonTabs.Item("id_TabTools")

Dim oUserCommands As RibbonPanel 
Try
	oUserCommands = oAssyToolsTab .RibbonPanels.Item("Assembly.id_TabTools.UserCommands")
Catch
	oUserCommands = oAssyToolsTab .RibbonPanels.Add("User Commands", "Assembly.id_TabTools.UserCommands", "")
End Try

Dim oCommandControls As CommandControls = oUserCommands.CommandControls

Try
	oCommandControls.AddMacro(oMacroControlDef, False, True,,)
	oCommandControls.AddMacro(oMacroControlDef2, False, True,,)
	oCommandControls.AddMacro(oMacroControlDef3, False, True,,)
	MsgBox("Buttons Added! - ASSY")
Catch
	MsgBox("Button Add Failure! - ASSY")
End Try
']


'Drawing
'[
Dim oDwgToolsTab As RibbonTab = ThisApplication.UserInterfaceManager.Ribbons.Item("Drawing").RibbonTabs.Item("id_TabTools")

Try
	oUserCommands = oDwgToolsTab .RibbonPanels.Item("Drawing.id_TabTools.UserCommands")
Catch
	oUserCommands = oDwgToolsTab .RibbonPanels.Add("User Commands", "Drawing.id_TabTools.UserCommands", "")
End Try

oCommandControls = oUserCommands.CommandControls

Try
	oCommandControls.AddMacro(oMacroControlDef2, False, True,,)
	oCommandControls.AddMacro(oMacroControlDef3, False, True,,)
	MsgBox("Buttons Added! - DWG")
Catch
	MsgBox("Button Add Failure! - DWG")
End Try
']

'ZeroDoc
'[
Dim oZeroToolsTab As RibbonTab = ThisApplication.UserInterfaceManager.Ribbons.Item("ZeroDoc").RibbonTabs.Item("id_TabTools")

Try
	oUserCommands = oZeroToolsTab.RibbonPanels.Item("ZeroDoc.id_TabTools.UserCommands")
Catch
	oUserCommands = oZeroToolsTab.RibbonPanels.Add("User Commands", "ZeroDoc.id_TabTools.UserCommands", "")
End Try

oCommandControls = oUserCommands.CommandControls

Try
	oCommandControls.AddMacro(oMacroControlDef2, False, True,,)
	oCommandControls.AddMacro(oMacroControlDef3, False, True,,)
	MsgBox("Buttons Added! - ZeroDoc")
Catch
	MsgBox("Button Add Failure! - ZeroDoc")
End Try
']

--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.

Justin K
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization


iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread

Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects

Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help

Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type
0 Likes
Message 7 of 7

adam.nagy
Autodesk Support
Autodesk Support

Hi Justin,

 

Modifications done to the Ribbon directly through the API (no matter which panel or tab) need to be persisted by your program - Inventor does not do it for you.

If you do it through the "Customize User Commands" dialog then Inventor will take care of persisting those modifications. I don't think you have access to that though through the API. :-s

 

I thought Import/Export of the "Customize" dialog was exposed in the API, but cannot find it, so I was probably wrong. That could have provided a workaround.

 

So as I said, I think the best thing is to create an addin for it.

 

Cheers,



Adam Nagy
Autodesk Platform Services
0 Likes