Extrude with Twist AND Bend

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

Extrude with Twist AND Bend

NBGer
Hi Everyone,

I am totally new here in forum. So hopefully I have made all steps for
registration! (it's a bit tricky ;) )

My question is:
I have a simple square, which I want to extrude.
I am able to perfom extrusion with twist by usage of linear_extrude and I am
able to perform extrusion with bending by usage of rotate extrude:
My sample code:

module twist_it()
{
        linear_extrude(height = 60, center = false, convexity = 10, twist =
25, slices = 128)
        translate([-7.5, -7.5, 0])  
        square([15,15],center=false);
}

module bend_it()
{
    rotate([90,0,0])
   
    rotate_extrude(angle=25, convexity = 10,$fn = 100)
    translate([150, 0, 0])
    square(15,15,center=true);
}

But, I would need to do both at the same time for the same object. How do to
this?

The usage of this part: It should be a rail of a roller coaster for a steep
turn

Many Thanks
Richard




--
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: Extrude with Twist AND Bend

nophead
I don't think you can with the current version of OpenSCAD. There are several libraries that provide a module that will sweep a 2D polygon along a 3D path and specify a twist. My own implementation is here:  https://github.com/nophead/NopSCADlib#Sweep

On Thu, 30 Jan 2020 at 11:48, NBGer <[hidden email]> wrote:
Hi Everyone,

I am totally new here in forum. So hopefully I have made all steps for
registration! (it's a bit tricky ;) )

My question is:
I have a simple square, which I want to extrude.
I am able to perfom extrusion with twist by usage of linear_extrude and I am
able to perform extrusion with bending by usage of rotate extrude:
My sample code:

module twist_it()
{
        linear_extrude(height = 60, center = false, convexity = 10, twist =
25, slices = 128)
        translate([-7.5, -7.5, 0]) 
        square([15,15],center=false);
}

module bend_it()
{
    rotate([90,0,0])

    rotate_extrude(angle=25, convexity = 10,$fn = 100)
    translate([150, 0, 0])
    square(15,15,center=true);
}

But, I would need to do both at the same time for the same object. How do to
this?

The usage of this part: It should be a rail of a roller coaster for a steep
turn

Many Thanks
Richard




--
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: Extrude with Twist AND Bend

caterpillar
In reply to this post by NBGer
Reply | Threaded
Open this post in threaded view
|

Re: Extrude with Twist AND Bend

Parkinbot
In reply to this post by NBGer
There is quite a lot of sweep libraries out there. This is a code example for
mine:

use <Naca_sweep.scad>   // https://www.thingiverse.com/thing:900137

sweep(gendat());  // custom extrude to polyhedron

function gendat(r = 150, a = 25) =
  [for(i=[0:a])
    Ry(i,     // rotate around y
    Tx(r,     // translate along x
    Rz(i,     // rotate around z
    square(15, 15))))
  ];

function square(x=10, y=10) = 0.5*[[x, y, 0], [-x, y, 0], [-x, -y, 0], [x,
-y, 0]];

<http://forum.openscad.org/file/t887/rotrot.png>



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

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