I've created a module which generates a corkscrew with varying pitch
(decreasing or increasing, depending on the parameter r): module foo(n,r,angle,total_height) { assert(r!=1,"r=1 special case not supported"); series_ratio = (1-pow(r,n))/(1-r); a = total_height/series_ratio; for (i=[0:n-1]) { total_h= a*(1-pow(r,i))/(1-r); total_angle = i*angle/n; translate([0,0,total_h]) rotate([0,0,-total_angle]) linear_extrude(height = a*pow(r,i),twist = angle/n,slices=10) children(); } } *My problem:* The height (or the width, or the size of the cross section... call it what you will) changes then the ratio of the twist and height grows). It's easier to see when taking the difference between a cylinder and the result: difference() { cylinder(h=52,r=3); foo(10,0.7,720,50) translate([3,0,0]) circle(0.4); } I've tried scaling in the z dimension by various functions, such as the inverse of pow(r,i) (which is too large). I suspect the right scaling value has to do with the pitch, which (I think?) is inversely related to the ratio of twist to height, but because it's rotating around z, I can't figure the math out and keep going in circles... -- Sent from: http://forum.openscad.org/ _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org |
Note sure what you are expecting. With F5 I see some z-fighting where the ends meet. With F6, as long as I flush the cache first, I get a manifold result. Adding render() causes it to look OK with F5. Somewhat surprising as stacking objects with irrational lengths would normally lead to problems with floating point rounding. When stacking objects one would normally want a slight overlap to avoid z fighting but with this shape it is hard to arrange because extending a section causes a slight lateral misalignment. This was with the latest snapshot and I think there have been some improvements to linear_extrude with twist since the last release. What are you seeing? On Sun, 20 Sep 2020 at 19:21, int_i <[hidden email]> wrote: I've created a module which generates a corkscrew with varying pitch _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org |
I'm seeing different widths on the lines. Hard to see unless you take the
difference from the cylinder. will try with the development snapshot later. not easy using a laptop when a bunch of random keys stop working, and not fun using the on-screen keyboard to compensate... -- Sent from: http://forum.openscad.org/ _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org |
OK I see what you mean now. The circle is always kept flat in the XY plane, so as the spirals get shorter, its profile gets more flat. I think perhaps what you want is the circle to be swept along the spiral path oriented orthogonally to the tangent. That would give a helical cylinder with a constant cross section like a spring. To do that you would need to use one of the many sweep libraries, for example my simple one here: https://github.com/nophead/NopSCADlib#Sweep. For that you need to construct a list of points to describe the path and another list of points to describe the profile, in this case a circle, which is available as a function. On Mon, 21 Sep 2020 at 21:06, int_i <[hidden email]> wrote: I'm seeing different widths on the lines. Hard to see unless you take the _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org |
thank you, I've actually come across 2 libraries and spent too much time just
reading over the functions they implemented. Looks like I now have a third one to read over. I'm always amazed by how comprehensive (and hope to make use of them beyond just sweep) -- Sent from: http://forum.openscad.org/ _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org |
Free forum by Nabble | Edit this page |