Bent rod

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Bent rod

K.C.C.
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.
Reply | Threaded
Open this post in threaded view
|

Re: Bent rod

runsun
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
Reply | Threaded
Open this post in threaded view
|

Re: Bent rod

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

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



Reply | Threaded
Open this post in threaded view
|

Re: Bent rod

cacb
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
Reply | Threaded
Open this post in threaded view
|

Re: Bent rod

runsun
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
Reply | Threaded
Open this post in threaded view
|

Re: Bent rod

Chow Loong Jin
In reply to this post by cacb
On Mon, Sep 28, 2015 at 12:29:50AM +0200, Carsten Arnholm wrote:

> 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.
The code for using the generalized sweep() function is very similar. If you're
using a new enough OpenSCAD, I recommend that you use that instead. sweep.scad
is in
https://github.com/openscad/list-comprehension-demos/blob/master/sweep.scad, and
the transformations you can use are in
https://github.com/openscad/scad-utils/blob/master/transformations.scad

Examples on how to use sweep.scad can be found in list-comprehension-demos as
well.

--
Kind regards,
Loong Jin

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

signature.asc (836 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Bent rod

K.C.C.
thanks! But I don't think you get the picture. I am modeling very small. Can not be hollow. A pipe runs down the side of a steam engine boiler' the around the boiler (cylinder) up to the steam dome.