discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

How do I bend?

TL
Thomas Leonard Gertz
Wed, Mar 21, 2018 2:09 PM

Make a shape like a pipebend.


Thomas Leonard Gertz
Kerteminde, Danmark

Sent from: http://forum.openscad.org/

Make a shape like a pipebend. ----- Thomas Leonard Gertz Kerteminde, Danmark -- Sent from: http://forum.openscad.org/
RP
Ronaldo Persiano
Wed, Mar 21, 2018 2:35 PM
There were many discussions about this here. A starting list may be: http://forum.openscad.org/Curved-Cylinders-td18425.html http://forum.openscad.org/Curved-bent-conical-tubing-td20686.html http://forum.openscad.org/bend-a-pipe-tube-td12503.html
N
NateTG
Wed, Mar 21, 2018 3:59 PM

If you're feeling silly and have OpenSCAD 2015 or more recent, you can do
something like this:
function flatten(list) =  [for (a=list) for (b=a) b];module pipebend (
curve_radius=10,  bend_angle=30,  pipe_od=2,  pipe_id=1.8,  $fn=36  ) {
$fbend=$fn;  $fpipe=$fn;  or=pipe_od/2;  ir=pipe_id/2;
c_step=360/$fpipe;  b_steps=ceil(bend_angle/360*$fbend);
b_step=bend_angle/b_steps;  opoints=        flatten([for
(theta=[0:b_step:bend_angle])            [for (phi=[c_step:c_step:360])
[                  cos(theta) * (curve_radius+orcos(phi)),
sin(theta) * (curve_radius+or
cos(phi)),
orsin(phi)                ]            ]        ])  ;
ofaces=flatten([concat(      [[for (i=[$fpipe-1:-1:0]) i]],
flatten([for (j=[0:b_steps])            [for (i=[$fpipe-1:-1:0])
[j
$fpipe+i,j*$fpipe+(i+1)%$fpipe,(j+1)$fpipe+(i+1)%$fpipe,(j+1)$fpipe+i]
]        ]),      [[for (i=[$fpipe:-1:0]) ($fpipe*(b_steps+1))-i]]  )]);
ipoints=        flatten([for (theta=[-b_step:b_step:bend_angle+b_step])
[for (phi=[c_step:c_step:360])                [                  cos(theta)

  • (curve_radius+ircos(phi)),                  sin(theta) *
    (curve_radius+ir
    cos(phi)),
    irsin(phi)                ]            ]        ])  ;
    ifaces=flatten([concat(      [[for (i=[$fpipe-1:-1:0]) i]],
    flatten([for (j=[0:b_steps+2])            [for (i=[$fpipe-1:-1:0])
    [j
    $fpipe+i,j*$fpipe+(i+1)%$fpipe,(j+1)$fpipe+(i+1)%$fpipe,(j+1)$fpipe+i]
    ]        ]),      [[for (i=[$fpipe:-1:0]) ($fpipe*(b_steps+3))-i]]  )]);
    difference() {      polyhedron(        points=opoints,        faces=ofaces
    );      polyhedron(        points=ipoints,        faces=ifaces      );
    }}pipebend($fn=36,bend_angle=45,curve_radius=5,pipe_od=5,pipe_id=4);

--
Sent from: http://forum.openscad.org/

If you're feeling silly and have OpenSCAD 2015 or more recent, you can do something like this: function flatten(list) = [for (a=list) for (b=a) b];module pipebend ( curve_radius=10, bend_angle=30, pipe_od=2, pipe_id=1.8, $fn=36 ) { $fbend=$fn; $fpipe=$fn; or=pipe_od/2; ir=pipe_id/2; c_step=360/$fpipe; b_steps=ceil(bend_angle/360*$fbend); b_step=bend_angle/b_steps; opoints= flatten([for (theta=[0:b_step:bend_angle]) [for (phi=[c_step:c_step:360]) [ cos(theta) * (curve_radius+or*cos(phi)), sin(theta) * (curve_radius+or*cos(phi)), or*sin(phi) ] ] ]) ; ofaces=flatten([concat( [[for (i=[$fpipe-1:-1:0]) i]], flatten([for (j=[0:b_steps]) [for (i=[$fpipe-1:-1:0]) [j*$fpipe+i,j*$fpipe+(i+1)%$fpipe,(j+1)*$fpipe+(i+1)%$fpipe,(j+1)*$fpipe+i] ] ]), [[for (i=[$fpipe:-1:0]) ($fpipe*(b_steps+1))-i]] )]); ipoints= flatten([for (theta=[-b_step:b_step:bend_angle+b_step]) [for (phi=[c_step:c_step:360]) [ cos(theta) * (curve_radius+ir*cos(phi)), sin(theta) * (curve_radius+ir*cos(phi)), ir*sin(phi) ] ] ]) ; ifaces=flatten([concat( [[for (i=[$fpipe-1:-1:0]) i]], flatten([for (j=[0:b_steps+2]) [for (i=[$fpipe-1:-1:0]) [j*$fpipe+i,j*$fpipe+(i+1)%$fpipe,(j+1)*$fpipe+(i+1)%$fpipe,(j+1)*$fpipe+i] ] ]), [[for (i=[$fpipe:-1:0]) ($fpipe*(b_steps+3))-i]] )]); difference() { polyhedron( points=opoints, faces=ofaces ); polyhedron( points=ipoints, faces=ifaces ); }}pipebend($fn=36,bend_angle=45,curve_radius=5,pipe_od=5,pipe_id=4); -- Sent from: http://forum.openscad.org/
P
Parkinbot
Thu, Mar 22, 2018 11:25 AM

From OpenSCAD 2016.XX, there is a more home grown version:

pipebend($fn=36, bend_angle=60, curve_radius=5, pipe_od=5, pipe_id=4);

module pipebend (curve_radius=10,bend_angle=30,pipe_od=2,pipe_id=1.8,$fn=36)
rotate_extrude(angle=bend_angle)
translate([curve_radius, 0])
difference()
{
circle(d=pipe_od);
circle(d=pipe_id);
}

--
Sent from: http://forum.openscad.org/

>From OpenSCAD 2016.XX, there is a more home grown version: pipebend($fn=36, bend_angle=60, curve_radius=5, pipe_od=5, pipe_id=4); module pipebend (curve_radius=10,bend_angle=30,pipe_od=2,pipe_id=1.8,$fn=36) rotate_extrude(angle=bend_angle) translate([curve_radius, 0]) difference() { circle(d=pipe_od); circle(d=pipe_id); } -- Sent from: http://forum.openscad.org/
CC
Chris Camacho
Thu, Mar 22, 2018 11:53 AM

pity there isn't a "native" (built in) path extrude I find it so useful
in blender...

On 22/03/18 11:25, Parkinbot wrote:

From OpenSCAD 2016.XX, there is a more home grown version:

pipebend($fn=36, bend_angle=60, curve_radius=5, pipe_od=5, pipe_id=4);

module pipebend (curve_radius=10,bend_angle=30,pipe_od=2,pipe_id=1.8,$fn=36)
rotate_extrude(angle=bend_angle)
translate([curve_radius, 0])
difference()
{
circle(d=pipe_od);
circle(d=pipe_id);
}

--
Sent from: http://forum.openscad.org/


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

pity there isn't a "native" (built in) path extrude I find it so useful in blender... On 22/03/18 11:25, Parkinbot wrote: > From OpenSCAD 2016.XX, there is a more home grown version: > > pipebend($fn=36, bend_angle=60, curve_radius=5, pipe_od=5, pipe_id=4); > > module pipebend (curve_radius=10,bend_angle=30,pipe_od=2,pipe_id=1.8,$fn=36) > rotate_extrude(angle=bend_angle) > translate([curve_radius, 0]) > difference() > { > circle(d=pipe_od); > circle(d=pipe_id); > } > > > > -- > Sent from: http://forum.openscad.org/ > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
P
Parkinbot
Thu, Mar 22, 2018 12:42 PM

well there are some sweep libs out there that allow for this kind stuff.
How does blender treat selfintersections?

codifies wrote

pity there isn't a "native" (built in) path extrude I find it so useful
in blender...

well there are some sweep libs out there that allow for this kind stuff. How does blender treat selfintersections? codifies wrote > pity there isn't a "native" (built in) path extrude I find it so useful > in blender... -- Sent from: http://forum.openscad.org/
CC
Chris Camacho
Thu, Mar 22, 2018 5:38 PM

ignores them, if you're just rendering a soup of tri's - start to
attempt boolean ops on something self intersecting it aint gonna end
well...

On 22/03/18 12:42, Parkinbot wrote:

well there are some sweep libs out there that allow for this kind stuff.
How does blender treat selfintersections?

codifies wrote

pity there isn't a "native" (built in) path extrude I find it so useful
in blender...

ignores them, if you're just rendering a soup of tri's - start to attempt boolean ops on something self intersecting it aint gonna end well... On 22/03/18 12:42, Parkinbot wrote: > well there are some sweep libs out there that allow for this kind stuff. > How does blender treat selfintersections? > > > codifies wrote >> pity there isn't a "native" (built in) path extrude I find it so useful >> in blender... > > > > > -- > Sent from: http://forum.openscad.org/ > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org