Is it possible to place a custom add-in button with code before the new select-button in Inventor 2015? See attached image for what I mean.
Solved! Go to Solution.
Solved by Rene_Gerlach. Go to Solution.
you can add your RibbonPanel before the select, if you set "TargetPanelInternalName" to id_PanelP_ShowPanels and InsertBeforTarget to True.
like this:
RibbonPanels.Add("MatProp", "InternalMatProp", "your ClientId", "id_PanelP_ShowPanels", True)
Hope this helps.
Yes as Rene mentioned, get the internaleName of the target and use the insertBefore = true/false to place your item before/after that target.
You can use the API to iterate all ribbon items to find out the internale names:
'// Dump Ribbon internal names to txt file
Public Function space(nb As Long) As String Dim res As String Dim i As Long For i = 0 To nb res = res & " " Next End Function Public Function AlignString(txt As String, size As Long) As String Dim nbSpace As Long nbSpace = size - Len(txt) If (nbSpace > 0) Then txt = txt & space(nbSpace) AlignString = txt Exit Function End If AlignString = txt End Function Public Sub PrintRibbon() Open "C:\temp\RibbonNames.txt" For Output As #1 Dim oControl As CommandControl Print #1, "File controls" For Each oControl In ThisApplication.UserInterfaceManager.FileBrowserControls If Not oControl.ControlType = kSeparatorControl Then Print #1, " Control: "; oControl.DisplayName & ", " & oControl.InternalName & ", Visible: " & oControl.Visible Else Print #1, " Control: Seperator" End If On Error GoTo 0 Next Dim oRibbon As ribbon For Each oRibbon In ThisApplication.UserInterfaceManager.Ribbons Print #1, " " Print #1, "-----------------------------------------------------------------" Print #1, "Ribbon: " & oRibbon.InternalName Print #1, " " Dim oTab As ribbonTab For Each oTab In oRibbon.RibbonTabs Print #1, " " Print #1, " -----------------------------------------------------------------" Print #1, " Tab: " & oTab.DisplayName & ", " & oTab.InternalName & ", Visible: " & oTab.Visible Print #1, " " If (oTab.RibbonPanels.count > 0) Then Dim oPanel As RibbonPanel For Each oPanel In oTab.RibbonPanels Print #1, " " Print #1, " " Print #1, " Panel: " & oPanel.DisplayName & ", " & oPanel.InternalName & ", Visible: " & oPanel.Visible Print #1, " " Print #1, " " For Each oControl In oPanel.CommandControls Print #1, " [Control]: " & AlignString(oControl.DisplayName, 30) _ & AlignString(oControl.InternalName, 30) _ & "[Visible: " & oControl.Visible & "]" Next For Each oControl In oPanel.SlideoutControls Print #1, " [Control]: " & AlignString(oControl.DisplayName, 30) _ & AlignString(oControl.InternalName, 30) _ & "[Visible: " & oControl.Visible & "]" Next Next End If Next Next Close #1 End Sub
Please flag the post as solved.
Thanks,
Philippe.