# Creating a 'plate' with evenly spaced holes

Posted by Cougar281
 Creating a 'plate' with evenly spaced holes August 23, 2019 01:23PM Registered: 6 years ago Posts: 52
I need to create a 'plate' with six holes, evenly spaced every 60*. I've gotten a lot further than I expected to, considering how little I know about OpenSCAD, but with the code below, I got to a real beginning and basic version of what I need. Now for the hard part (for me). The six holes need to be further out and need to remain evenly spaced. Right this moment, I don't know exactly how big it'll actually need to be or exactly where the holes need to be other than evenly spaced around the plate, so I will end up needing to adjust the size. The way it's created now, I'd need to figure out exactly where to place each hole on the 'plate' using specific X/Y/Z coordinates if (when) I need to scale its diameter up or down and move the holes in or out from center. Changing the diameter of the plate or the diameter of the hole in the middle are both easy, as well as moving the two holes on the X axis and changing their diameters - the other four become the challenge. Is there some way it can be done so that I can change a variable and it'll move them in or out from the center, keeping them spaced 60* apart?

```\$fn=128;
difference () {

for(i=[0:2])
cylinder(r=89,h=10);

for(i=[0:2])
translate([0,0,-1])
cylinder(r=19,h=12);

translate([37,0,-1])
cylinder(r=9, h=12);
translate([-37,0,-1])
cylinder(r=9, h=12);
translate([-19,33,-1])
cylinder(r=9, h=12);
translate([19,33,-1])
cylinder(r=9, h=12);
translate([-19,-33,-1])
cylinder(r=9, h=12);
translate([19,-33,-1])
cylinder(r=9, h=12);
}
```
 Re: Creating a 'plate' with evenly spaced holes August 23, 2019 10:37PM Admin Registered: 13 years ago Posts: 7,079
Try this.

I prefer diameters vs radius, and for holes I use a trick that doubles the height and lowers it by half the height. No need to randomly add heights

```OutsideDiameter = 89 * 2;
InsideDiameter = 19 *2;
height = 10;
HoleOD = 9*2;
NumberOfHoles = 6;
HoleDisatnceFromCenter = 37;

\$fn=128;
difference () {

cylinder(d=OutsideDiameter,h=height);
translate([0,0,-height/2]) cylinder(d=InsideDiameter,h=height*2);

for (i = [0:1:NumberOfHoles-1]) {
rotate([0,0,i*360/NumberOfHoles]) translate([HoleDisatnceFromCenter,0,-height/2]) cylinder(d=HoleOD, h=height*2);

}
}```

Edited 3 time(s). Last edit at 08/23/2019 11:19PM by Dust.
 Re: Creating a 'plate' with evenly spaced holes August 24, 2019 10:26AM Registered: 6 years ago Posts: 52
That is perfect! Thank You!

The code I had cobbled together was a combination of a part that I had made to replace rollers on my nieces futon and a 'sheriff's badge' I had found on Thingiverse. It got it started, and with enough tinkering, it probably could have been made to work, but I figured there had to be a better way to do it.
Sorry, only registered users may post in this forum.