<p>OpenSCAD has <code>rotate</code> function which rotates the body around its origin axis.</p>

<p>Is there a way to specify an arbitrary axis?</p>

<p>For example, this rotates a cylinder around its center:</p>

<pre><code>rotate(a=[90,0,0]) {
  cylinder(h=10,r1=10,r2=10);
}
</code></pre>

<p>How to make it rotate around its edge?</p>

[{'answer_id': 8151, 'author': 'kintel', 'author_id': 6785, 'author_profile': 'https://3dprinting.stackexchange.com/users/6785', 'pm_score': 2, 'selected': False, 'text': '<p><code>rotate()</code> always rotates around the origin of the object following it.\nWhat you can do is to move your cylinder <em>away</em> from the origin, like this:</p>\n\n<pre><code>rotate(a=[90,0,0]) {\n  translate([0,10,0]) cylinder(h=10,r1=10,r2=10);\n}\n</code></pre>\n'}, {'answer_id': 8152, 'author': 'Cem Kalyoncu', 'author_id': 8651, 'author_profile': 'https://3dprinting.stackexchange.com/users/8651', 'pm_score': 1, 'selected': False, 'text': '<p>You can use the following module in your code to achieve what you wish:</p>\n\n<pre><code>module myrotate(a, orig) {\n    translate(orig)\n    rotate(a)\n    translate(-orig)\n    children();\n}\n\nmyrotate([0,0,90], [0, 10, 0]) {\n    cube([10, 10, 25]);\n}\n\nmyrotate([0,0,-90], [0, 10, 0]) {\n    cube([10, 10, 25]);\n}\n\ncolor([1, 0, 0])\ncube([10, 10, 25]);\n</code></pre>\n'}]
['https://3dprinting.stackexchange.com/questions/8149', 'https://3dprinting.stackexchange.com', 'https://3dprinting.stackexchange.com/users/13598/']