Inventor 2019.1 introduced a new feature for highlighting new commands.
This feature can also be used to highlight custom commands using the Inventor API.
Below is a code snippet that explains the new API’s that have been added for this feature.
public void Activate(Inventor.ApplicationAddInSite addInSiteObject, bool firstTime)
{
m_inventorApplication = addInSiteObject.Application;
ControlDefinitions controlDefs = m_inventorApplication.CommandManager.ControlDefinitions;
stdole.IPictureDisp img = PictureConverter.ImageToPictureDisp(Resources.bmp_img);
m_buttonDef = controlDefs.AddButtonDefinition("", "UIRibbonSampleApp",
CommandTypesEnum.kNonShapeEditCmdType, m_clientID,null,null, img, img);
// API for fetching all available comparison versions
string[] allversions = m_inventorApplication.AvailableComparisonVersions;// API for setting the version against which the command will be compared against.
// Value from m_inventorApplication.AvailableComparisonVersions can be used for this.
m_inventorApplication.ComparisonVersion = "2018.1"; // as shown in above image
// Version at which this command was introduced.
// Value from m_inventorApplication.AvailableComparisonVersions can be used for this.
m_buttonDef.IntroducedInVersion = "2019";
// Version which this command was last updated.
// Value from m_inventorApplication.AvailableComparisonVersions can be used for this.
m_buttonDef.LastUpdatedVersion = "2019";m_buttonDef.ToolTipText = "This is a sample application for testing the Highlight Feature";
m_buttonDef.ProgressiveToolTip.Title = "Highlight Feature";
m_buttonDef.ProgressiveToolTip.Description = "This is a sample application for testing the Highlight Feature";
m_buttonDef.ProgressiveToolTip.ExpandedDescription = "This is the expanded description of the ToolTip";m_buttonDef.OnExecute += M_buttonDef_OnExecute;
UserInterfaceManager UIManager = m_inventorApplication.UserInterfaceManager;
if (firstTime)
{
CreateUserInterface();
}
//refreshes the ribbon controls display when the comparison is set.
// The ribbon control will not display highlight badge, until RefreshRibbonForComparison is called
m_inventorApplication.RefreshRibbonForComparison();
}
In the above code, both the IntroducedInVersion and LastUpdatedVersion properties are set to the latest, which means that this command is new and has not been available on previous versions of Inventor.
In this case, the highlight badge would be displayed as ‘NEW’.
In the above code, if you change the IntroducedInVersion property to an earlier version, it would mean that an existing command has been updated.
In this case, the highlight badge would be displayed as ‘UPDATED’