discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Extrude with Twist AND Bend

N
NBGer
Thu, Jan 30, 2020 11:47 AM

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/

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/
NH
nop head
Thu, Jan 30, 2020 8:42 PM

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 richard@itrgmbh.de 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
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

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 <richard@itrgmbh.de> 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 > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >
C
caterpillar
Thu, Jan 30, 2020 11:33 PM
Would these help? https://openhome.cc/eGossip/OpenSCAD/lib-ring_extrude.html https://openhome.cc/eGossip/OpenSCAD/lib-bend_extrude.html https://openhome.cc/eGossip/OpenSCAD/lib-path_extrude.html They are in my library. https://github.com/JustinSDK/dotSCAD ----- https://openhome.cc -- Sent from: http://forum.openscad.org/
P
Parkinbot
Fri, Jan 31, 2020 3:07 PM

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/

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/