Highlight New Feature for Custom Commands

By Sajith Subramanian

Inventor 2019.1 introduced a new feature for highlighting new commands.

image

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.

<p>public void Activate(Inventor.ApplicationAddInSite addInSiteObject, bool firstTime)<br>   {<br>      m_inventorApplication = addInSiteObject.Application;<br>            <br>      ControlDefinitions controlDefs = m_inventorApplication.CommandManager.ControlDefinitions;<br>      stdole.IPictureDisp img = PictureConverter.ImageToPictureDisp(Resources.bmp_img);<br>      m_buttonDef = controlDefs.AddButtonDefinition("", "UIRibbonSampleApp",<br>      CommandTypesEnum.kNonShapeEditCmdType, m_clientID,null,null, img, img);<br>            <br>      // API for fetching all available comparison versions<br>      <strong>string[] allversions = m_inventorApplication.AvailableComparisonVersions;</strong></p>
<p>      // API for setting the version against which the command will be compared against.<br>      // Value from m_inventorApplication.AvailableComparisonVersions can be used for this.<br>    <strong>  m_inventorApplication.ComparisonVersion = "2018.1"; </strong>// as shown in above image<br>     </p><p>      // Version at which this command was introduced.<br>      // Value from m_inventorApplication.AvailableComparisonVersions can be used for this.<br>   <strong>    m_buttonDef.IntroducedInVersion = "2019";<br>   </strong>        <br>     // Version which this command was last updated.<br>     // Value from m_inventorApplication.AvailableComparisonVersions can be used for this.<br>   <strong>   m_buttonDef.LastUpdatedVersion = "2019";</strong></p>
<p>     m_buttonDef.ToolTipText = "This is a sample application for testing the Highlight Feature";<br>     m_buttonDef.ProgressiveToolTip.Title = "Highlight Feature";<br>     m_buttonDef.ProgressiveToolTip.Description = "This is a sample application for testing the Highlight Feature";<br>     m_buttonDef.ProgressiveToolTip.ExpandedDescription = "This is the expanded description of the ToolTip";
</p><p>       m_buttonDef.OnExecute += M_buttonDef_OnExecute;<br>       UserInterfaceManager UIManager = m_inventorApplication.UserInterfaceManager;<br>   </p><p>     if (firstTime)<br>       {<br>        CreateUserInterface();<br>       }<br>    //refreshes the ribbon controls display when the comparison is set. <br>  // The ribbon control will not display highlight badge, until RefreshRibbonForComparison is called<br>           <strong> m_inventorApplication.RefreshRibbonForComparison();</strong><br>   }</p>

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.

image

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.

image

In this case, the highlight badge would be displayed as ‘UPDATED’


Comments

2 responses to “Highlight New Feature for Custom Commands”

  1. Is there a way to add comparison versions? It would be nice to use these highlights for our own internal API updates.

  2. Nice Post! thanks for the share in manufacturing.

Leave a Reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading