On 22. mars 2016 18:51, Carsten Arnholm wrote:
On 22. mars 2016 13:49, Parkinbot wrote:
From the other side, also rotate_extrude() could be enriched to allow
for a
height argument (definition of screws) or a given height path (scews with
nonlinear slopes).
Perhaps, in rotate_extrude, a pitch parameter combined with an ability
to specify many revolutions in the angle parameter would be enough to
define threads.
As an experiment, I have tried this approach in my latest implementation
of rotate_extrude in Angelscript CSG. It might provide some inspiration
for OpenSCAD:
http://arnholm.org/software/as_csg/ISO_thread1.png
http://arnholm.org/software/as_csg/ISO_thread2.png
The complete source code generating the above is
http://arnholm.org/software/as_csg/ISO_thread.as
(Note this is based on an experimental version)
All 3d booleans are performed using carve (0.25 sec). Tesselation for
STL also done with carve.
To view the result in 3d using OpenSCAD:
http://arnholm.org/software/as_csg/ISO_thread.csg
In general the approach taken is to iteratively transform the 2d profile
into its proper 3d location and use the transformed profile to build the
3d mesh geometry and topology.
Carsten Arnholm
nice! If you have access to the points everything is possible.
I imagine a syntax similiar to linear_extrude()
rotate_extrude(angle, height, scale)
The problem is of course how to manage self intersection. So with respect to
implementation it might be easyier to restrict the angle to the range of
-360:360 degrees, while height is your pitch offset. If you want more
windings you can define this with your 2D-shape. Have a look at my quickly
done pure OpenSCAD implementation (lib stuff should be clear from previous
posts).
use
<shortcuts.scad>
// translate -> Tx, ...
use
<skin.scad>
// skin()
use
<naca_sweep.scad>
// define affine ops Tx_ ...
Tx(30) rotate_extrude() Toothbar();
T(10, -30) Toothbar();
linear_extrude3(angle = 600, height = PI); // full screw
Tx(-20)linear_extrude3(angle = -180, height = PI); // half screw
module linear_extrude3(angle = 360, height = 0)
skin(gen_dat(height, angle)); // we cheat here
module Toothbar(z= 10)
Tx(5) Rz(90) Tx(-(PI/2)+tan(20)) polygon(points = TB(z));
function TB(n=2) =
concat([[0, 2]], [for (i=[0:n-1], j=[0:3])
let(t = [ [0, 1], [2tan(20), -1], [PI/2, -1], [2tan(20)+PI/2, 1]])
[t[j][0]+iPI, t[j][1]]], [[2tan(20)+PI/2+(n-1)*PI, 2]]);
function gen_dat(height = 0, angle = 360, steps = 100) =
let(ang = angle%360)
let(bar = R_(180, -90, 0, Ty_(-5, vec3D(TB(10)))))
[for (i=[0:steps]) Tz_(iheight/steps, Rz_(iang/steps, bar))];
--
View this message in context: http://forum.openscad.org/Non-Linear-Transformations-tp14539p16695.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
On 23. mars 2016 23:21, Parkinbot wrote:
The problem is of course how to manage self intersection.
I found it can work to make the single thread 2d profile a tiny bit
narrower than the pitch. The effect is that there is no self
intersection, but instead a continuous near miss. The gap is later
filled by the internal cylinder that is unioned with the spiraling
thread body, to make a threaded rod.
So with respect to
implementation it might be easyier to restrict the angle to the range of
-360:360 degrees, while height is your pitch offset. If you want more
windings you can define this with your 2D-shape.
Perhaps easier to implement, but maybe also somewhat harder to use? I
tried a few cases and managed 69 windings before things started to
become unstable. That's 69*360 degrees... admittedly it also depends on
mesh resolution how far you can go.
Carsten Arnholm
cacb wrote
I found it can work to make the single thread 2d profile a tiny bit
narrower than the pitch. The effect is that there is no self
intersection, but instead a continuous near miss. The gap is later
filled by the internal cylinder that is unioned with the spiraling
thread body, to make a threaded rod.
To be honest, to me this looks more like a hack, and not like a general
solution. Why should things get unstable with increasing windings? Memory?
When I tried a 1000 'windings' CSG rendering was done in 58s.
I hope to see this or a similar solution in OpenSCAD soon, as it is really
easy to update. Maybe I should write a feature request ...
--
View this message in context: http://forum.openscad.org/Non-Linear-Transformations-tp14539p16701.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
On 24. mars 2016 01:40, Parkinbot wrote:
cacb wrote
I found it can work to make the single thread 2d profile a tiny bit
narrower than the pitch. The effect is that there is no self
intersection, but instead a continuous near miss. The gap is later
filled by the internal cylinder that is unioned with the spiraling
thread body, to make a threaded rod.
To be honest, to me this looks more like a hack, and not like a general
solution.
I am not too worried about labels when things actually work in practice,
like in this case.
Why should things get unstable with increasing windings? Memory?
When I tried a 1000 'windings' CSG rendering was done in 58s.
If you take fixed precision integer coordinates and multiply with ever
larger factors (that is what happens when you increase the number of
windings to large numbers), you will eventually have numerical issues
since the relative tolerances are not that big. My approach was a little
simplistic since it was an experiment, but it actually worked better
than I had thought. On the timing, it was done in about .2 seconds in my
case, much less than it took to write the output files.
I hope to see this or a similar solution in OpenSCAD soon, as it is really
easy to update. Maybe I should write a feature request ...
Threads are much used, so probably, yes.
Carsten Arnholm