- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Good afternoon. Please look at the code below, I have highlighted something in RED that I was hoping someone could assist with. I have an assembly that I am using a multi-value set list to set basic names of paint to use. Then I have a Select case statement that states if I choose a selected basic color, then try and check to see if certain components exist, if so paint them the specific color. All works ok because my others rules that build this assembly place the components, then paints them, and then patterns the components. Where it fails, is when I just want to change the color without reconfiguring something. It will change all of the main parent elements of the pattern, but not the second, third, 4th and so on. Why not just select the entire pattern and change the color you might ask? Well, there are bolts, I dont want the bolts painted, just the main parts. So that is why I cannot just paint the entire pattern.
I also cannot just paint the main components at the part level because these are standard parts that can be any finish. I am just painting them the main 10 colors we have. We dont have a dedicated part number for the colored version of the component, so I am applying Assembly based appearance overrides at the assembly. As you can see in the image, when this is first configured, the post and panels are the correct color. But if I want to just change a color, now it only changes the parent component because i am not doing the entire pattern. Same concept if you place an part at the assembly level, color override it, then pattern it they will all be that color. But now, change the first element color to something else, all others stay as the original color. Hope this all makes sense 🙂
Dim oDoc As AssemblyDocument Dim oPattern As OccurrencePattern Dim oElements As OccurrencePatternElements Dim oElement As OccurrencePatternElement oDoc = ThisApplication.ActiveDocument oPattern = oDoc.ComponentDefinition.OccurrencePatterns.Item("whatever my pattern name is") oElements = oPattern.OccurrencePatternElements
Select Case PAINT
Case "MED. BRONZE"
Try 'try to set the component state
If Component.IsActive("RIGHT SIDE END POST") = True Then
Component.Color("RIGHT SIDE END POST") = "FNSH000510 (38/60060)"
End If
Catch 'catch error and assume the part does not exist
End Try
Try 'try to set the component state
If Component.IsActive("RIGHT SIDE END POST PATTERN") = True Then
Component.Color("RIGHT SIDE END POST PATTERN ELEMENTS excluding fasteners") = "FNSH000510 (38/60060)"
End If
Catch 'catch error and assume the part does not exist
End Try
case "SILVER"
"repeat info, just different color"
end Select
Solved! Go to Solution.