cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

API method to update Appearance assets from the style library (equivalent to Material.UpdateFromGlobal)

API method to update Appearance assets from the style library (equivalent to Material.UpdateFromGlobal)

The Inventor API provides Material.UpdateFromGlobal to refresh an out-of-date material definition from the active style library. However, there is no equivalent API method for Appearance (color/texture) assets or RenderStyles. The only way to refresh these from the library is through the "Update Styles" UI command, which requires manual interaction via a modal dialog.

 

This is a real problem for anyone trying to batch-update Part, Sheet Metal Part, and Assembly documents via VBA, iLogic, or .NET add-ins to keep appearances synchronized with a shared company style library. Without a direct API, the only workaround is executing the UI command and then driving the resulting dialog with SendKeys - which is fragile (depends on dialog layout and tab order, breaks across language versions and potentially between Inventor releases), cannot run unattended or in a background process, and is not a reliable approach for professional automation.

 

Feature request: Please add an API method (e.g. an UpdateFromGlobal equivalent on the Appearance/Asset object) that allows updating out-of-date appearance and render style assets from the active style library without any UI interaction, consistently across Part, Sheet Metal Part, and Assembly documents.

 

This would let companies with centrally managed style libraries keep legacy files in sync through automation, without relying on SendKeys-based workarounds.

1 Comment
WCrihfield
Mentor

Hi @MircoOppermann.  I generally agree that I would like for there to be simpler ways to check and update Assets in our model documents.  However, I am not familiar with the method you mentioned.  The Material, Appearance, & RenderStyle objects were hidden and made obsolete way back around 2013, according to the official API documentation at the following Link.

https://help.autodesk.com/view/INVNTOR/2027/ENU/?guid=GUID-2912C0FB-885F-47ED-81C3-AF19584EA9C1 

Now all those things are defined by Asset Type objects, with the MaterialAsset Type being derived from the Asset Type.  There are no special Types for appearances or physical assets anymore either.  There is actually a way to both purge and update these Assets, but it is not as simple as updating Style objects, which have the type of method built into them that you mentioned (Style.UpdateFromGlobal).  To update an Asset that is stored within a document to match one with the same type and name in the library, you have to first 'get' the library version of that Asset, then call its Asset.CopyTo method, where you specify the Document object that the original Asset was stored in, while optionally specifying whether or not you want to replace any existing Asset of the same type and same name in the destination.  Granted, there is no 'UpToDate' Property like the Style object has (Style.UpToDate), so we can only check if the Asset is currently being used (Asset.IsUsed).  If it is not ReadOnly (Asset.IsReadOnly), and it is being used, then it is a logical candidate for trying to update it, even though we do not know if it requires an update.  If it is not ReadOnly, and not being used, we can purge it (delete it).  That is how I have been doing it for years now.  But yes, I would like them to be updated with similar properties and methods like we have available to the Style objects, so we can more easily determine if any of them need to be updated, and an easier way to update them when needed.

Can't find what you're looking for? Ask the community or share your knowledge.

Submit Idea