RW
Raymond West
Sun, Oct 23, 2022 3:16 PM
Didn't realise that Bos2l had to be involved.
On 23/10/2022 16:08, Adrian Mariano wrote:
Ug, no do not clone the code. Triangles and squares have orientation,
yes, and you can correctly adjust with a single block of code if you
don't want the natural thing, which would be the object simply rotated
into position.
The way that rot_copies() works in BOSL2 is that it sets $ang and $idx
which give the angle of the item and the index number of the item
respectively, so you can adjust size, angle, color, or anything you
want. Want to make objects alternate between square and circle, just
check if $idx is even.
include<BOSL2/std.scad>
zrot_copies(n=8, d=10)
if ($idx % 2) square(1,center=true);
else circle(d=1,$fn=12);
gives this:
image.png
or
include<BOSL2/std.scad>
zrot_copies(n=8, d=10)
circle(d=1+$idx/5, $fn=12);
image.png
Triangles all pointing down:
zrot_copies(n=8, d=10, subrot=false)
rot(30)circle(d=2, $fn=3);
image.png
On Sun, Oct 23, 2022 at 10:53 AM Raymond West raywest@raywest.com wrote:
Clone the code. Triangles and squares have orientation. which will
need at least another rotation, depending on which way you want
them to point. As Sanjeev said, $fn will generate triangles, or
squares, but you may need to adjust the size of the circle, and
also the orientation too. But if you just want to poke the led
into a round hole, then no need to worry about the rotate, (but if
you measure the af of the square, it won't fit in the hole, you
need the diagonal. I'll leave the triangle measurement to someone
else.
On 23/10/2022 14:41, jon wrote:
I want to replace "circle(d = 0.95 * di);" on the bottom with,
say, "square(0.95 * di)" without cloning the code. My question
has nothing to deal with rotation, that I am aware. I want to
pass the shape (circle or square) in as a parameter to the module.
On 10/23/2022 9:24 AM, Sanjeev Prabhakar wrote:
Most of the time I get it wrong.
If you can share a sketch of what you want, maybe I can help in
this case (just to make sure my understanding is correct).
There is a function quaternion rotation which I normally use to
rotate various objects
On Sun, 23 Oct, 2022, 6:47 pm jon, <jon@jonbondy.com> wrote:
I want to create a ring of equally spaced objects. In the
code below,
those objects are circles, but I would like to be able to
have triangles
or squares without having to clone the code 3 times. Is
there a way to
pass in the shape?
module LEDPattern(n, di) {
// circular array of "n" LEDs with diameter "di"
an = 360/n;
r = di/2 / sin(an/2);
for (a = [0:an:359])
rotate([0, 0, a])
translate([r, 0, 0])
// reduce circle sizes to keep disks from
touching
circle(d = 0.95 * di);
}
_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org
_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email todiscuss-leave@lists.openscad.org
_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email todiscuss-leave@lists.openscad.org
_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org
OpenSCAD mailing list
To unsubscribe send an email todiscuss-leave@lists.openscad.org
Didn't realise that Bos2l had to be involved.
On 23/10/2022 16:08, Adrian Mariano wrote:
> Ug, no do not clone the code. Triangles and squares have orientation,
> yes, and you can correctly adjust with a single block of code if you
> don't want the natural thing, which would be the object simply rotated
> into position.
>
> The way that rot_copies() works in BOSL2 is that it sets $ang and $idx
> which give the angle of the item and the index number of the item
> respectively, so you can adjust size, angle, color, or anything you
> want. Want to make objects alternate between square and circle, just
> check if $idx is even.
>
> include<BOSL2/std.scad>
> zrot_copies(n=8, d=10)
> if ($idx % 2) square(1,center=true);
> else circle(d=1,$fn=12);
>
> gives this:
>
> image.png
>
> or
>
> include<BOSL2/std.scad>
> zrot_copies(n=8, d=10)
> circle(d=1+$idx/5, $fn=12);
>
> image.png
>
> Triangles all pointing down:
>
> zrot_copies(n=8, d=10, subrot=false)
> rot(30)circle(d=2, $fn=3);
>
> image.png
>
>
> On Sun, Oct 23, 2022 at 10:53 AM Raymond West <raywest@raywest.com> wrote:
>
> Clone the code. Triangles and squares have orientation. which will
> need at least another rotation, depending on which way you want
> them to point. As Sanjeev said, $fn will generate triangles, or
> squares, but you may need to adjust the size of the circle, and
> also the orientation too. But if you just want to poke the led
> into a round hole, then no need to worry about the rotate, (but if
> you measure the af of the square, it won't fit in the hole, you
> need the diagonal. I'll leave the triangle measurement to someone
> else.
>
> On 23/10/2022 14:41, jon wrote:
>>
>> I want to replace "circle(d = 0.95 * di);" on the bottom with,
>> say, "square(0.95 * di)" without cloning the code. My question
>> has nothing to deal with rotation, that I am aware. I want to
>> pass the shape (circle or square) in as a parameter to the module.
>>
>>
>> On 10/23/2022 9:24 AM, Sanjeev Prabhakar wrote:
>>> Most of the time I get it wrong.
>>>
>>> If you can share a sketch of what you want, maybe I can help in
>>> this case (just to make sure my understanding is correct).
>>>
>>> There is a function quaternion rotation which I normally use to
>>> rotate various objects
>>>
>>>
>>> On Sun, 23 Oct, 2022, 6:47 pm jon, <jon@jonbondy.com> wrote:
>>>
>>> I want to create a ring of equally spaced objects. In the
>>> code below,
>>> those objects are circles, but I would like to be able to
>>> have triangles
>>> or squares without having to clone the code 3 times. Is
>>> there a way to
>>> pass in the shape?
>>>
>>> module LEDPattern(n, di) {
>>> // circular array of "n" LEDs with diameter "di"
>>> an = 360/n;
>>> r = di/2 / sin(an/2);
>>> for (a = [0:an:359])
>>> rotate([0, 0, a])
>>> translate([r, 0, 0])
>>> // reduce circle sizes to keep disks from
>>> touching
>>> circle(d = 0.95 * di);
>>> }
>>> _______________________________________________
>>> OpenSCAD mailing list
>>> To unsubscribe send an email to discuss-leave@lists.openscad.org
>>>
>>>
>>> _______________________________________________
>>> OpenSCAD mailing list
>>> To unsubscribe send an email todiscuss-leave@lists.openscad.org
>>
>> _______________________________________________
>> OpenSCAD mailing list
>> To unsubscribe send an email todiscuss-leave@lists.openscad.org
> _______________________________________________
> OpenSCAD mailing list
> To unsubscribe send an email to discuss-leave@lists.openscad.org
>
>
> _______________________________________________
> OpenSCAD mailing list
> To unsubscribe send an email todiscuss-leave@lists.openscad.org
TP
Torsten Paul
Sun, Oct 23, 2022 3:20 PM
On 23.10.22 17:16, Raymond West wrote:
Didn't realise that Bos2l had to be involved.
It's the convenient way. Otherwise, just open
File -> Examples -> Advanced -> children.scad
This shows a couple of simple examples without need for any extra dependencies.
ciao,
Torsten.
On 23.10.22 17:16, Raymond West wrote:
> Didn't realise that Bos2l had to be involved.
It's the convenient way. Otherwise, just open
File -> Examples -> Advanced -> children.scad
This shows a couple of simple examples without need for any extra dependencies.
ciao,
Torsten.
AM
Adrian Mariano
Sun, Oct 23, 2022 3:40 PM
There's no need to involve BOSL2, but if you want to create a mechanism for
placing rotated children where you control their behavior in some
complicated way then it's convenient. I prefer not to reinvent the wheel,
but you can rewrite rot_copies() yourself if you prefer---it's easy
enough. Just set appropriate $ variables if you need them in the children.
On Sun, Oct 23, 2022 at 11:17 AM Raymond West raywest@raywest.com wrote:
Didn't realise that Bos2l had to be involved.
On 23/10/2022 16:08, Adrian Mariano wrote:
Ug, no do not clone the code. Triangles and squares have orientation,
yes, and you can correctly adjust with a single block of code if you don't
want the natural thing, which would be the object simply rotated into
position.
The way that rot_copies() works in BOSL2 is that it sets $ang and $idx
which give the angle of the item and the index number of the item
respectively, so you can adjust size, angle, color, or anything you want.
Want to make objects alternate between square and circle, just check if
$idx is even.
include<BOSL2/std.scad>
zrot_copies(n=8, d=10)
if ($idx % 2) square(1,center=true);
else circle(d=1,$fn=12);
gives this:
[image: image.png]
or
include<BOSL2/std.scad>
zrot_copies(n=8, d=10)
circle(d=1+$idx/5, $fn=12);
[image: image.png]
Triangles all pointing down:
zrot_copies(n=8, d=10, subrot=false)
rot(30)circle(d=2, $fn=3);
[image: image.png]
On Sun, Oct 23, 2022 at 10:53 AM Raymond West raywest@raywest.com wrote:
Clone the code. Triangles and squares have orientation. which will need
at least another rotation, depending on which way you want them to point.
As Sanjeev said, $fn will generate triangles, or squares, but you may need
to adjust the size of the circle, and also the orientation too. But if you
just want to poke the led into a round hole, then no need to worry about
the rotate, (but if you measure the af of the square, it won't fit in the
hole, you need the diagonal. I'll leave the triangle measurement to someone
else.
On 23/10/2022 14:41, jon wrote:
I want to replace "circle(d = 0.95 * di);" on the bottom with, say,
"square(0.95 * di)" without cloning the code. My question has nothing to
deal with rotation, that I am aware. I want to pass the shape (circle or
square) in as a parameter to the module.
On 10/23/2022 9:24 AM, Sanjeev Prabhakar wrote:
Most of the time I get it wrong.
If you can share a sketch of what you want, maybe I can help in this case
(just to make sure my understanding is correct).
There is a function quaternion rotation which I normally use to rotate
various objects
On Sun, 23 Oct, 2022, 6:47 pm jon, jon@jonbondy.com wrote:
I want to create a ring of equally spaced objects. In the code below,
those objects are circles, but I would like to be able to have triangles
or squares without having to clone the code 3 times. Is there a way to
pass in the shape?
module LEDPattern(n, di) {
// circular array of "n" LEDs with diameter "di"
an = 360/n;
r = di/2 / sin(an/2);
for (a = [0:an:359])
rotate([0, 0, a])
translate([r, 0, 0])
// reduce circle sizes to keep disks from touching
circle(d = 0.95 * di);
}
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org
There's no need to involve BOSL2, but if you want to create a mechanism for
placing rotated children where you control their behavior in some
complicated way then it's convenient. I prefer not to reinvent the wheel,
but you can rewrite rot_copies() yourself if you prefer---it's easy
enough. Just set appropriate $ variables if you need them in the children.
On Sun, Oct 23, 2022 at 11:17 AM Raymond West <raywest@raywest.com> wrote:
> Didn't realise that Bos2l had to be involved.
> On 23/10/2022 16:08, Adrian Mariano wrote:
>
> Ug, no do not clone the code. Triangles and squares have orientation,
> yes, and you can correctly adjust with a single block of code if you don't
> want the natural thing, which would be the object simply rotated into
> position.
>
> The way that rot_copies() works in BOSL2 is that it sets $ang and $idx
> which give the angle of the item and the index number of the item
> respectively, so you can adjust size, angle, color, or anything you want.
> Want to make objects alternate between square and circle, just check if
> $idx is even.
>
> include<BOSL2/std.scad>
> zrot_copies(n=8, d=10)
> if ($idx % 2) square(1,center=true);
> else circle(d=1,$fn=12);
>
> gives this:
>
> [image: image.png]
>
> or
>
> include<BOSL2/std.scad>
> zrot_copies(n=8, d=10)
> circle(d=1+$idx/5, $fn=12);
>
> [image: image.png]
>
> Triangles all pointing down:
>
> zrot_copies(n=8, d=10, subrot=false)
> rot(30)circle(d=2, $fn=3);
>
> [image: image.png]
>
>
> On Sun, Oct 23, 2022 at 10:53 AM Raymond West <raywest@raywest.com> wrote:
>
>> Clone the code. Triangles and squares have orientation. which will need
>> at least another rotation, depending on which way you want them to point.
>> As Sanjeev said, $fn will generate triangles, or squares, but you may need
>> to adjust the size of the circle, and also the orientation too. But if you
>> just want to poke the led into a round hole, then no need to worry about
>> the rotate, (but if you measure the af of the square, it won't fit in the
>> hole, you need the diagonal. I'll leave the triangle measurement to someone
>> else.
>> On 23/10/2022 14:41, jon wrote:
>>
>> I want to replace "circle(d = 0.95 * di);" on the bottom with, say,
>> "square(0.95 * di)" without cloning the code. My question has nothing to
>> deal with rotation, that I am aware. I want to pass the shape (circle or
>> square) in as a parameter to the module.
>>
>>
>> On 10/23/2022 9:24 AM, Sanjeev Prabhakar wrote:
>>
>> Most of the time I get it wrong.
>>
>> If you can share a sketch of what you want, maybe I can help in this case
>> (just to make sure my understanding is correct).
>>
>> There is a function quaternion rotation which I normally use to rotate
>> various objects
>>
>>
>> On Sun, 23 Oct, 2022, 6:47 pm jon, <jon@jonbondy.com> wrote:
>>
>>> I want to create a ring of equally spaced objects. In the code below,
>>> those objects are circles, but I would like to be able to have triangles
>>> or squares without having to clone the code 3 times. Is there a way to
>>> pass in the shape?
>>>
>>> module LEDPattern(n, di) {
>>> // circular array of "n" LEDs with diameter "di"
>>> an = 360/n;
>>> r = di/2 / sin(an/2);
>>> for (a = [0:an:359])
>>> rotate([0, 0, a])
>>> translate([r, 0, 0])
>>> // reduce circle sizes to keep disks from touching
>>> circle(d = 0.95 * di);
>>> }
>>> _______________________________________________
>>> OpenSCAD mailing list
>>> To unsubscribe send an email to discuss-leave@lists.openscad.org
>>>
>>
>> _______________________________________________
>> OpenSCAD mailing list
>> To unsubscribe send an email to discuss-leave@lists.openscad.org
>>
>>
>> _______________________________________________
>> OpenSCAD mailing list
>> To unsubscribe send an email to discuss-leave@lists.openscad.org
>>
>> _______________________________________________
>> OpenSCAD mailing list
>> To unsubscribe send an email to discuss-leave@lists.openscad.org
>>
>
> _______________________________________________
> OpenSCAD mailing list
> To unsubscribe send an email to discuss-leave@lists.openscad.org
>
> _______________________________________________
> OpenSCAD mailing list
> To unsubscribe send an email to discuss-leave@lists.openscad.org
>
RW
Raymond West
Sun, Oct 23, 2022 3:53 PM
Hi Torsten,
I've used the openscad gui/editor for maybe two years or more. It was
only just now, that I found the examples under the file tab. 😅
Thanks,
Ray
On 23/10/2022 16:20, Torsten Paul wrote:
On 23.10.22 17:16, Raymond West wrote:
Didn't realise that Bos2l had to be involved.
It's the convenient way. Otherwise, just open
File -> Examples -> Advanced -> children.scad
This shows a couple of simple examples without need for any extra
dependencies.
ciao,
Torsten.
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org
Hi Torsten,
I've used the openscad gui/editor for maybe two years or more. It was
only just now, that I found the examples under the file tab. 😅
Thanks,
Ray
On 23/10/2022 16:20, Torsten Paul wrote:
> On 23.10.22 17:16, Raymond West wrote:
>> Didn't realise that Bos2l had to be involved.
>
> It's the convenient way. Otherwise, just open
>
> File -> Examples -> Advanced -> children.scad
>
> This shows a couple of simple examples without need for any extra
> dependencies.
>
> ciao,
> Torsten.
> _______________________________________________
> OpenSCAD mailing list
> To unsubscribe send an email to discuss-leave@lists.openscad.org
SP
Sanjeev Prabhakar
Sun, Oct 23, 2022 4:14 PM
Same here, never seen these examples before.
Good that you referred, these are good examples to start with
On Sun, 23 Oct, 2022, 9:24 pm Raymond West, raywest@raywest.com wrote:
Hi Torsten,
I've used the openscad gui/editor for maybe two years or more. It was
only just now, that I found the examples under the file tab. 😅
Thanks,
Ray
On 23/10/2022 16:20, Torsten Paul wrote:
On 23.10.22 17:16, Raymond West wrote:
Didn't realise that Bos2l had to be involved.
It's the convenient way. Otherwise, just open
File -> Examples -> Advanced -> children.scad
This shows a couple of simple examples without need for any extra
dependencies.
ciao,
Torsten.
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org
Same here, never seen these examples before.
Good that you referred, these are good examples to start with
On Sun, 23 Oct, 2022, 9:24 pm Raymond West, <raywest@raywest.com> wrote:
> Hi Torsten,
>
> I've used the openscad gui/editor for maybe two years or more. It was
> only just now, that I found the examples under the file tab. 😅
>
> Thanks,
>
> Ray
>
> On 23/10/2022 16:20, Torsten Paul wrote:
> > On 23.10.22 17:16, Raymond West wrote:
> >> Didn't realise that Bos2l had to be involved.
> >
> > It's the convenient way. Otherwise, just open
> >
> > File -> Examples -> Advanced -> children.scad
> >
> > This shows a couple of simple examples without need for any extra
> > dependencies.
> >
> > ciao,
> > Torsten.
> > _______________________________________________
> > OpenSCAD mailing list
> > To unsubscribe send an email to discuss-leave@lists.openscad.org
> _______________________________________________
> OpenSCAD mailing list
> To unsubscribe send an email to discuss-leave@lists.openscad.org
>
JB
Jordan Brown
Mon, Oct 24, 2022 12:47 AM
Use children().
module LEDPattern(n, di) {
// circular array of "n" LEDs with diameter "di"
an = 360/n;
r = di/2 / sin(an/2);
for (a = [0:an:359])
rotate([0, 0, a])
translate([r, 0, 0])
children();
}
// reduce circle sizes to keep disks from touching
LEDPattern(10, 50) circle(d = 0.95 * di);
LEDPattern(10, 50) square(10, center=true);
LEDPattern(10, 50) text("A", halign="center", valign="center");
Use appropriate values for n and di, of course.
Use children().
module LEDPattern(n, di) {
// circular array of "n" LEDs with diameter "di"
an = 360/n;
r = di/2 / sin(an/2);
for (a = [0:an:359])
rotate([0, 0, a])
translate([r, 0, 0])
children();
}
// reduce circle sizes to keep disks from touching
LEDPattern(10, 50) circle(d = 0.95 * di);
LEDPattern(10, 50) square(10, center=true);
LEDPattern(10, 50) text("A", halign="center", valign="center");
Use appropriate values for n and di, of course.
MM
Michael Marx
Mon, Oct 24, 2022 2:06 AM
You need dynamic variables:
module LEDPattern(n, $di) {
// circular array of "n" LEDs with diameter "$di"
an = 360/n;
r = $di/2 / sin(an/2);
for ($a = [0:an:359])
rotate([0, 0, $a])
translate([r, 0, 0])
children();
}
// reduce circle sizes to keep disks from touching
//LEDPattern(10, 50) circle(d = 0.95 * $di);
//LEDPattern(10, 50) square(10, center=true);
LEDPattern(10, 50) text(str($a), halign="center", valign="center");
From: Jordan Brown [mailto:openscad@jordan.maileater.net]
Sent: Mon, 24 Oct 2022 11:48
To: OpenSCAD general discussion Mailing-list; jon
Subject: [OpenSCAD] Re: circular array of arbitrary shapes
Use children().
module LEDPattern(n, di) {
// circular array of "n" LEDs with diameter "di"
an = 360/n;
r = di/2 / sin(an/2);
for (a = [0:an:359])
rotate([0, 0, a])
translate([r, 0, 0])
children();
}
// reduce circle sizes to keep disks from touching
LEDPattern(10, 50) circle(d = 0.95 * di);
LEDPattern(10, 50) square(10, center=true);
LEDPattern(10, 50) text("A", halign="center", valign="center");
Use appropriate values for n and di, of course.
--
This email has been checked for viruses by AVG antivirus software.
www.avg.com
You need dynamic variables:
module LEDPattern(n, $di) {
// circular array of "n" LEDs with diameter "$di"
an = 360/n;
r = $di/2 / sin(an/2);
for ($a = [0:an:359])
rotate([0, 0, $a])
translate([r, 0, 0])
children();
}
// reduce circle sizes to keep disks from touching
//LEDPattern(10, 50) circle(d = 0.95 * $di);
//LEDPattern(10, 50) square(10, center=true);
LEDPattern(10, 50) text(str($a), halign="center", valign="center");
_____
From: Jordan Brown [mailto:openscad@jordan.maileater.net]
Sent: Mon, 24 Oct 2022 11:48
To: OpenSCAD general discussion Mailing-list; jon
Subject: [OpenSCAD] Re: circular array of arbitrary shapes
Use children().
module LEDPattern(n, di) {
// circular array of "n" LEDs with diameter "di"
an = 360/n;
r = di/2 / sin(an/2);
for (a = [0:an:359])
rotate([0, 0, a])
translate([r, 0, 0])
children();
}
// reduce circle sizes to keep disks from touching
LEDPattern(10, 50) circle(d = 0.95 * di);
LEDPattern(10, 50) square(10, center=true);
LEDPattern(10, 50) text("A", halign="center", valign="center");
Use appropriate values for n and di, of course.
--
This email has been checked for viruses by AVG antivirus software.
www.avg.com
JB
Jordan Brown
Mon, Oct 24, 2022 4:12 AM
On 10/23/2022 7:06 PM, Michael Marx wrote:
You need dynamic variables:
Oh, yes, thanks, I missed that the circle was dependent on the
LEDPattern arguments.
Or the children could get those values from directly from their context.
I know better than to give examples that I haven't tested, really I do :-)
module LEDPattern(n, $di) {
// circular array of "n" LEDs with diameter "$di"
an = 360/n;
r = $di/2 / sin(an/2);
for ($a = [0:an:359])
rotate([0, 0, $a])
translate([r, 0, 0])
children();
}
// reduce circle sizes to keep disks from touching
//LEDPattern(10, 50) circle(d = 0.95 * $di);
//LEDPattern(10, 50) square(10, center=true);
LEDPattern(10, 50) text(str($a), halign="center", valign="center");
*From:*Jordan Brown [mailto:openscad@jordan.maileater.net]
Sent: Mon, 24 Oct 2022 11:48
To: OpenSCAD general discussion Mailing-list; jon
Subject: [OpenSCAD] Re: circular array of arbitrary shapes
Use children().
module LEDPattern(n, di) {
// circular array of "n" LEDs with diameter "di"
an = 360/n;
r = di/2 / sin(an/2);
for (a = [0:an:359])
rotate([0, 0, a])
translate([r, 0, 0])
children();
}
// reduce circle sizes to keep disks from touching
LEDPattern(10, 50) circle(d = 0.95 * di);
LEDPattern(10, 50) square(10, center=true);
LEDPattern(10, 50) text("A", halign="center", valign="center");
Use appropriate values for n and di, of course.
width=
http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient
Virus-free.www.avg.com
http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org
On 10/23/2022 7:06 PM, Michael Marx wrote:
>
> You need dynamic variables:
>
Oh, yes, thanks, I missed that the circle was dependent on the
LEDPattern arguments.
Or the children could get those values from directly from their context.
I know better than to give examples that I haven't tested, really I do :-)
>
>
> module LEDPattern(n, $di) {
>
> // circular array of "n" LEDs with diameter "$di"
>
> an = 360/n;
>
> r = $di/2 / sin(an/2);
>
> for ($a = [0:an:359])
>
> rotate([0, 0, $a])
>
> translate([r, 0, 0])
>
> children();
>
> }
>
>
>
> // reduce circle sizes to keep disks from touching
>
> //LEDPattern(10, 50) circle(d = 0.95 * $di);
>
>
>
> //LEDPattern(10, 50) square(10, center=true);
>
>
>
> LEDPattern(10, 50) text(str($a), halign="center", valign="center");
>
>
>
> ------------------------------------------------------------------------
>
> *From:*Jordan Brown [mailto:openscad@jordan.maileater.net]
> *Sent:* Mon, 24 Oct 2022 11:48
> *To:* OpenSCAD general discussion Mailing-list; jon
> *Subject:* [OpenSCAD] Re: circular array of arbitrary shapes
>
>
>
> Use children().
>
> module LEDPattern(n, di) {
> // circular array of "n" LEDs with diameter "di"
> an = 360/n;
> r = di/2 / sin(an/2);
> for (a = [0:an:359])
> rotate([0, 0, a])
> translate([r, 0, 0])
> children();
> }
>
> // reduce circle sizes to keep disks from touching
> LEDPattern(10, 50) circle(d = 0.95 * di);
>
> LEDPattern(10, 50) square(10, center=true);
>
> LEDPattern(10, 50) text("A", halign="center", valign="center");
>
> Use appropriate values for n and di, of course.
>
>
>
>
> width=
> <http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient>
> Virus-free.www.avg.com
> <http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient>
>
>
> <#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
>
> _______________________________________________
> OpenSCAD mailing list
> To unsubscribe send an email to discuss-leave@lists.openscad.org