# how to make the groove more width?

15 messages
Open this post in threaded view
|

## how to make the groove more width?

 This post has NOT been accepted by the mailing list yet. I want make groove on the surface of a cylinder. I use twist, but the groove is narrow. module slot(unichar, groove){ difference(){     cylinder(h,r=OR,center=true); if(groove){         for(g=[[OR,0,0],[0,OR,0],[-OR,0,0],[0,-OR,0]])         linear_extrude(height=h, center=true, convexity=1, twist=720)translate(g)circle(r = 0.5);         }     } }
Open this post in threaded view
|

## Re: how to make the groove more width?

 This post was updated on . I guess you want the groove to keep its shape independently of the twist angle. This is not so easy to do, because you need a proper helix object for difference. There is some threading code out there (e.g. Thingiverse) to do this. With some limitation it can also be created by linear_extrude(), but it needs an ellipse that exactly compensates the angle introduced by the twist. The following code introduces an operator doing this and rewrites your code partly for proper application \$fn= 30; h = 60; OR = 12; r = .5; g = OR; tw = 720;  // use negative value for CCW N=4; slot(); module slot(groove = true){   difference()   {     cylinder(h,r=OR,center=true);     if(groove){       for(w=[0:N-1])         linear_extrude(height=h+.1, center=true, convexity=2, twist=tw)         rotate([0, 0, w*360/N])         translate([g, 0, 0])         groove_shape(h, tw, OR, r) circle(r=r);      }   } } module groove_shape(h=1, twist=0, R, r) // operator module {     U = R*2*PI;     x = U/360*twist;     a = atan(x/h);     f = a==0?1:tan(a)/sin(a);     scale([1, f])     children(); }
Open this post in threaded view
|

## Re: how to make the groove more width?

Open this post in threaded view
|

## Re: how to make the groove more width?

 From my understanding, Parkinbot's post is the solution to your question. It's also a good demo or making a spring, I believe. \$ Runsun Pan, PhD \$ libs: scadx, doctest, faces(git), offline doc(git), runscad.py(2,git), editor of choice: CudaText ( OpenSCAD lexer); \$ Tips; \$ Snippets
Open this post in threaded view
|

## Re: how to make the groove more width?

 In reply to this post by Parkinbot I catch it. the most import is scale(), so I modify my code simply like this: if(groove){         for(g=[[OR,0],[0,OR],[-OR,0],[0,-OR]])         linear_extrude(height=h, center=true, convexity=1, twist=720)translate(g)scale(g[0]==0?[3, 1]:[1,3])circle(r = 0.5);         } thanks. those trigonometric make me dizzy, so i just add an simple judgement. lol
Open this post in threaded view
|

## Re: how to make the groove more width?

 In reply to this post by runsun As I wrote the approach is limited. For to do springs, it needs more.
Open this post in threaded view
|

## Re: how to make the groove more width?

 2017-01-19 11:30 GMT-02:00 Parkinbot :As I wrote the approach is limited. For to do springs, it needs more. Would you elaborate on that? I don't see any way to get a circular transversal section from a linear_extrude. _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Open this post in threaded view
|

## Re: how to make the groove more width?

 Ronaldo wrote Would you elaborate on that? As long as nobody provides a definition for "side tracking a thread" I'll try. An ellipse is just an approximation of the proper shape. It can be used to carve grooves as in the example, but ... you name it. It lacks a radial transformation and thus gets worse with growing twist/height ratio. But if you take a perfect spring object and calculate a 2D shape from it, using projection(cut=true), you will obviously get a shape so that linear_extrude() does what you want. Of course in a practical sense there are restrictions.
Open this post in threaded view
|

## Re: how to make the groove more width?

 This post was updated on . In reply to this post by eexpss Now I find does not need change scale parameter.         for(g=[0,45,90,-45,-90,135,-135,180])//rotate                 for(tw=[720,-720])         linear_extrude(height=h, center=true, twist=tw)rotate([0,0,g])scale([1,5])translate([OR,0])circle(r = 0.5); or
Open this post in threaded view
|

## Re: how to make the groove more width?

 This post was updated on . In reply to this post by Ronaldo Ronaldo, this is your linear_extrude circle with radial transformation. As I said it gets worse with the ratio growing. The transformation is non-affine, so you can't express it with multmatrix. R=12; h=60; r = 2; twist = 720; linear_extrude(height = h, twist = twist, slices = 600)   polygon(groove_circle(R, r, twist, h)); function groove_circle(R=30, r=7, twist, h) = let(a = atan(2*R*PI/360*twist/h),     f = a==0?1:tan(a)/sin(a))  // factor  [for(i=[0:10:359])    let(v=[r*sin(i)+R, f*r*cos(i)])    (R+v[0])*v/norm(v)];  // radial transformation
Open this post in threaded view
|

## Re: how to make the groove more width?

Open this post in threaded view
|

## Re: how to make the groove more width?

 Ronaldo, thanks for going through my code, your optimizations and hints. Yes, it is no surprise that a non-affine projection can/will transform lines into curves. In the given case the x-dimension has to go through a circular projection to get the job done. So the solution needs a skilled hammerer and special nails - and is obviously beyond the scope of native OpenSCAD. Which "helical projections" do you mean? The gears are already in radial form and my springs and coils lib doesn't use this weired approach. Of course, a proper sweep() (or hull() discretisation) over an orthogonally oriented extrusion shape is the best approach.
Open this post in threaded view
|