Message 1 of 7
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi everyone,
I have created some code (with the help of others on this forum) that creates a tab on the ribbon (inventor).
So far it works great, I can execute my external rules from my created ribbon tab.
Although this works well, I want to organize it a bit better. i want to split some of the actions listed under drawings into separate panels within the created tab. I cant find any information on this.
The code is posted below:
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 = "Silent-Aire_" Try oRibbon.RibbonTabs.Item(oName & oType).Delete Catch End Try Dim oTab As Inventor.RibbonTab oTab = oRibbon.RibbonTabs.Add(oName & oType, oName & oType, “Silent-Aire”) oTab.Active = True Dim oPanel As RibbonPanel sPanelName = oName & " Tools" oPanel = oTab.RibbonPanels.Add(sPanelName, oName & oType, oName & oType) Dim oControlDefs As ControlDefinitions oControlDefs = ThisApplication.CommandManager.ControlDefinitions Dim oButtonsList As New ArrayList If oType = "Drawing" Then 'first panel (to be made) oButtonsList.Add("Ribbon_Executables.Reuse_Drawing") oButtonsList.Add("Ribbon_Executables.Center_Dimensions") oButtonsList.Add("Ribbon_Executables.Missing_Balloons") oButtonsList.Add("Ribbon_Executables.Sort_and_Hide_Partlist") 'second panel (to be made) oButtonsList.Add("Ribbon_Executables.Issued_For_Construction") oButtonsList.Add("Ribbon_Executables.Add_Revision_Row") oButtonsList.Add("Ribbon_Executables.Hide_Revision_Row") oButtonsList.Add("Ribbon_Executables.Clear_Revisions_Batch") oButtonsList.Add("Ribbon_Executables.Clear_Revisions_Single") 'third panel (to be made) oButtonsList.Add("Ribbon_Executables.Batch_Print_to_PDF") oButtonsList.Add("Ribbon_Executables.Single_Print_to_PDF") oButtonsList.Add("Ribbon_Executables.EDM_Printer_1") oButtonsList.Add("Ribbon_Executables.EDM_Printer_2") oButtonsList.Add("Ribbon_Executables.EDM_Printer_Crowsnest") oButtonsList.Add("Ribbon_Executables.PHX_Printer_Samsungx7600GX") oButtonsList.Add("Ribbon_Executables.PHX_Printer_Cannon_iR_ADV_C7260") Else If oType = "Assembly" Then oButtonsList.Add("Ribbon_Executables.Open_All_Drawings") oButtonsList.Add("Ribbon_Executables.Go_To_Working_Folder") oButtonsList.Add("Ribbon_Executables.Total_Weight") oButtonsList.Add("Ribbon_Executables.Creat_Part_Drawing") oButtonsList.Add("Ribbon_Executables.Excel_BOM_Export") Else If oType = "Part" Then oButtonsList.Add("Ribbon_Executables.Open_All_Drawings") oButtonsList.Add("Ribbon_Executables.Go_To_Working_Folder") oButtonsList.Add("Ribbon_Executables.Density") oButtonsList.Add("Ribbon_Executables.Creat_Part_Drawing") oButtonsList.Add("Ribbon_Executables.Copy_Design") End If Dim oMacroDef As MacroControlDefinition For Each oItem In oButtonsList oMacroDef = oControlDefs.AddMacroControlDefinition(oItem) oPanel.CommandControls.AddMacro(oMacroDef, False) Next
these are the splits i want to make:
'first panel (to be made) oButtonsList.Add("Ribbon_Executables.Reuse_Drawing") oButtonsList.Add("Ribbon_Executables.Center_Dimensions") oButtonsList.Add("Ribbon_Executables.Missing_Balloons") oButtonsList.Add("Ribbon_Executables.Sort_and_Hide_Partlist") 'second panel (to be made) oButtonsList.Add("Ribbon_Executables.Issued_For_Construction") oButtonsList.Add("Ribbon_Executables.Add_Revision_Row") oButtonsList.Add("Ribbon_Executables.Hide_Revision_Row") oButtonsList.Add("Ribbon_Executables.Clear_Revisions_Batch") oButtonsList.Add("Ribbon_Executables.Clear_Revisions_Single") 'third panel (to be made) oButtonsList.Add("Ribbon_Executables.Batch_Print_to_PDF") oButtonsList.Add("Ribbon_Executables.Single_Print_to_PDF") oButtonsList.Add("Ribbon_Executables.EDM_Printer_1") oButtonsList.Add("Ribbon_Executables.EDM_Printer_2") oButtonsList.Add("Ribbon_Executables.EDM_Printer_Crowsnest") oButtonsList.Add("Ribbon_Executables.PHX_Printer_Samsungx7600GX") oButtonsList.Add("Ribbon_Executables.PHX_Printer_Cannon_iR_ADV_C7260")
Thanks everyone,
Solved! Go to Solution.