Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
JMGunnar
222 Views, 2 Replies

Add button too externales rules

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