Hi @muaslam
I don't know about the C#-template. I don't have it installed so maybe you're right that there are no instructions in that one. The Visual Basic template however has comments instructing you how to create a button. Maybe you can translate it if you want to use C#.
Also, event though the Nifty Addin Template uses the 2018 interop it still works for later versions. You can change this reference aswell if you want to. That is in Visual Basic as well though.
What you need to do:
Declare the ButtonDefinition in your StandardAddinServer Class:
Private WithEvents m_sampleButton As ButtonDefinition
In your Activate class, create the button definition and call AddToUserInterface if first time:
' Sample to illustrate creating a button definition.
Dim largeIcon As stdole.IPictureDisp = PictureDispConverter.ToIPictureDisp(My.Resources.YourBigImage)
Dim smallIcon As stdole.IPictureDisp = PictureDispConverter.ToIPictureDisp(My.Resources.YourSmallImage)
Dim controlDefs As Inventor.ControlDefinitions = g_inventorApplication.CommandManager.ControlDefinitions
m_sampleButton = controlDefs.AddButtonDefinition("Command Name", "Internal Name", CommandTypesEnum.kShapeEditCmdType, AddInClientID)
' Add to the user interface, if it's the first time.
If firstTime Then
AddToUserInterface()
End If
Then your AddToUserInterface can look something like this to add the button:
Private Sub AddToUserInterface()
'This Is where you'll add code to add buttons to the ribbon.
'** Sample to illustrate creating a button on a New panel of the Tools tab of the Part ribbon.
' Get the part ribbon.
Dim partRibbon As Ribbon = g_inventorApplication.UserInterfaceManager.Ribbons.Item("Part")
' Get the "Tools" tab.
Dim toolsTab As RibbonTab = partRibbon.RibbonTabs.Item("id_TabTools")
' Create a new panel.
Dim customPanel As RibbonPanel = toolsTab.RibbonPanels.Add("Sample", "MysSample", AddInClientID)
' Add a button.
customPanel.CommandControls.AddButton(m_sampleButton)
End Sub