[OpenSCAD] Bent rod

blobule roys at iro.umontreal.ca
Sun Sep 27 12:31:38 EDT 2015


%%%%%%%%%%%%%%%%%%%%%%%

$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);

%%%%%%%%%%%%%%%%%%%%%%%%

<http://forum.openscad.org/file/n14018/pipewrap.png> 





--
View this message in context: http://forum.openscad.org/Bent-rod-tp14003p14018.html
Sent from the OpenSCAD mailing list archive at Nabble.com.




More information about the Discuss mailing list