- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I am trying to change the material and appearance (color) of all parts inside my assembly, so they all have the same color and it looks tidy.
Right now i am trying to check all referenced part documents and change their material/appearance. It seems like the material part is working, but im not sure how to adjust the appearance/color. I'm accessing the appearance the wrong way, i tried looking in the API object model but haven't managed to find it.
Dim oDoc As AssemblyDocument = ThisDoc.Document
Dim pDoc As Document
Dim oMaterialName As String = "Generic"
Dim oAppearanceName As String = "Default"
Dim oMaterial As Material = oDoc.Materials.item(oMaterialName)
Dim oRenderStyle As RenderStyle = oDoc.RenderStyles.Item(oAppearanceName)
For Each pDoc In oDoc.AllReferencedDocuments
If pDoc.DocumentType = kPartDocumentObject
Dim oPartDoc As PartDocument = pDoc
oPartDoc.ComponentDefinition.Material = oMaterial
oPartDoc.ComponentDefinition.ActiveRenderStyles = oRenderStyle
End If
Next
Maybe i can do something with the Assets? API object models sais this has to do with the appearance and color, but i'm also not sure how to use this any further;
Dim oAsset As Asset = oDoc.Assets 'not sure how to complete the code here
Any tips how i can get all parts in my document the same color and material? Thanks
Solved! Go to Solution.