Btw, this is a very useful operator, which I use everyday. In my shortcuts
library I implemented it like this:
module rotN(r=10, N=4, offs=0, M=undef) for(i=[0:(M?M-1:N-1)])
rotate([0,0,offs+i*360/N]) translate([r,0,0]) children();
// Examples
color("green") rotN(40,12) cylinder(r=4, h=10);
color("red") rotN(30,12,M=6) cylinder(r=4, h=10);
color("blue") rotN(20,12,120, 6) cylinder(r=4, h=10);
--
View this message in context: http://forum.openscad.org/trouble-making-a-round-flange-with-holes-in-tp20961p20992.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Cool. My version is called rep_rotate(count) shape (rep == repeat).
module rep_rotate(count)
for (i=[0:count-1])
rotate(i*360/count)
children();
color("green")
rep_rotate(12) translate([40,0,0]) cylinder(r=4, h=10);
I'm not saying this is a better interface, I just think it's interesting
that a lot of people have come up with the same abstraction, and I like to
see how other people use OpenSCAD. Now that I've seen these other modules,
I might add a radius to mine.
On 22 March 2017 at 12:25, Parkinbot rudolf@parkinbot.com wrote:
Btw, this is a very useful operator, which I use everyday. In my shortcuts
library I implemented it like this:
module rotN(r=10, N=4, offs=0, M=undef) for(i=[0:(M?M-1:N-1)])
rotate([0,0,offs+i*360/N]) translate([r,0,0]) children();
// Examples
color("green") rotN(40,12) cylinder(r=4, h=10);
color("red") rotN(30,12,M=6) cylinder(r=4, h=10);
color("blue") rotN(20,12,120, 6) cylinder(r=4, h=10);
--
View this message in context: http://forum.openscad.org/
trouble-making-a-round-flange-with-holes-in-tp20961p20992.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
Parkinbot wrote
Btw, this is a very useful operator, which I use everyday. In my shortcuts
library I implemented it like this:
Nice. My trouble with that kind of function and operators is that the more
flexible they are the more parameter names I have to memorize when I need
them. Yes, I always may consult the code but that is their burden.
--
View this message in context: http://forum.openscad.org/trouble-making-a-round-flange-with-holes-in-tp20961p20994.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Ronaldo wrote
Nice. My trouble with that kind of function and operators is that the more
flexible they are the more parameter names I have to memorize when I need
them. Yes, I always may consult the code but that is their burden.
That is why I implement a help() module in every library. For shortcuts.scad
you get the output:
ECHO: "
shortcuts.scad
help(): shows this help
help_shortcuts(): shows this help
show_examples(): shows some examples
place_in_rect(): places children objects in grid
Transformations:
transform : T(x=0, y=0, z=0), Tx(x=0) , Ty(y=0), Tz(z=0)
rotate : R(x=0, y=0, z=0), Rx(x=0) , Ry(y=0), Rz(z=0)
scale : S(x=1, y=1, z=1), Sx(x=1) , Sy(y=1), Sz(z=1)
Logical
difference : D()
union : U()
intersection : I()
Useful
N instances around circle : rotN(r=10, N=4, offs=0, M=undef)
range function [0:1:N] : Rg(N)
color : C(r,b,g,t) or C(string,t)
Primitives
circle : Ci(r=10, d=undef)
circle_half : CiH(r=10, w=0, d=undef)
circle_segment : CiS(r=10, w1=0, w2=90, d=undef)
square : Sq(x=10, y=undef, center=true))
cylinder : Cy(r=10, h=1, center=true, r1=undef, r2=undef, d=undef)
cylinder_half : CyH(r=10, w=0, d=undef)
cylinder_segment: CyS(r=10, h=1, w1=0, w2=90,center=true, d=undef)
cylinder_segment: Pie(r=10, h=1, w1=0, w2=90,center=true, d=undef)
cube : Cu(x=10, y=undef, z=undef, center=true)
ring : Ri(R=10, r=5, h=1, center=true, D=undef, d=undef)
ring_half : RiH(R=10, r=5, h=1, w=0 center=true, D=undef, d=undef)
ring_segment : RiS(R=10, r=5, h=1, w1=0, w2=90, center=true, D=undef,
d=undef)
sphere: Sp(r=10))
sphere_half: SpH(r=10, w1 = 0, w2 = 0)
torus: To(torus(R=10, r=1, w1=0, w2=360)
--
View this message in context: http://forum.openscad.org/trouble-making-a-round-flange-with-holes-in-tp20961p20995.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
2017-03-22 19:24 GMT-03:00 Parkinbot rudolf@parkinbot.com:
That is why I implement a help() module in every library. For
shortcuts.scad
you get the output:
That is a good practice but what do you do when you have several libraries
in <use>, each with its help() ? There is no way to qualify an used
function or module.
Ronaldo wrote
That is a good practice but what do you do when you have several libraries
in
<use>
, each with its help() ? There is no way to qualify an used
function or module.
--
View this message in context: http://forum.openscad.org/trouble-making-a-round-flange-with-holes-in-tp20961p20997.html
Sent from the OpenSCAD mailing list archive at Nabble.com.