Support center attribute so that polyhole behaves a bit more like cylinder()

This commit is contained in:
Joseph Lenox 2020-01-04 21:37:38 -06:00
parent b21ef47a55
commit 4d67b1a725

View file

@ -2,10 +2,10 @@
// This file is licensed under the terms of Creative Commons Attribution 3.0 Unported. // This file is licensed under the terms of Creative Commons Attribution 3.0 Unported.
// 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, center=false) {
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, center=center);
} }
module test_polyhole(){ module test_polyhole(){