how to set color of single part in assembly
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Usually, in an assembly, when i want to change a part colour at the root (not the occurrence) i send my Colour multilist value to the part, then from within the part i create a rule with the following to set the appearance. ( I use custom appearance libraries), it then show in the assembly (in default representation) and shows in the part list, per item, for the buyer, but it is long and painful to do...
iProperties.PartColor = INTERIOR_COLOR_PARAM
'one of my many list for native colour of part options
Now is there an easier way of doing this? this implies that i have a code in every part... way too tedious IMO...
Maybe something like this, but that would change not the occurrence but the active appearance of the part itself :
Component.InventorComponent("PANNEAU_ARRIERE_SIMPLE").Appearance.Asset.Name = INTERIOR_COLOR_LIST
Component.InventorComponent("PANNEAU_AVANT_SIMPLE").Appearance.Asset.Name = EXTERIOR_COLOR_LIST
'and so on...
I tried this but for some reason it does not always work and it is a lot of work for a small thing like changing part color... (all required colour are in library and locally in document but again it implies that I have to save the colour locally and becomes a problem if a colour is added to the assets and multilist)
Dim oDoc As PartDocument
oDoc = Component.InventorComponent("PANNEAU_ARRIERE_SIMPLE").ReferencedDocumentDescriptor.ReferencedDocument
oDoc.ActiveAppearance = ThisApplication.AssetLibraries.Item(2).AppearanceAssets.Item(COULEUR_INTERIEUR)
I have found multiple rule out there to change all parts, but my need is part specific so i need to list then individually.