[OpenSCAD] aligning/flooring all objects

Jordan Brown openscad at jordan.maileater.net
Thu Jul 11 17:55:49 EDT 2019


On 7/11/2019 2:01 PM, GZ wrote:
> relativity.scad library does alignments

Aligning objects a priori is not hard.  What's not possible is taking
some arbitrary object and determining its geometry after it's been
constructed.

That is:

    cylinder(h=10, d=2);
    translate([-1,-1,10]) cube(2);

will more or less reliably give you a cube atop a cylinder.  However, if
you then

    module foo() {
    	rotate([45,0,0]) {
    		cylinder(h=10, d=2);
    		translate([-1,-1,10]) cube(2);
    	}
    }

there's no way to perch something on top of the resulting foo() without
doing math.

I'm too lazy right now to do the math, but experimentation says it's at
about [ 0, -7.8, 9.2 ].  There's no way to get that value out of
OpenSCAD, or to get the foo's bounding box.

Relativity helps you to construct a model with specified alignment, but
does it at the front of the pipeline.  You can't give it an arbitrary
existing object like foo() above and expect it to be able to align
additional objects relative to it.  Relativity can only work because it
_knows_ the geometry of the objects it's putting together.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscad.org/pipermail/discuss_lists.openscad.org/attachments/20190711/45239118/attachment.html>


More information about the Discuss mailing list