Hi,
I'm using OpenSCAD version 2015.03-2
What is wrong in the code bellow? I cannot get a 45º section of a tube, I
get 360º rotation only.
The Wiki says:
«Usage[edit]
rotate_extrude(angle = 360, convexity = 2) {...}
You must use parameter names due to a backward compatibility issue. »
What does the previous line mean?
DefaultSides=24;
module Tube(Length,Dout,Din,Sides,Angl)
{
NSides= (Sides < 3 || Sides==undef) ? DefaultSides : Sides;
rotate_extrude(angle=Angl, convexity=2, $fn=NSides )
translate([Din/2,0,0])
square([(Dout-Din)/2,Length]);
}
//Example:
Tube (Length=100,Dout=30,Din=25,Sides=90,Angl=45);
======
I had to figure how to do the same, making the module bellow based on a
Johan Jonker code sugestion:
=========
DefaultFaces=24;
module Tube_Sect(Height,Dout,Din,StartAngle,EndAngle,Faces) {
StartAngle= (StartAngle < 0) ? 360+StartAngle : StartAngle;
EndAngle= (EndAngle < 0) ? 360+EndAngle : EndAngle;
echo(StartAngle, 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(, $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.001,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");}
}
//Test 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);
//Right rotation
//translate([0,30,0])
//Tube_Sect(Height=40,Dout=20,Din=12,StartAngle=-0.0001,EndAngle=-259,Faces=20);
//Complementary right rotation
//translate([0,-30,0])
//Tube_Sect(Height=40,Dout=20,Din=12,StartAngle=-0.0001,EndAngle=259,Faces=20);
// Complementary right rotation
//translate([0,-60,0])
//Tube_Sect(Height=40,Dout=20,Din=12,StartAngle=0,EndAngle=-259,Faces=20);
=======
Thanks in advance
jpmendes
--
View this message in context: http://forum.openscad.org/This-seems-to-be-ultra-basic-I-cannot-have-the-rotate-extrude-angle-parameter-working-tp15180.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
The angle was added recently and is not in any stable release yet.
The wiki has a note next to the angle parameter description:
[Note: Requires version 2016.XX]
That means its scheduled to be in the next upcoming release.
For now you can get this feature through the nightly dev releases.
The line you asked about:
You must use parameter names due to a backward compatibility issue.
Just means it won't work if you omit the parameter names and try to rely on
the ordering of the parameters alone(as is possible with many other
openscad functions). Your code looks fine in that regard, since you are
specifying the names "angle=..."
Hans
On Tue, Dec 15, 2015 at 2:16 PM, jpmendes jpmendes54@gmail.com wrote:
Hi,
I'm using OpenSCAD version 2015.03-2
What is wrong in the code bellow? I cannot get a 45º section of a tube, I
get 360º rotation only.
The Wiki says:
«Usage[edit]
rotate_extrude(angle = 360, convexity = 2) {...}
You must use parameter names due to a backward compatibility issue. »
What does the previous line mean?
DefaultSides=24;
module Tube(Length,Dout,Din,Sides,Angl)
{
NSides= (Sides < 3 || Sides==undef) ? DefaultSides : Sides;
rotate_extrude(angle=Angl, convexity=2, $fn=NSides )
translate([Din/2,0,0])
square([(Dout-Din)/2,Length]);
}
//Example:
Tube (Length=100,Dout=30,Din=25,Sides=90,Angl=45);
======
I had to figure how to do the same, making the module bellow based on a
Johan Jonker code sugestion:
=========
DefaultFaces=24;
module Tube_Sect(Height,Dout,Din,StartAngle,EndAngle,Faces) {
StartAngle= (StartAngle < 0) ? 360+StartAngle : StartAngle;
EndAngle= (EndAngle < 0) ? 360+EndAngle : EndAngle;
echo(StartAngle, 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(,
$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.001,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");}
}
//Test 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);
//Right rotation
//translate([0,30,0])
//Tube_Sect(Height=40,Dout=20,Din=12,StartAngle=-0.0001,EndAngle=-259,Faces=20);
//Complementary right rotation
//translate([0,-30,0])
//Tube_Sect(Height=40,Dout=20,Din=12,StartAngle=-0.0001,EndAngle=259,Faces=20);
// Complementary right rotation
//translate([0,-60,0])
//Tube_Sect(Height=40,Dout=20,Din=12,StartAngle=0,EndAngle=-259,Faces=20);
=======
Thanks in advance
jpmendes
--
View this message in context:
http://forum.openscad.org/This-seems-to-be-ultra-basic-I-cannot-have-the-rotate-extrude-angle-parameter-working-tp15180.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Thanks Hans,
It is not usual the documentation going ahead of the application, so my eye
interpreted the 2016.xx as 2015.xx. If not you, I would be looking 100 times
and seeing 2015.xx
jpmendes
--
View this message in context: http://forum.openscad.org/This-seems-to-be-ultra-basic-I-cannot-have-the-rotate-extrude-angle-parameter-working-tp15180p15183.html
Sent from the OpenSCAD mailing list archive at Nabble.com.