& Construction

Integrated BIM tools, including Revit, AutoCAD, and Civil 3D
& Manufacturing

Professional CAD/CAM tools built on Inventor and AutoCAD
Integrated BIM tools, including Revit, AutoCAD, and Civil 3D
Professional CAD/CAM tools built on Inventor and AutoCAD
I have a multi-value list that I have created that has our standard colors in it. I have our company standard appearance library set. I just need to know how to select all components, minus fasteners and change the appearance of all the components for what my multi-value list has.
Any thoughts?
Within an assembly or how?
Regards,
Arthur Knoors
Autodesk Affiliations & Links:
Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!
! For administrative reasons, please mark a "Solution as solved" when the issue is solved !
Yea, it is from the assembly. Change all assembly occurrences. Except fasteners.
Could you share the code or the multivalue list?
Regards,
Arthur Knoors
Autodesk Affiliations & Links:
Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!
! For administrative reasons, please mark a "Solution as solved" when the issue is solved !
MultiValue.SetList("PAINT", "paint color 1", "paint color 2", etc...)
This sets the multi-value parameter in the assembly to allow users to choose what color to pain the assembly.
Are you looking for something like this?? Make sure you first type in the right asset library name in the below code and your paint colors must be contained within that library. The rule will only work for Part levels in Assembly it is not designed for sub levels. It will go through each part inside assembly which is not content center parts and change its color.
Dim oDoc As AssemblyDocument = ThisApplication.ActiveDocument Dim oDef As AssemblyComponentDefinition = oDoc.ComponentDefinition Dim oOcc As ComponentOccurrence Dim oProjectMgr As DesignProjectManager = ThisApplication.DesignProjectManager Dim LibraryPath As String = oProjectMgr.ActiveDesignProject.LibraryPaths.Item(1).Path Dim CCPath As String = oProjectMgr.ActiveDesignProject.ContentCenterPath Dim assetLib As AssetLibrary = ThisApplication.AssetLibraries.Item("Autodesk Appearance Library") 'Set which library you want to get your color from Dim oApperance As Asset = assetLib.AppearanceAssets.Item(Parameter("PAINT")) For Each oOcc In oDef.Occurrences If oOcc.DefinitionDocumentType = DocumentTypeEnum.kPartDocumentObject And oOcc.Definition.Document.FullFileName.Contains(CCPath) = False Then Dim oPdef As PartDocument = oOcc.Definition.Document oPdef.ActiveAppearance = oApperance End If Next
Hope this will be helpful.
I set the library as indicated, but I get this error.
The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG)).
Also, since we don't switch appearance Libraries, Do I still need to Specify which to choose from, even though my library is set by default in the project?
Yes please specify which library you are referring to.
Can you attach your assembly as ZIP if possible? Also, can you check the parameter name (Paint), and are you running the rule from the assembly?
I will try to see if something needs to be checked inside the assembly because I tested the rule in my assembly and it is working perfectly fine.
I have a parameter at the assembly level called "PAINT". This is being filled out by a multi-value setlist as mentioned below:
MultiValue.SetList("PAINT", "MED. BRONZE METALLIC", "STATUARY BRONZE", "CHAMPAGNE", "SANDSTONE", "POMPANO WHITE", "BIANCO", "JET BLACK", "GRAY", "ARGENTO 314 METALLIC", "ARGENTO 305 METALLIC") Dim oDoc As AssemblyDocument = ThisApplication.ActiveDocument Dim oDef As AssemblyComponentDefinition = oDoc.ComponentDefinition Dim oOcc As ComponentOccurrence Dim oProjectMgr As DesignProjectManager = ThisApplication.DesignProjectManager Dim LibraryPath As String = oProjectMgr.ActiveDesignProject.LibraryPaths.Item(1).Path Dim CCPath As String = oProjectMgr.ActiveDesignProject.ContentCenterPath Dim assetLib As AssetLibrary = ThisApplication.AssetLibraries.Item("KANE Material Library") 'Set which library you want to get your color from Dim oApperance As Asset = assetLib.AppearanceAssets.Item(Parameter("PAINT")) For Each oOcc In oDef.Occurrences If oOcc.DefinitionDocumentType = DocumentTypeEnum.kPartDocumentObject And oOcc.Definition.Document.FullFileName.Contains(CCPath) = False Then Dim oPdef As PartDocument = oOcc.Definition.Document oPdef.ActiveAppearance = oApperance End If Next
Can you upload your assembly if possible? also, can you try using the default library and a default color (i.e. Autodesk Appearance library and Color example : Yellow:)
Here is an example of scrap parts that I still get the same error with. Please see attached.
The "paint" rule sets the multi-value list and the "test" is where I am running the code you sent.
Thanks for your assistance.
Thanks for providing the files, I have found two things one is that in your project settings it is not able to find Library path (the solution is to comment that line in code as it is not required).
The second and most important thing is, the names that you are adding as multi-value in "PAINT" parameter must exactly match with appearance name, I have observed that you have written "JET BLACK" only, whereas your appearance name is "JET BLACK P/N 17108P", please change your multivalue with exact names, Try below code where I have removed the library path line and, make sure you change your multi-value text same as appearance names.
As an example, a multivalue setlist should look like this
MultiValue.SetList("PAINT","STATUARY BRONZE P/N 17106P", "JET BLACK P/N 17108P")
Updated rule,
Dim oDoc As AssemblyDocument = ThisApplication.ActiveDocument Dim oDef As AssemblyComponentDefinition = oDoc.ComponentDefinition Dim oOcc As ComponentOccurrence Dim oProjectMgr As DesignProjectManager = ThisApplication.DesignProjectManager Dim CCPath As String = oProjectMgr.ActiveDesignProject.ContentCenterPath Dim assetLib As AssetLibrary = ThisApplication.AssetLibraries.Item("KANE Material Library") 'Set which library you want to get your color from Dim oApperance As Asset = assetLib.AppearanceAssets.Item(Parameter("PAINT")) For Each oOcc In oDef.Occurrences If oOcc.DefinitionDocumentType = DocumentTypeEnum.kPartDocumentObject 'And oOcc.Definition.Document.FullFileName.Contains(CCPath) = False Then Dim oPdef As PartDocument = oOcc.Definition.Document oPdef.ActiveAppearance = oApperance End If Next
Another bonus tip here, if you don't want to type in all the names exactly as they are in appearance in your "PAINT" multi-value parameter, try the below code, it actually captures all the appearance names in the active library and add them to the "PAINT" parameter multi-value list. Add it in a separate rule and you will see that all your appearance names will be added to the PAINT multi-value parameter list.
Dim assetLib As AssetLibrary = ThisApplication.ActiveMaterialLibrary Dim Appearances As AssetsEnumerator = assetLib.AppearanceAssets Dim oList As New ArrayList For Each oAP As Asset In Appearances oList.Add(oAP.DisplayName) Next MultiValue.List("PAINT")=oList
Hope this is helpful.
I had a feeling these exact 2 point would come up. When I a pack and go of the test assembly, I may have had some items unchecked. But the actual file library is set as shown:
The other one about the names not matching is because we were looking at taking this assembly into forge, and I just wanted the customer to choose a color and not see the Part number associated with it. So, I had originally looked at a Select case that looked at the parameter "PAINT" then assigned the components an actual appearance with the correct names. So the partial name in the Multi-value set list is remnants of that. I hope that clarifies. If there is no way to go around without needing the part number with the paint, then I can add and it is no big deal.
There is a workaround that you can do here, without changing the names in the PAINT parameter. Check the below rule and see if it works. Make sure that there should not be two appearances that contain the same name (e.g. "JET BLACK P/N 17108 P" and "JET BLACK P/N 16108 P" otherwise it will select the first it will find in the appearance list.
Dim oDoc As AssemblyDocument = ThisApplication.ActiveDocument Dim oDef As AssemblyComponentDefinition = oDoc.ComponentDefinition Dim oOcc As ComponentOccurrence Dim oProjectMgr As DesignProjectManager = ThisApplication.DesignProjectManager 'Dim LibraryPath As String = oProjectMgr.ActiveDesignProject.LibraryPaths.Item(1).Path Dim CCPath As String = oProjectMgr.ActiveDesignProject.ContentCenterPath Dim assetLib As AssetLibrary = ThisApplication.AssetLibraries.Item("KANE Material Library") 'Set which library you want to get your color from Dim oAp As Asset For Each oApperance As Asset In assetLib.AppearanceAssets If oApperance.DisplayName.Contains(Parameter("PAINT")) oAp = oApperance 'Dim oApperance As Asset = assetLib.AppearanceAssets.Item(Parameter("PAINT")) End If Next For Each oOcc In oDef.Occurrences If oOcc.DefinitionDocumentType = DocumentTypeEnum.kPartDocumentObject And oOcc.Definition.Document.FullFileName.Contains(CCPath) = False Then Dim oPdef As PartDocument = oOcc.Definition.Document oPdef.ActiveAppearance = oAp End If Next
Hope this will be helpful.
What you have is working, but as you say, the assemblies will not change, only ipt's will change.
Thanks for all your efforts.
Maybe I am over simplifying this, but in my mind I had the rule the I assign out standard colors with which populates the user defined parameter with generic names.
Then my second rule would basically state:
Select Case PAINT
Case “MED. BRONZE METALLIC”
Component.Color("all current .iam’s, and parts except for content center fasteners and concrete slab with paint") = "MED. BRONZE METALLIC P/N 17109P"
Case “STATUARY BRONZE”
Component.Color("all current .iam’s, and parts except for content center fasteners and concrete slab with paint") = " STATUARY BRONZE..."
End select
Reason I need to just find the current components that exist in the assembly is because it is constantly changing. Swapping out panels, certain posts may exist and may not, etc.
I was going through trying to do a big if statement about if certain criteria is met, then basically just color override the components that exist. I figured there has to be a way to scan the assembly and just color override what is present.
thanks again.
I am not a super massive programmer, just know enough iLogic to get by.
Unfortunately, that didn't sole my issue.
How to buy
Privacy | Do not sell or share my personal information | Cookie preferences | Report noncompliance | Terms of use | Legal | © 2025 Autodesk Inc. All rights reserved
Type a product name