Code:
m_copyCodiceButtonDef = m_inventorApplication.CommandManager.ControlDefinitions.AddButtonDefinition( _
"Codice -> Clipbpard", _
"CopyCodiceIntName", _
CommandTypesEnum.kEditMaskCmdType, _
m_ThisGuidString, _
"Copy the codice to the clipboard", _
"Copy the codice to the clipboard")
AddHandler m_copyCodiceButtonDef.OnExecute, AddressOf CopyCodiceCommand
m_checkSelectButtonDef = m_inventorApplication.CommandManager.ControlDefinitions.AddButtonDefinition( _
"Check Selection", _
"CheckSelectionIntName", _
CommandTypesEnum.kEditMaskCmdType, _
m_ThisGuidString, _
"Provide info of the selection", _
"Provide info of the selection")
AddHandler m_checkSelectButtonDef.OnExecute, AddressOf CheckSelectionCommand
m_splitButtonDef = m_inventorApplication.CommandManager.ControlDefinitions.AddButtonDefinition( _
"SplitButton", _
"SplitButtonIntName", _
CommandTypesEnum.kEditMaskCmdType, _
m_ThisGuidString, _
String.Empty, _
String.Empty)
Private Sub m_UserInputEvents_OnLinearMarkingMenu(ByVal SelectedEntities As Inventor.ObjectsEnumerator, _
ByVal SelectionDevice As Inventor.SelectionDeviceEnum, _
ByVal LinearMenu As Inventor.CommandControls, _
ByVal AdditionalInfo As Inventor.NameValueMap) _
Handles m_UserInputEvents.OnLinearMarkingMenu
Dim selectedEntity As Object = SelectedEntities.Item(1)
If TypeOf selectedEntity Is Inventor.ComponentOccurrence OrElse _
TypeOf selectedEntity Is WeldmentComponentDefinition OrElse _
TypeOf selectedEntity Is AssemblyComponentDefinition OrElse _
TypeOf selectedEntity Is PartComponentDefinition Then
Dim buttonDefinitions As ObjectCollection
buttonDefinitions = m_inventorApplication.TransientObjects.CreateObjectCollection
buttonDefinitions.Add(m_copyCodiceButtonDef)
buttonDefinitions.Add(m_checkSelectButtonDef)
LinearMenu.AddSplitButton(m_splitButtonDef, buttonDefinitions, False, True)
End If
End Sub