Hi, the ilogic code that I write to you below is activated from an assembly. The code changes the color at the part level, not assembly, maybe the lines that are found after loading the current appearances to the selection list.
I hope that part of the code can be useful
Dim oAsset As Asset
Dim oAsset_Array As New ArrayList
For Each oAsset_Array_X In ThisApplication.ActiveAppearanceLibrary.AppearanceAssets
oAsset_Array.Add(oAsset_Array_X.DisplayName)
oAsset_Array.Sort()
Next
'present the user with the list to choose from
oAsset_Array_Selected = InputListBox("CHOOSE TEXTURE FROM ABOVE LIST", oAsset_Array, oAsset_Array.Item(0), "TEXTURE SELECTION", "LIST OF TEXTURES")
If oAsset_Array_Selected = "" Then Exit Sub
Dim comps As ObjectCollection
Dim comp As Object
comps = ThisApplication.TransientObjects.CreateObjectCollection
While True
comp = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kAssemblyLeafOccurrenceFilter, "Select a component")
' If nothing gets selected then we're done
If IsNothing(comp) Then Exit While
comps.Add(comp)
End While
' If there are selected components we can do something
For Each comp In comps
Dim oDef As PartDocument
oDef = comp.Definition.Document
Dim oRenderStyle As RenderStyle
oRenderStyle = oDef.RenderStyles.Item(oAsset_Array_Selected)
oDef.ActiveRenderStyle = oRenderStyle
iLogicVb.UpdateWhenDone = True
Next
Please accept as solution and give likes if applicable.
I am attaching my Upwork profile for specific queries.
Sergio Daniel Suarez
Mechanical Designer
| Upwork Profile | LinkedIn