+ cube([recessblockwidth, recessblockheight, totaldepth]);
+ }
+}
+
+module Peg(){
+ echo("peg angle slope (must be <1)",
+ (peghead-pegstem)/(pegheight-pegstemheight));
+ dx = pegsloph;
+ dy = pegslopv;
+ rotate([90,0,0]) {
+ linear_extrude(height=peglen-pegslopl) {
+ intersection(){
+ translate([-dx,-dy,0]) PegTemplate(0);
+ translate([-dx,+dy,0]) PegTemplate(0);
+ translate([+dx,+dy,0]) PegTemplate(0);
+ translate([+dx,-dy,0]) PegTemplate(0);
+ }
+ }
+ }
+}
+
+module CoverPegSlot(coverlen){
+ translate([recessblockwidth/2, 0, -1]){
+ linear_extrude(height= 1 + pegrecess + 0.5*peglen){
+ PegTemplate(0);
+ }
+ }
+}
+
+module HoleRow(){
+ for (i=[0:10]) {
+ translate([0, (i+0.5)*holepitch, -1])
+ cylinder(r=holesize/2, h=coverthick+2, $fn=20);
+ }
+}
+
+module HolesScope(){
+ intersection_for (dx=[-1,+1]) {
+ intersection_for (dy=[-1,+1]) {
+ translate([dx * holeedge, dy * holeedge, -1])
+ scale([1,1,2])
+ CoverTemplate();
+ }
+ }
+}
+
+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();
+ }
+ }
+ }
+ HolesScope();
+ }
+}
+
+module CoverCover(){
+ difference(){
+ CoverTemplate();
+ Holes();
+ }