[OpenSCAD] allowing center= parameter to be a vector of booleans
drew at DasRogges.com
Sat May 30 14:47:09 EDT 2015
On 05/03/2015 08:38 PM, Marius Kintel wrote:
> On May 3, 2015, at 20:33 PM, Drew Rogge <drew at DasRogges.com> wrote:
>> cube([10, 20, 5], center=[true, true, false]);
> Not quite resolved yet..
It looks like the pull request listed above has been idle for a year so
I'm going to go ahead and implement the feature myself. The items in the
vector are going to be anything that can be converted to a boolean.
I'm not going to implement more fine grain positioning as discussed in
Right now the centering behavior for the different primitives that
accept the center= parameter are equivalent to:
center == false center == true
cube [false, false, false] [true, true, true]
cylinder [true, true, false] [true, true, true]
square [false, false, true] [true, true, true]
surface [false, false, ???] [true, true, ???]
linear_extrude [false, false, false] [false, false, true]
For primitives that don't take a center parameter:
sphere [true, true, true] [true, true, true]
circle [true, true, true] [true, true, true]
polygon [false, false, true] [false, false, true]
polyhedron [false, false, false] [false, false, false]
Note that the 2D prims square, circle and polygon only center in Z
because the default is that they have a height of 1 if not extruded.
One question is if all primitives should be changed to take the center
parameter and to center in all three axes. For example the default for
cylinder would still be [true, true, false] but one could be able to
specify [false, false, true] if a cylinder in the ++ quadrant and
centered in Z was desired. Sphere could could also do the same thing.
I think it's more orthogonal if all primitives could be centered in all
axes. In fact their default non-centered location should be in the +++
octant. However that would break existing programs.
Prims that are specified by coordinates like surface, polygon, etc are a
bit more problematic. Since the user is specifying the actual coords of
the components does centering make sense?
So anyway, thoughts on expanding centering to all prims in all axes?
More information about the Discuss