- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Create Button for externales rules
how too access defintions too externales rules
Sub Main() AddPanelToToolsTab() End Sub Sub AddPanelToToolsTab() ' Get the ribbon associated with the part document Dim oPartRibbon As Ribbon oPartRibbon = ThisApplication.UserInterfaceManager.Ribbons.Item("Part") ' Get the "Tools" tab Dim oTab As RibbonTab oTab = oPartRibbon.RibbonTabs.Item("id_TabTools") For Each item As RibbonPanel In oTab.RibbonPanels If item.DisplayName = "Update" oTab.RibbonPanels.Item(item.InternalName).Delete End If Next ' Create a panel named "Update", positioned after the "Measure" panel in the Tools tab. Dim oPanel As RibbonPanel oPanel = oTab.RibbonPanels.Add("Update", "ToolsTabUpdatePanel", "SampleClientId", "id_PanelP_ToolsMeasure") ' Get the update commands Dim oDef1 As ButtonDefinition oDef1 = ThisApplication.CommandManager.ControlDefinitions.Item("AppLocalUpdateCmd") Dim oDef2 As ButtonDefinition oDef2 = ThisApplication.CommandManager.ControlDefinitions.Item("AppUpdateMassPropertiesCmd") Dim oDefs As ObjectCollection oDefs = ThisApplication.TransientObjects.CreateObjectCollection oDefs.Add(oDef1) oDefs.Add(oDef2) ' Create a split button control Call oPanel.CommandControls.AddSplitButton(oDef1, oDefs, True) ' Get the rebuild command Dim oDef3 As ButtonDefinition oDef3 = ThisApplication.CommandManager.ControlDefinitions.Item("AppRebuildAllWrapperCmd") ' Create a button control Call oPanel.CommandControls.AddButton(oDef3, True) End Sub
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Which version of Inventor are you using? If 2024, then when iterating through the ControlDefinitions, you will see some with the name starts with "iLogic.Rule:", followed by the name of the external rule file, and file extension. That is the name of the ControlDefinition that the button will execute when clicked. And if adding the rule as a button using an iLogic rule, it may only stay there for the current session of Inventor, then it will be gone again. If you want the buttons to stay, you will want to add them manually, or use an add-in which puts them in place when Inventor starts. And I usually just get the ClientID of he iLogic ApplicationAddIn to use there, instead of "SampleClientID", when it is just for iLogic related stuff.
Wesley Crihfield
(Not an Autodesk Employee)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report