Message 1 of 8
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I want too add button too external rule without add-ins
I can not found ControlDefinition
for iLogic External rule like MacroControlDefinition
Best Regards Johan
Dim oMacroDef As MacroControlDefinition For Each oItem In oButtonsList oMacroDef = oControlDefs.AddMacroControlDefinition(oItem) oPanel.CommandControls.AddMacro(oMacroDef, False) Next
oCommandType = InputRadioBox("Select One", _ "Built in commands", "Macro commands", False, "ilogic") ' Get the ribbon associated with the document Dim oRibbon As Inventor.Ribbon Dim oDoc As Document oDoc = ThisApplication.ActiveEditDocument If oDoc.DocumentType = DocumentTypeEnum.kAssemblyDocumentObject Then oRibbon = ThisApplication.UserInterfaceManager.Ribbons.Item("Assembly") oType = "Assembly" ElseIf oDoc.DocumentType = DocumentTypeEnum.kPartDocumentObject Then oRibbon = ThisApplication.UserInterfaceManager.Ribbons.Item("Part") oType = "Part" ElseIf oDoc.DocumentType = DocumentTypeEnum.kDrawingDocumentObject Then oRibbon = ThisApplication.UserInterfaceManager.Ribbons.Item("Drawing") oType = "Drawing" Else oType = "Unknown" Exit Sub End If oName = "TEST_" 'delete existing tab, in case it exist from previous test Try oRibbon.RibbonTabs.Item(oName & oType).Delete Catch End Try Dim oTab As Inventor.RibbonTab oTab = oRibbon.RibbonTabs.Add(oName & oType, oName & oType, "ClientId123") oTab.Active = True Dim oPanel As RibbonPanel sPanelName = oName & " Tools" oPanel = oTab.RibbonPanels.Add(sPanelName, sPanelName & "_" & oType, sPanelName & "_" & oType) Dim oControlDefs As ControlDefinitions oControlDefs = ThisApplication.CommandManager.ControlDefinitions Dim oButtonsList As New ArrayList If oCommandType = False If oType = "Drawing" Then oButtonsList.Add("Test.Test_01") oButtonsList.Add("Test.Test_02") Else If oType = "Assembly" Then oButtonsList.Add("Test.Test_03") oButtonsList.Add("Test.Test_04") Else If oType = "Part" Then oButtonsList.Add("Test.Test_05") oButtonsList.Add("Test.Test_06") End If Dim oMacroDef As MacroControlDefinition For Each oItem In oButtonsList oMacroDef = oControlDefs.AddMacroControlDefinition(oItem) oPanel.CommandControls.AddMacro(oMacroDef, False) Next Else If oType = "Drawing" Then oButtonsList.Add("DrawingBalloonCmd") oButtonsList.Add("DrawingBalloonAllCmd") Else If oType = "Assembly" Then oButtonsList.Add("AppZoomSelectCmd") oButtonsList.Add("AppZoomAllCmd") Else If oType = "Part" Then oButtonsList.Add("PartExtrudeCmd") oButtonsList.Add("PartRevolveCmd") End If Dim oButtonDef As ButtonDefinition For Each oItem In oButtonsList oButtonDef = oControlDefs.Item(oItem) oPanel.CommandControls.AddButton(oButtonDef, False) Next End If
Solved! Go to Solution.

