discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Arrange cylinders in circle like barrels of a gatling gun

E
Experimentalist
Wed, Oct 17, 2018 10:36 PM

Hi

Can anyone help me with some code to arrange cylinders equidistant around a
circle, much like the arrangement of barrels on a gatling gun. I want to use
these to cut holes in a box lid using difference.

I am sure it is simple but I am unsure of how to go about it

Thanks for looking

Ex.

--
Sent from: http://forum.openscad.org/

Hi Can anyone help me with some code to arrange cylinders equidistant around a circle, much like the arrangement of barrels on a gatling gun. I want to use these to cut holes in a box lid using difference. I am sure it is simple but I am unsure of how to go about it Thanks for looking Ex. -- Sent from: http://forum.openscad.org/
S
shadowwynd
Wed, Oct 17, 2018 11:00 PM

count = 8;
outer_r = 40;
cyl_d = 20;
cyl_h = 30;

for (i=[0:360/count:359])
{
rotate ([0, 0, i])
translate ([outer_r, 0, 0])
cylinder (d=cyl_d, h=cyl_h);

}

--
Sent from: http://forum.openscad.org/

count = 8; outer_r = 40; cyl_d = 20; cyl_h = 30; for (i=[0:360/count:359]) { rotate ([0, 0, i]) translate ([outer_r, 0, 0]) cylinder (d=cyl_d, h=cyl_h); } -- Sent from: http://forum.openscad.org/
E
Experimentalist
Thu, Oct 18, 2018 6:30 AM

Perfect, thanks. As ever its easy when you know how :0)

--
Sent from: http://forum.openscad.org/

Perfect, thanks. As ever its easy when you know how :0) -- Sent from: http://forum.openscad.org/