This is an old subject. But this is what I use to solve it:
intersection()
{
rotate_extrude()
{
translate([20,0,0]) square([4,2]);
}
hull()
{
rotate(0) cube([0.1,100,100]);
rotate(90) cube([0.1,100,100]);
}
}
--
View this message in context: http://forum.openscad.org/partial-rotate-extrude-tp2695p15153.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Thanks to https://github.com/openscad/openscad/pull/1475 the dev
snapshots now have an angle parameter for rotate_extrude().
ciao,
Torsten.
Hi,
I took some time to generalize your idea.
Here it goes:
DefaultFaces=24;
module Tube_Sect(Height,Dout,Din,StartAngle,EndAngle,Faces) {
StartAngle= (StartAngle < 0) ? 360+StartAngle : StartAngle;
EndAngle= (EndAngle < 0) ? 360+EndAngle : EndAngle;
EndAngle2 = (EndAngle < StartAngle) ? StartAngle : EndAngle;
StartAngle2 = (EndAngle < StartAngle) ? EndAngle : StartAngle;
if (EndAngle2-StartAngle2<360){
NSides= (Faces < 3 || Faces==undef) ? DefaultFaces : Faces;
n=floor((EndAngle2-StartAngle2)/120);
Sect1=EndAngle2-StartAngle2-n*120;
Sect2= (n>0) ? 120 : 0;
Sect3=(n>1) ? 120 : 0;
intersection(){
rotate_extrude(convexity=2,
$fn=floor(NSides*360/(EndAngle2-StartAngle2)))
translate([Din/2,0,0]) square([(Dout-Din)/2,Height]);
union(){
hull(){
rotate(StartAngle2) cube([0.001,Dout,Height+1]);
rotate((StartAngle2+Sect1)) cube([0.001,Dout,Height+1]);
}
hull(){
rotate((StartAngle2+Sect1)) cube([0.001,Dout,Height+1]);
rotate((StartAngle2+Sect1+Sect2)) cube([0.01,Dout,Height+1]);
}
hull(){
rotate((StartAngle2+Sect1+Sect2)) cube([0.001,Dout,Height+1]);
rotate((StartAngle2+Sect1+Sect2+Sect3)) cube([0.001,Dout,Height+1]);
}
}
}
} else { echo("Only rotations less than 360 degrees are supported");}
}
//Examples:
translate([30,0,0])
Tube_Sect(Height=20, Dout=30, Din=20, StartAngle=0, EndAngle=359.9999,
Faces=3);
translate([-30,0,0])
Tube_Sect(Height=20, Dout=30, Din=20, StartAngle=0, EndAngle=359.9999,
Faces=5);
//Left rotation
Tube_Sect(Height=40,Dout=20,Din=12,StartAngle=0,EndAngle=259,Faces=20);
translate([0,30,0])
//Right rotation
Tube_Sect(Height=40,Dout=20,Din=12,StartAngle=-0.0001,EndAngle=-259,Faces=20);
translate([0,-30,0])
//Complementary right rotation
Tube_Sect(Height=40,Dout=20,Din=12,StartAngle=-0.0001,EndAngle=259,Faces=20);
//Complementary left rotation
translate([0,-60,0])
Tube_Sect(Height=40,Dout=20,Din=12,StartAngle=0,EndAngle=-259,Faces=20);
Cheers,
jpmendes
Johan Jonker wrote
This is an old subject. But this is what I use to solve it:
intersection()
{
rotate_extrude()
{
translate([20,0,0]) square([4,2]);
}
hull()
{
rotate(0) cube([0.1,100,100]);
rotate(90) cube([0.1,100,100]);
}
}
--
View this message in context: http://forum.openscad.org/partial-rotate-extrude-tp2695p15161.html
Sent from the OpenSCAD mailing list archive at Nabble.com.