[OpenSCAD] allowing center= parameter to be a vector of booleans

Drew Rogge drew at DasRogges.com
Sun May 3 20:33:53 EDT 2015

I often find that I want a cube to be centered about the z axis but sitting on the z = 0 xy plane. What do people think of allowing the center= parameter of 2D and 3D primitives to be a vector of booleans. That way one could center a primitive on whatever axes are desired instead of all or nothing. In my cube example I could use:

cube([10, 20, 5], center=[true, true, false]);

instead of translate([-5, -10, 0]) cube([10, 20, 5]); or translate([0, 0, 2.5]) cube([10, 20, 5]);

Although not clean it would also be handy if booleans could also be represented by zero/non-zero numeric values instead of the verbose "true" and "false".

I'm open to other ways of doing the above if anyone has any suggestions.


More information about the Discuss mailing list