Message 1 of 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Can anyone help me figure out why this doesn't work? It's based off of the following API example:
I get an error with this line:
oOccurrence.Appearance = localAsset
Here's the full rule:
' Get the active document. Assumes a part document is active. Dim oDoc As AssemblyDocument oDoc = ThisApplication.ActiveDocument Dim oAsmCompDef As AssemblyComponentDefinition oAsmCompDef = oDoc.ComponentDefinition oColor = Parameter("Color_List") oRun = Parameter("Component_List") Dim localAsset As Asset Try localAsset = oDoc.Assets.Item(oColor) Catch Dim assetLib As AssetLibrary assetLib = ThisApplication.AssetLibraries.Item("Autodesk Appearance Library") Dim libAsset As Asset libAsset = assetLib.AppearanceAssets.Item(oColor) ' Copy the asset locally. localAsset = libAsset.CopyTo(ThisApplication.ActiveDocument) End Try For Each oOccurrence In oAsmCompDef.Occurrences.AllReferencedOccurrences(oAsmCompDef) If oOccurrence.Name = oRun Then MessageBox.Show("Component Name: " & oOccurrence.Name _ & vbLf & "Color: " & localAsset.DisplayName , "iLogic") oOccurrence.Appearance = localAsset End If Next
And attached is an example file set, with the rule in place.
Thanks in advance!
Curtis
Solved! Go to Solution.