How do I bend?

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

How do I bend?

Thomas Leonard Gertz
Make a shape like a pipebend.



-----
Thomas Leonard Gertz
Kerteminde, Danmark
--
Sent from: http://forum.openscad.org/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Thomas Leonard Gertz
Kerteminde, Danmark
Reply | Threaded
Open this post in threaded view
|

Re: How do I bend?

Ronaldo
Reply | Threaded
Open this post in threaded view
|

Re: How do I bend?

NateTG
In reply to this post by Thomas Leonard Gertz
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 the OpenSCAD mailing list archive at Nabble.com.

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: How do I bend?

Parkinbot
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
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: How do I bend?

codifies
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
> [hidden email]
> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: How do I bend?

Parkinbot
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
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: How do I bend?

codifies
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
> [hidden email]
> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org


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