How to model a bent pipe?

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

How to model a bent pipe?

David Goodenough
I am relatively new to this 3D CAD lark, and so the solution may be
well know, but I can not work it out for myself.

I can make pipes out of concentric cylinders, and I can make sharp
bends by cutting the pipe at an angle and then reattaching it.

However what I can not work out how to do is model a bent pipe with
a bend radius of say 10 times the pipe radius - so a gently bend that
one might get with a plumbers pipe bender.

Anyone got any ideas or even better example code?

David

Reply | Threaded
Open this post in threaded view
|

Re: How to model a bent pipe?

Ian Shumsky
Hi David,

> Anyone got any ideas or even better example code?

To get a gentle curve, use a quarter of a torus and attach the cylinders to that. I'm at work so unable to give you some code examples, sorry.

Cheers,
Ian


______________________________________________________________________
This email has been scanned by the Symantec Email Security.cloud service.
For more information please visit http://www.symanteccloud.com
______________________________________________________________________

Reply | Threaded
Open this post in threaded view
|

Re: How to model a bent pipe?

David Goodenough
On Monday 21 Nov 2011, Ian Shumsky wrote:

> Hi David,
>
> > Anyone got any ideas or even better example code?
>
> To get a gentle curve, use a quarter of a torus and attach the cylinders to
> that. I'm at work so unable to give you some code examples, sorry.
>
> Cheers,
> Ian
>
>
> ______________________________________________________________________
> This email has been scanned by the Symantec Email Security.cloud service.
> For more information please visit http://www.symanteccloud.com
> ______________________________________________________________________
> _______________________________________________
> OpenSCAD mailing list
> [hidden email]
> http://rocklinux.net/mailman/listinfo/openscad
Obvious when you see it, thank you.

David

Reply | Threaded
Open this post in threaded view
|

Re: How to model a bent pipe?

Triffid Hunter
On Mon, Nov 21, 2011 at 9:34 PM, David Goodenough
<[hidden email]> wrote:
> I can make pipes out of concentric cylinders, and I can make sharp
> bends by cutting the pipe at an angle and then reattaching it.
>
> However what I can not work out how to do is model a bent pipe with
> a bend radius of say 10 times the pipe radius - so a gently bend that
> one might get with a plumbers pipe bender.

Here's an example for you; enjoy!

$fn=128;

radius = 4;
inner_radius = 3.5;

bend_radius = 40;

angle_1 = 10;
angle_2 = 100;

union() {
        // lower arm
        rotate([0, 0, angle_1])
                translate([bend_radius + radius, 0.02, 0])
                rotate([90, 0, 0])
                difference() {
                        cylinder(r=radius, h=50);
                        translate([0, 0, -1])
                                cylinder(r=inner_radius, h=52);
                }
        // upper arm
        rotate([0, 0, angle_2])
                translate([bend_radius + radius, -0.02, 0])
                rotate([-90, 0, 0])
                difference() {
                        cylinder(r=radius, h=50);
                        translate([0, 0, -1])
                                cylinder(r=inner_radius, h=52);
                }
        // bend
        difference() {
                // torus
                rotate_extrude()
                        translate([bend_radius + radius, 0, 0])
                        circle(r=radius);

                // torus cutout
                rotate_extrude()
                        translate([bend_radius + radius, 0, 0])
                        circle(r=inner_radius);
                // lower cutout
                rotate([0, 0, angle_1])
                        translate([-50 * (((angle_2 - angle_1) <= 180)?1:0), -100, -50])
                        cube([100, 100, 100]);
                // upper cutout
                rotate([0, 0, angle_2])
                        translate([-50 * (((angle_2 - angle_1) <= 180)?1:0), 0, -50])
                        cube([100, 100, 100]);
        }
}

Reply | Threaded
Open this post in threaded view
|

Re: How to model a bent pipe?

nagylzs
This post has NOT been accepted by the mailing list yet.
I have tried to use your code in production, and it turned out that it is limited. It does not work for bend radius>100, for outer pipe radius>100 and in some other special cases. Here is a better version that - in theory - works with any parameters within common sense.

 module bent_pipe(radius, inner_radius, bend_radius, angle_1, angle_2, lower_arm_length, upper_arm_length) {
union() {
        // lower arm
        if (lower_arm_length>0) {
        rotate([0, 0, angle_1])
                translate([bend_radius + radius, 0.02, 0])
                rotate([90, 0, 0])
                difference() {
                        cylinder(r=radius, h=lower_arm_length);
                        translate([0, 0, -1])
                                cylinder(r=inner_radius, h=lower_arm_length+2);
                }
        }
        // upper arm
        if (upper_arm_length>0) {
        rotate([0, 0, angle_2])
                translate([bend_radius + radius, -0.02, 0])
                rotate([-90, 0, 0])
                difference() {
                        cylinder(r=radius, h=upper_arm_length);
                        translate([0, 0, -1])
                                cylinder(r=inner_radius, h=upper_arm_length+2);
                }
        }
        // bend
        difference() {
                // torus
                rotate_extrude()
                        translate([bend_radius + radius, 0, 0])
                        circle(r=radius);

                // torus cutout
                rotate_extrude()
                        translate([bend_radius + radius, 0, 0])
                        circle(r=inner_radius);
                // lower cutout
                rotate([0, 0, angle_1])
                        translate([-(bend_radius+2*radius+1) * (((angle_2 - angle_1) <= 180)?1:0), -bend_radius-2*radius-2, -(radius+1)])
                        cube([2*(bend_radius+2*radius+1), bend_radius+2*radius+2, 2*(radius+1)]);
                // upper cutout
                rotate([0, 0, angle_2])
                        translate([-(bend_radius+2*radius+1) * (((angle_2 - angle_1) <= 180)?1:0), 0, -radius])
                        cube([2*(bend_radius+2*radius+1), bend_radius+2*radius+1, 2*(radius+1)]);
        }
}
   
}
Reply | Threaded
Open this post in threaded view
|

Re: How to model a bent pipe?

runsun
In reply to this post by David Goodenough
This might be helpful:

http://forum.openscad.org/Bent-rod-td14003.html#a14004
$ 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: How to model a bent pipe?

MichaelAtOz
Administrator
In reply to this post by nagylzs
Hi nagylzs,
Welcome to the forum. Your post is still flagged as "This post has NOT been accepted by the mailing list yet", so nobody gets it unless they look.
You need to subscribe to the mailing list, and respond to the registration email.
Admin - email* me if you need anything,
or if I've done something stupid...
* click on my MichaelAtOz label, there is a link to email me.

Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work.
Obviously inclusion of works of previous authors is not included in the above.


The TPP is no simple “trade agreement.” Fight it! http://www.ourfairdeal.org/ time is running out!