Message 1 of 7
Set Color of Sub-assembly Parts

Not applicable
04-24-2008
07:54 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
The code below works fine for setting the top level occurrence colors. What can I do to make it also set the color of parts in sub-assemblies?
Thanks in advance!
Dim oDoc As AssemblyDocument
Set oDoc = invApp.ActiveDocument
Dim oAsmCompDef As AssemblyComponentDefinition
Set oAsmCompDef = invApp.ActiveDocument.ComponentDefinition
' Get references to the two occurrences to constrain.
Dim oOcc1 As ComponentOccurrence
Set oOcc1 = oAsmCompDef.Occurrences.ItemByName(PartName)
Dim oRenderStyle As RenderStyle
Set oRenderStyle = oDoc.RenderStyles.Item(sColor)
oOcc1.SetRenderStyle kOverrideRenderStyle, oRenderStyle
Thanks in advance!
Dim oDoc As AssemblyDocument
Set oDoc = invApp.ActiveDocument
Dim oAsmCompDef As AssemblyComponentDefinition
Set oAsmCompDef = invApp.ActiveDocument.ComponentDefinition
' Get references to the two occurrences to constrain.
Dim oOcc1 As ComponentOccurrence
Set oOcc1 = oAsmCompDef.Occurrences.ItemByName(PartName)
Dim oRenderStyle As RenderStyle
Set oRenderStyle = oDoc.RenderStyles.Item(sColor)
oOcc1.SetRenderStyle kOverrideRenderStyle, oRenderStyle