losing track of colors below Part level #1207
-
|
I know that build123d only allows a single color per Part, which I think is reasonable. I'm fiddling with some relatively complex code that builds up Part objects in several nested Python layers. I'm OK with extruding individual Part objects out of the lower level Faces (which get their colors in the lower-level logic), but I'm struggling to get build123d to do the color bookkeeping for me. I've tried a lot of variations of Faces added to BuildSketch, sketches wrapped in Compounds, etc. No matter what I've tried, I can't find the color attributes anywhere when I get to the top. The only way I have found to do this is to keep track of the colored Faces on the side, manually adjusting locations as things are aggregated into other things. I then use that on-the-side bookkeeping to extrude the Faces into Parts. That all works fine, but it obviously sort of ignores all the other work that build123d is doing for me for nested objects. Is what I'm looking for not there, or have I just not been clever enough to figure it out? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 6 replies
-
|
Color needs to be applied to the individual shapes and doesn't get propagated during any CAD operations. So if you assign a color to a Face and then extrude it into a Solid it won't have a color - at least not currently. The expectation is that once the part is created a color will be assigned to it. Are you trying to build assemblies of parts and finding that the colors are lost? |
Beta Was this translation helpful? Give feedback.

I think I get what you're saying ... if the low-level code could create the Parts and color them and then the higher levels in the software stack keeps track of Parts instead of Sketches, then the colors would travel along with those Parts. That might work (for my use case). I guess the aggregation thing in that case would be Compounds. Let me push that around a little bit in my code.
Thanks!