@ phillip.shields
I know you were asking for another solution that SiloMan explained offline, but I'll add this iLogic just in case it helps others in the future.
( Note we just finished this up on Friday, so it might not be fully rolled out internally yet.)
' Get the active document.
Dim oDoc As AssemblyDocument
oDoc = ThisApplication.ActiveDocument
' Get the UserParameters collection
Dim userParams As UserParameters
userParams = oDoc.ComponentDefinition.Parameters.UserParameters
'[ check For Parameter And create If Not found
Try
oTest = Parameter("Color_List")
Catch
oParam = userParams.AddByValue("Color_List","Black", UnitsTypeEnum.kTextUnits)
End Try
'create color list
Dim ColorArrayList As New ArrayList
ColorArrayList.Clear
ColorArrayList.add("Black")
ColorArrayList.add("White")
ColorArrayList.add("Red")
ColorArrayList.add("Yellow")
ColorArrayList.add("Cyan")
ColorArrayList.add("Magenta")
MultiValue.List("Color_List") = ColorArrayList
']
'[ create list of runs
Dim oAsmCompDef As AssemblyComponentDefinition
oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition
Dim MyArrayList As New ArrayList
'Iterate through all of the occurrences
Dim oOccurrence As ComponentOccurrence
For Each oOccurrence In oAsmCompDef.Occurrences.AllReferencedOccurrences(oAsmCompDef)
oDef = oOccurrence.Definition.Document
Dim bIsRunDocument As Boolean
bIsRunDocument = oDef.DocumentInterests.HasInterest("Piping Run Environment")
If bIsRunDocument = True Then
MyArrayList.add( oOccurrence.Name )
End If
Next
'check For Parameter And create If Not found
Try
oTest = Parameter("Runs_List")
Catch
oParam = userParams.AddByValue("Runs_List","", UnitsTypeEnum.kTextUnits)
End Try
'] MultiValue.List("Runs_List") = MyArrayList
oColor = Color_List
oRun = Runs_List
'[ try to get the named asset / color
Dim localAsset As Asset
Try
localAsset = oDoc.Assets.Item(oColor)
Catch
Dim assetLib As AssetLibrary
assetLib = ThisApplication.AssetLibraries.Item("APPEAR")
Dim libAsset As Asset
libAsset = assetLib.AppearanceAssets.Item(oColor)
' Copy the asset locally.
localAsset = libAsset.CopyTo(ThisApplication.ActiveDocument)
End Try
']
'set the color of the run
For Each oOccurrence In oAsmCompDef.Occurrences.AllReferencedOccurrences(oAsmCompDef)
If oOccurrence.Name = oRun Then
oOccurrence.Appearance = localAsset
End If
Next
