Fix deprecated assign() and refactor test_polyholes() module.

This commit is contained in:
Doug Hawkins 2020-03-25 21:45:31 -06:00
parent 60aa3794d2
commit ca485087cd

View file

@ -3,24 +3,21 @@
// Using this holes should come out approximately right when printed // Using this holes should come out approximately right when printed
module polyhole(h, d) { module polyhole(h, d) {
n = max(round(2 * d),3); n = max(round(2 * d),3);
rotate([0,0,180]) rotate([0,0,180])
cylinder(h = h, r = (d / 2) / cos (180 / n), $fn = n); cylinder(h = h, r = (d / 2) / cos (180 / n), $fn = n);
} }
module test_polyhole(){ module test_polyhole(){
difference() { difference() {
cube(size = [100,27,3]); cube(size = [100,27,3]);
union() { for(i = [1:10]) {
for(i = [1:10]) { translate([(i * i + i)/2 + 3 * i , 8,-1])
translate([(i * i + i)/2 + 3 * i , 8,-1]) polyhole(h = 5, d = i);
polyhole(h = 5, d = i); d = i + 0.5;
translate([(d * d + d)/2 + 3 * d, 19,-1])
assign(d = i + 0.5) polyhole(h = 5, d = d);
translate([(d * d + d)/2 + 3 * d, 19,-1]) }
polyhole(h = 5, d = d); }
}
}
}
} }