Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
meGVGMF
in reply to: meGVGMF

Here's what I found:

 

Comparison with library:

For materials within each model state: `oDoc.ComponentDefinition.ModelStates`, `.Activate` each and get `mat = oDoc.ActiveMaterial`

For selecting the library to compare against: `library = ThisApplication.AssetLibraries(libraryName)` and instead of trying to find the origin, just `try`ing to change with `library(mat.DisplayName)` and defaulting to something else if not found.

 

Purging unused:

For locally stored materials: `ThisDoc.Document.MaterialAssets` and `.Delete` each where `Not` `.IsUsed` (this only keeps the currently active model state's material, but the others are added back on each activation respectively)