relativity.scad icon indicating copy to clipboard operation
relativity.scad copied to clipboard

align() 'steps on' color() calls beneath it

Open ipmcc opened this issue 8 months ago • 0 comments

It appears that 'color()' directives underneath an align() directive are ignored. I rely on colors to understand the resulting picture, so this is a rather serious hindrance for me. I am new to OpenSCAD, so I don't know that digging in to solve this myself is probably not a good approach.

I've tried to use colored() but the output results appear to be the same. The stumper is that the demo with the sphere and rods works. I've been trying to make slow, incremental changes to the demo, but once I get my two boxes involved, something goes wonky.

Oh yeah, and every time I use colored, I get a lot of these warnings: Screen Shot 2024-06-14 at 8 14 42 AM

Here are some examples:


No call to align(), both colors show up:

{ // Both colors shown
    color([ 1, 0, 0, 0.3 ])
        box([ housing_botton_length, housing_bottom_width, servo_body_height ], anchor = [ -1, -1, -1 ]);
    color([ 0, 0, 1, 1 ])
        box([ housing_cutout_length, housing_cutout_width, housing_cutout_height ], anchor = [ 1, 1, -1 ]);
} // Both colors shown

Output: Screen Shot 2024-06-14 at 7 47 09 AM


Call to color() above align() call, both boxes are the same (top) color:

{ // Both boxes red
    color([ 1, 0, 0, 0.3 ])
        box([ housing_botton_length, housing_bottom_width, servo_body_height ], anchor = [ 1, 1, -1 ])
            color([ 0, 0, 1, 1 ])
                align([ 0, 0, 1 ])
                    box([ housing_cutout_length, housing_cutout_width, housing_cutout_height ], anchor = [ 1, 1, -1 ]);
} // Both boxes red

Output: Screen Shot 2024-06-14 at 7 49 28 AM

Call to color() below align() call, both boxes are the same (top) color:

{ // Both boxes red
    color([ 1, 0, 0, 0.3 ])
        box([ housing_botton_length, housing_bottom_width, servo_body_height ], anchor = [ 1, 1, -1 ])
            align([ 0, 0, 1 ])
                 color([ 0, 0, 1, 1 ])
                     box([ housing_cutout_length, housing_cutout_width, housing_cutout_height ], anchor = [ 1, 1, -1 ]);
} // Both boxes red

Output: Screen Shot 2024-06-14 at 7 50 52 AM

I don't know enough about relativity.scad to know if this is my fault somehow, or not, but it's making things rather tough to suss out. If it's my fault, and anyone knows what's going on here I'd appreciate the help. Thanks!

ipmcc avatar Jun 14 '24 11:06 ipmcc