Message 1 of 1
custom ribbon tab spacing out buttons
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi everyone,
A while back I used some sources here on the forums to make a program that creates a custom ribbon tab. I have it almost exactly the way I want it with one exception. I want to be able to space out command buttons to keep things organized. bellow is a snip of what i have right now, where I am using an Empty command button to space the buttons out.
This is what it looks like with out the empty button.
An example of what I want to accomplish can be seen in the manage tab in the define panel.
code:
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 = "company name "
Try
oRibbon.RibbonTabs.Item(oName & oType).Delete
Catch
End Try
Dim oControlDefs As ControlDefinitions
oControlDefs = ThisApplication.CommandManager.ControlDefinitions
If oType = "Drawing" Then
Dim oTab As Inventor.RibbonTab
oTab = oRibbon.RibbonTabs.Add(oName & oType, oName & oType, “company name”)
'oTab.Active = True
Dim APanel As RibbonPanel
APanelName = oName & " Tools"
APanel = oTab.RibbonPanels.Add(APanelName, oName & "Tools", oName & "Tools")
Dim AButtonsList As New ArrayList
AButtonsList.Add("Ribbon_Executables.Go To Working Folder")
AButtonsList.Add("Ribbon_Executables.Reuse Drawing")
AButtonsList.Add("Ribbon_Executables.Vault Check In")
AButtonsList.Add("Ribbon_Executables.Precise View")
AButtonsList.Add("Ribbon_Executables.Center View Labels")
AButtonsList.Add("Ribbon_Executables.Center Dimensions")
AButtonsList.Add("Ribbon_Executables.Sort and Hide Partlist")
AButtonsList.Add("Ribbon_Executables.Missing Balloons")
AButtonsList.Add("Ribbon_Executables.Update Balloons")
AButtonsList.Add("Ribbon_Executables.Drawing Notes")
AButtonsList.Add("Ribbon_Executables.Fastener Details")
Dim BPanel As RibbonPanel
BPanelName = oName & " Revisions"
BPanel = oTab.RibbonPanels.Add(BPanelName, oName & "Revisions", oName & "Revisions")
Dim BButtonsList As New ArrayList
BButtonsList.Add("Ribbon_Executables.Add Revision Row Batch")
BButtonsList.Add("Ribbon_Executables.Add Revision Row Single")
BButtonsList.Add("Ribbon_Executables.Hide Revision Rows")
BButtonsList.Add("Ribbon_Executables.Clear Revisions Batch")
BButtonsList.Add("Ribbon_Executables.Clear Revisions Single")
'BButtonsList.Add("Ribbon_Executables.Empty ")
BButtonsList.Add("Ribbon_Executables.IFC Batch")
BButtonsList.Add("Ribbon_Executables.IFC Single")
Dim CPanel As RibbonPanel
CPanelName = oName & " Printing"
CPanel = oTab.RibbonPanels.Add(CPanelName, oName & "Printers", oName & "Printers")
Dim CButtonsList As New ArrayList
CButtonsList.Add("Ribbon_Executables.EDM Printer 1")
CButtonsList.Add("Ribbon_Executables.EDM Printer 2")
CButtonsList.Add("Ribbon_Executables.EDM Printer Crowsnest")
CButtonsList.Add("Ribbon_Executables.PHX Printer 1")
CButtonsList.Add("Ribbon_Executables.PHX Printer 2")
CButtonsList.Add("Ribbon_Executables.PHX Printer 3")
CButtonsList.Add("Ribbon_Executables.Single Print to PDF")
CButtonsList.Add("Ribbon_Executables.Batch Print to PDF")
Dim oMacroDef As MacroControlDefinition
For Each oItem In AButtonsList
oMacroDef = oControlDefs.AddMacroControlDefinition(oItem)
APanel.CommandControls.AddMacro(oMacroDef, False)
Next
For Each oItem In BButtonsList
oMacroDef = oControlDefs.AddMacroControlDefinition(oItem)
BPanel.CommandControls.AddMacro(oMacroDef, False)
Next
For Each oItem In CButtonsList
oMacroDef = oControlDefs.AddMacroControlDefinition(oItem)
CPanel.CommandControls.AddMacro(oMacroDef, False)
Next
Else If oType = "Assembly" Then
Dim oTab As Inventor.RibbonTab
oTab = oRibbon.RibbonTabs.Add(oName & oType, oName & oType, “company name”)
'oTab.Active = True
Dim APanel As RibbonPanel
APanelName = oName & " Tools"
APanel = oTab.RibbonPanels.Add(APanelName, oName & "Tools", oName & "Tools")
Dim AButtonsList As New ArrayList
AButtonsList.Add("Ribbon_Executables.Remove Mass Prompt Assy")
AButtonsList.Add("Ribbon_Executables.Go To Working Folder")
AButtonsList.Add("Ribbon_Executables.Open All Drawings")
AButtonsList.Add("Ribbon_Executables.Batch Print All Drawings")
AButtonsList.Add("Ribbon_Executables.Total Weight")
AButtonsList.Add("Ribbon_Executables.Excel BOM Export")
AButtonsList.Add("Ribbon_Executables.Set Designer Properties")
AButtonsList.Add("Ribbon_Executables.Lazy Eye")
Dim oMacroDef As MacroControlDefinition
For Each oItem In AButtonsList
oMacroDef = oControlDefs.AddMacroControlDefinition(oItem)
APanel.CommandControls.AddMacro(oMacroDef, False)
Next
Else If oType = "Part" Then
Dim oTab As Inventor.RibbonTab
oTab = oRibbon.RibbonTabs.Add(oName & oType, oName & oType, “company name”)
'oTab.Active = True
Dim APanel As RibbonPanel
APanelName = oName & " Tools"
APanel = oTab.RibbonPanels.Add(APanelName, oName & "Tools", oName & "Tools")
Dim AButtonsList As New ArrayList
AButtonsList.Add("Ribbon_Executables.Remove Mass Prompt")
AButtonsList.Add("Ribbon_Executables.Go To Working Folder")
AButtonsList.Add("Ribbon_Executables.Density")
AButtonsList.Add("Ribbon_Executables.Create Part Drawing")
AButtonsList.Add("Ribbon_Executables.Copy Design")
AButtonsList.Add("Ribbon_Executables.Pilot Holes")
Dim oMacroDef As MacroControlDefinition
For Each oItem In AButtonsList
oMacroDef = oControlDefs.AddMacroControlDefinition(oItem)
APanel.CommandControls.AddMacro(oMacroDef, False)
Next
End If
Any help would be appreciated,
Brian