[OpenSCAD] Rotate about user defined axis ?

Matt Maggio mattmaggio19 at gmail.com
Wed Oct 30 17:38:57 EDT 2019


I could be wrong about any/all of this, but if you want to rotate around a
non origin axis, I would stay you should translate the object away from the
origin and then rotate as normal. The effect this has is equal to what you
want and gives you complete control. With 6 degrees of freedom (trans x y
z, rot xy,yz, zx) you should be able to accomplish any possible 3D affine
transformation.

Now using this strategy to make good designs can be tricky, and depending
on exactly what you want might be the wrong approach. Say you want a bolt
hole pattern, but you need the holes to be square (if they were cylindrical
the rotation wouldn't matter)  then you would need to rotate them around an
axis outside of their shape. wrap this in a for loop to make say 10 holes a
fixed radius from the origin.

  radius =5;
for(i=[0:10]){
    rotate([0,0,i*(360/10)]){
        translate([radius, 0,0]){
            cube([1,1,1]);
            }}}

As an experiment, what happens if you switch the rotate and translate
statements order? Then they evaluate in the opposite way and you should be
left with a star shape.


On Wed, Oct 30, 2019 at 3:38 PM Robin2 <robin at nbleopard.com> wrote:

> This simple piece of code rotates the cube about what I will call its
> left-hand end.
>
> rotate(45, [0, 1, 0]) {
>     cube( [20,5,1]);
> }
>
> I can't figure whether there is a way to get it to rotate about (for
> example) its right-hand end?
>
> ...R
>
>
>
>
>
> --
> Sent from: http://forum.openscad.org/
>
> _______________________________________________
> OpenSCAD mailing list
> Discuss at lists.openscad.org
> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
>


-- 
Matt Maggio
Senior Research Technologist
Resuscitation Institute (Rm. 1.380)
Department of Medicine
Rosalind Franklin University of Medicine and Science
3333, Green Bay Rd, North Chicago, IL - 60064.
Office: 224-570-7954
Cell: 815-703-2879
"Take chances, make mistakes, and get messy!!" - Mrs. Frizzle, PhD
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscad.org/pipermail/discuss_lists.openscad.org/attachments/20191030/fb296f5a/attachment.html>


More information about the Discuss mailing list