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

Hi @Anonymous 

The error is coming from the fact that Dark Green is not a local asset.... so if this is a template you can just add Dark Green to the part file manually as shown below, and then save the template.

 

Or if you're looking to make this rule more universal you'd need to use something similar to the longer version posted yesterday, which gets Dark Green from the Appearance Library and loads it locally. I've added that part of the code to your rule in the example below.

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

 

Local Asset.PNG

 

 

'set this rule to watch this parameter
oTrigger = Green

Dim oDoc As PartDocument 
oDoc = ThisApplication.ActiveDocument

'get color name to use
Dim oColor As String
oColor = "Dark Green"

Dim oAssetLib As AssetLibrary
oAssetLib = ThisApplication.AssetLibraries.Item("Autodesk Appearance Library")

' Get an asset in the library
Dim oLibAsset As Asset
oLibAsset = oAssetLib.AppearanceAssets.Item(oColor)


Dim oLocalAsset As Asset
Try 'Copy the asset locally.
	oLocalAsset = oLibAsset.CopyTo(oDoc)
Catch 'or just use it if it's already local
	oLocalAsset = oDoc.Assets.Item(oColor)
End Try


Dim oEntities As Object 
oEntities = iLogicVb.Automation.GetNamedEntities(oDoc)

'get the named face
Dim oFace As Face 
oFace = oEntities.FindEntity("GreenFace")

'set the color if paramter is true
If Parameter("Green") = True Then
	oFace.Appearance = oDoc.Assets.Item(oColor)
Else
	oFace.Appearance = oDoc.ActiveAppearance
End If