[OpenSCAD] rotating an object around its center....

Bruno Boettcher bboett at gmail.com
Fri Jul 19 10:15:42 EDT 2019


hello!

maybe i am too tired to understand it, i have a prism, i rotate into place,
thus doing it around the 0,0,0 and then i rotate it around its axe (by
transferring it to the center, and back...)
this would work, if later on i hadn't the need to translate the whole
thing....

i made this :

module prism(l, w, h){
  polyhedron(
      points=[[0,0,0], [l,0,0], [l,w,0], [0,w,0], [0,w,h], [l,w,h]],
      faces=[[0,1,2,3],[5,4,3,2],[0,4,5,1],[0,3,4],[5,2,1]]
      );
}
translate([0,0,8]) //translate back
  {
    translate([0,0,-8])//translate to center
      rotate([5,0,0])//give it the recquired angle
      {
            rotate([180,-90,0])
            translate([1.6,-3.15,0])
            prism(16,3,40);
      }
  }

this reads stupid and cumbersome, i am sure there is a much more elegant
way to make this?

-- 
ciao
Bruno

===========================================
http://nohkumado.eu/, <http://bboett.free.fr>http://aikido.nohkumado.eu/,
<http://bboett.free.fr>
http://aikido.zorn.free.fr
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscad.org/pipermail/discuss_lists.openscad.org/attachments/20190719/c25cfa95/attachment.html>


More information about the Discuss mailing list