-module Holes(){
- intersection(){
- translate([holeoffx * holepitch, holeoffy * holepitch, 0]) {
- for (i=[-10:10]) {
- translate([i * sqrt(3) * holepitch, 0, 0]) {
- HoleRow();
- translate([sqrt(3)/2 * holepitch, -0.5 * holepitch, 0])
- HoleRow();
- }
+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();