# Generating cylindical shape using linear_extrude or other command

13 messages
Open this post in threaded view
|

## Generating cylindical shape using linear_extrude or other command

 Greetings to the list. I am attempting to create a helical looped form from a cylinder using linear_extrude. Though it appears semi-cylindrical in a  perspective orthogonal view, in a side view the cylinder appears flat. Is their any way to fill out this twisted circle? I realize linear_extrude says it should not be used to generate helical windings. Is there another module or command I should be using? All help is appreciated. _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org The more I learn, the more I get curious about.
Open this post in threaded view
|

## Re: Generating cylindical shape using linear_extrude or other command

 I'm not sure exactly what you're trying to describe, but I fished around my archive and found this that might help inspire you STEP=2; // fine in most cases TUBE = 2; // radius of tube SIDES=4; // number of sides in the profile 3 to 16 (unless printed very large 16 should be plenty for printing) r=2;   // torus minor radius R=4; // torus major radius P=2;  // inner term Q=3; // outer term // don't just set \$fn as SIDES is used elsewhere \$fn=SIDES; // use to select number of faces in the path profile // calculates position in path a=angle function knot(a) =     let( t = [ r*sin(Q*a), r*cos(Q*a) - R, r*sin(Q*a) ] ) // section parametrization     [ [ cos(P*a), -sin(P*a), 0],       [ sin(P*a),  cos(P*a), 0],  // rotation in z of p*a degrees       [0,0,1] ] * t; // from wiki // Find the unitary vector with direction v. Fails if v=[0,0,0]. function unit(v) = norm(v)>0 ? v/norm(v) : undef; // Find the transpose of a rectangular matrix function transpose(m) = // m is any rectangular matrix of objects   [ for(j=[0:len(m[0])-1]) [ for(i=[0:len(m)-1]) m[i][j] ] ]; // The identity matrix with dimension n function identity(n) = [for(i=[0:n-1]) [for(j=[0:n-1]) i==j ? 1 : 0] ]; // computes the rotation with minimum angle that brings a to b // the code fails if a and b are opposed to each other function rotate_from_to(a,b) =     let( axis = unit(cross(a,b)) )     axis*axis >= 0.99 ?         transpose([unit(b), axis, cross(axis, unit(b))]) *             [unit(a), axis, cross(axis, unit(a))] :         identity(3); for (a=[0:STEP:360-STEP]) {   v = knot(a) - knot(a+STEP);   v2 = knot(a+STEP) - knot(a+STEP+STEP);   hull() {     translate(knot(a))       multmatrix(rotate_from_to([0,0,1],v))         rotate(a*(1+(2.0/SIDES)))  // fudge           //cylinder(r=TUBE,h=0.001,center=true);         cube([TUBE,TUBE/8,0.001],center=true);     translate(knot(a+STEP))       multmatrix(rotate_from_to([0,0,1],v2))         rotate(((a+STEP)*(1+(2.0/SIDES)))) // fudge           //cylinder(r=TUBE,h=0.001,center=true);         cube([TUBE,TUBE/8,0.001],center=true);       } } On 09/12/17 01:10, John Sprockets wrote: Greetings to the list. I am attempting to create a helical looped form from a cylinder using linear_extrude. Though it appears semi-cylindrical in a  perspective orthogonal view, in a side view the cylinder appears flat. Is their any way to fill out this twisted circle? I realize linear_extrude says it should not be used to generate helical windings. Is there another module or command I should be using? All help is appreciated. ```_______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org ``` _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Open this post in threaded view
|

## Re: Generating cylindical shape using linear_extrude or other command

 In reply to this post by Still_learning On 2017-12-09 02:10, John Sprockets wrote: > Greetings to the list. > > I am attempting to create a helical looped form from a cylinder using > linear_extrude. You mean extruding along a helical path? You cannot do that with linear extrude. That would be a sweep operation, which isn't a core feature in OpenSCAD. People have made sweep functionality as .scad scripts though, so perhaps you could use it (I don't have a reference). Carsten Arnholm _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Open this post in threaded view
|

## Re: Generating cylindical shape using linear_extrude or other command

Open this post in threaded view
|

## Re: Generating cylindical shape using linear_extrude or other command

 In reply to this post by cacb Pardon my ignorance of geometry, but could somebody explain why the obvious use of linear_extrude *isn't* a helix? Is the problem that if you want some particular vertical cross-section of the object to have a particular shape you have to generate the horizontal cross-section, and that's hard?  (e.g. to generate a circular cross-section you'd need something sort of kidney-bean shaped) _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Open this post in threaded view
|

## Re: Generating cylindical shape using linear_extrude or other command

 I’m unclear if this is quite what the original poster wants, but the BOSL library has, as part of its BOSL/paths.scad library, a module to sweep a polyline (array of 2D points) perpendicularly along a helical path:    extrude_2dpath_along_spiral(polyline, h, r, twist=360);It makes a polygon directly, though it won’t deal with self intersection.`// Takes a closed 2D polyline path, centered on the XY plane, and// extrudes it along a 3D spiral path of a given radius, height and twist.// polyline = Array of points of a polyline path, to be extruded.// h = height of the spiral to extrude along.// r = radius of the spiral to extrude along.// twist = number of degrees of rotation to spiral up along height.// Example:// poly = [[-10,0], [-3,-5], [3,-5], [10,0], [0,-30]];// extrude_2dpath_along_spiral(poly, h=200, r=50, twist=1000, \$fn=36);`You can find BOSL at: -RevarOn Dec 9, 2017, at 3:43 PM, Jordan Brown <[hidden email]> wrote: Pardon my ignorance of geometry, but could somebody explain why the obvious use of linear_extrude *isn't* a helix? Is the problem that if you want some particular vertical cross-section of the object to have a particular shape you have to generate the horizontal cross-section, and that's hard?  (e.g. to generate a circular cross-section you'd need something sort of kidney-bean shaped) _______________________________________________OpenSCAD mailing list[hidden email]http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org_______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Open this post in threaded view
|

## Re: Generating cylindical shape using linear_extrude or other command

 In reply to this post by JordanBrown The twisted linear_extrude follows a helicoidal path indeed but its sweep is done by translating the initial 2D shape without rotations. So the orthogonal section of the result is not the linear_extrude shape. And yes, If you deform appropriately the 2D shape to be extruded you may get the expected result. difference(){  linear_extrude(height=10,twist=720,\$fn=24)     translate([-5,0,0])       circle(3);  cube(20);}​2017-12-09 21:43 GMT-02:00 Jordan Brown : Pardon my ignorance of geometry, but could somebody explain why the obvious use of linear_extrude *isn't* a helix? Is the problem that if you want some particular vertical cross-section of the object to have a particular shape you have to generate the horizontal cross-section, and that's hard?  (e.g. to generate a circular cross-section you'd need something sort of kidney-bean shaped) _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Open this post in threaded view
|

## Re: Generating cylindical shape using linear_extrude or other command

 You might be interesed in the helical coil implementation using linear_extrude that I came up with a while ago:Explanation of how it works is in the description, with a graphic showing the steps.HansOn Sat, Dec 9, 2017 at 7:33 PM, Ronaldo Persiano wrote:The twisted linear_extrude follows a helicoidal path indeed but its sweep is done by translating the initial 2D shape without rotations. So the orthogonal section of the result is not the linear_extrude shape. And yes, If you deform appropriately the 2D shape to be extruded you may get the expected result. difference(){  linear_extrude(height=10,twist=720,\$fn=24)     translate([-5,0,0])       circle(3);  cube(20);}​2017-12-09 21:43 GMT-02:00 Jordan Brown : Pardon my ignorance of geometry, but could somebody explain why the obvious use of linear_extrude *isn't* a helix? Is the problem that if you want some particular vertical cross-section of the object to have a particular shape you have to generate the horizontal cross-section, and that's hard?  (e.g. to generate a circular cross-section you'd need something sort of kidney-bean shaped) _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Open this post in threaded view
|

## Re: Generating cylindical shape using linear_extrude or other command

 In reply to this post by RevarBat I’m unclear if this is quite what the original poster wants The easiest way to describe what I want to achieve would be comparable to taking a dowel and wrapping a length of round wire around it.  The wire remains round and bent into a helical configuration. The wire is the cylinder (circle with defined radius). The overall length of the helix is the "height" The number of revolutions is governed by "twist" Sorry for the delay in getting back to the list. ----- The more I learn, the more I get curious about. -- Sent from: http://forum.openscad.org/_______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org The more I learn, the more I get curious about.
Open this post in threaded view
|

## Re: Generating cylindical shape using linear_extrude or other command

Open this post in threaded view
|

## Re: Generating cylindical shape using linear_extrude or other command

 Thanks for the referral on "extrude_2d_path..." I will check it out. ----- The more I learn, the more I get curious about. -- Sent from: http://forum.openscad.org/_______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org The more I learn, the more I get curious about.