Hi,
I'm trying to see if the material of the active model state exists in a given library.
I thought I'd be able to use the `MaterialAsset.Name` property, which for library ones is a UUID, but seems to be a simple string for, at least, `ThisDoc.Document.ActiveMaterial`.
Is it possible to access this UUID somewhere within the `Document` object?
Thanks
No clue what UUID is. But if I want to find the material in the library i use something like this:
Dim oApp As Inventor.Application = ThisApplication Dim oDoc As PartDocument = ThisDoc.Document Dim assetLib As AssetLibrary = oApp.AssetLibraries.Item("Inventor Material Library") For Each oAsset As Inventor.MaterialAsset In assetLib.MaterialAssets If oAsset.DisplayName = oDoc.ActiveMaterial.DisplayName Then MsgBox("Yay! Found it") End If Next
The only way I know to do this is to loop through the library assets looking for the string value. Can you supply the code your working with? This vba sample for appearance would do just that when asset changed for material.
I'm actually trying to get around using `.DisplayName`, because if the name changes the material would go unrecognized.
The universally unique identifier/UUID value of the `.Name` for assets in the library is a 128-bit string in the format 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' that is, for all intents and purposes, unique.
Using this instead would cause fewer false negatives in the comparison and allow for more flexibility in the logic.
Can't find what you're looking for? Ask the community or share your knowledge.