# Bent rod

7 messages
Open this post in threaded view
|

## Bent rod

 I would like to plumb a model steam engine. How do I bend a rod around the boiler to represent pipes? Just give me an example around a cylinder.  Down the side then turn, then up around the cylinder.
Open this post in threaded view
|

## Re: Bent rod

 This post was updated on . Not exactly what you are asking for, but should have enough details for you to work with: \$fn=100; eps=0.001; // to make sure there's no gap r=1; module Ring(r=r){     rotate_extrude()     translate( [3,0,0] )circle( r ); } module Arc(r=r){     difference(){         Ring(r);         translate( [0,0, -2.5] )         cube( [5,5,5] );     } } module S(r){     Arc(r=r);     translate( [-eps,3,0 ] ) // use eps     rotate( [-90,0,180] )     translate( [0,-3,0 ] )     Arc(r=r); } difference(){     S();     S(r=0.6); }   \$ 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: Bent rod

 In reply to this post by K.C.C. %%%%%%%%%%%%%%%%%%%%%%% \$step=10; \$h=0.1; // cr : cylinder radisu for wrapping // r : radius of actual pipe // vr : radius of "virtual" pipe, used to place the real pipe module place(cr=20,r=5,vr=5,t=0) {     rotate(t,[0,0,1])     translate([cr+vr,0,t/360*2*vr])     rotate(90,[1,0,0]) linear_extrude(height=\$h,center=true) circle(r=r); } module loop(cr=20,r=5,vr=5) {     for( t=[0:\$step:360-\$step/2] ) {         hull() {             place(cr=cr,r=r,vr=vr,t=t);             place(cr=cr,r=r,vr=vr,t=t+\$step);         }     } } module emptyLoop(cr=20,rin=5,rout=7) {     difference() {         /*render(convexity=2)*/ loop(cr=cr,r=rout,vr=rout,\$h=0.1);         /*render(convexity=2)*/ loop(cr=cr,r=rin,vr=rout,\$h=0.5);     } } module manyLoops(cr=20,n=5,r=5,vr=5,h=0.1) {     for(i=[0:n-1]) {         translate([0,0,i*vr*2]) loop(cr=cr,r=r,vr=vr);     } } module manyEmptyLoops(cr=20,n=5,rout=7,rin=5) {     for(i=[0:n-1]) {         translate([0,0,i*rout*2]) emptyLoop(cr=cr,rin=rin,rout=rout);     } } //place(); //loop(); //manyLoops(); manyEmptyLoops(); %translate([0,0,-20]) cylinder(r=20,h=100); %%%%%%%%%%%%%%%%%%%%%%%%
Open this post in threaded view
|

## Re: Bent rod

 On 2015-09-27 18:31, blobule wrote: > %%%%%%%%%%%%%%%%%%%%%%% > > \$step=10; > \$h=0.1; > > // cr : cylinder radisu for wrapping > // r : radius of actual pipe > // vr : radius of "virtual" pipe, used to place the real pipe > > module place(cr=20,r=5,vr=5,t=0) { >      rotate(t,[0,0,1]) >      translate([cr+vr,0,t/360*2*vr]) >      rotate(90,[1,0,0]) linear_extrude(height=\$h,center=true) circle(r=r); > }  > .... That is a clever special case work-around for a missing feature: a general sweep function that can take a 2d shape and sweep it along any path. Thank you for this inspiring example. Carsten Arnholm _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Open this post in threaded view
|

## Re: Bent rod

 Indeed. Bloblue's approach is way cooler. \$ Runsun Pan, PhD \$ libs: scadx, doctest, faces(git), offline doc(git), runscad.py(2,git), editor of choice: CudaText ( OpenSCAD lexer); \$ Tips; \$ Snippets