+module HexGrid(xa,xb,ya,yb) {
+ imin = floor(xa / holepitch);
+ imax = ceil(xb / holepitch);
+ jmin = floor(ya / (sqrt(3)*holepitch));
+ jmax = ceil(yb / (sqrt(3)*holepitch));
+ echo("HexGrid ",imin,imax,jmin,jmax);
+ for (i=[imin:imax]) {
+ for (j=[jmin:jmax]) {
+ translate([(j * sqrt(3) + holeoffx) * holepitch,
+ (i + 0.5 + holeoffy) * holepitch,
+ 0]) {
+ child();
+ translate([sqrt(3)/2 * holepitch, -0.5 * holepitch, 0])
+ child();
+ }
+ }
+ }
+}
+