include ; CUTOUT_DEPTH = 10; module cutout(h,d,c,k) { polygon([ [h/-2-c-1,1], [h/2+c+1,1], [h/2-k,-c], [h/2-k,-d], [h/-2+k,-d], [h/-2+k,-c] ]); /*polygon([ [h/-2+h*.15,0], [h/-2+h*.15,-2], [h/-2+k,-2], [h/-2+k,-d+1], [h/-2+k+1,-d], [h/2-k-1,-d], [h/2-k,-d+1], [h/2-k,-2], [h/2-h*.15,-2], [h/2-h*.15,0] ]); translate([h/-2-4,0,0]) polygon([ [-.1,0], [-.1,-d], [.5,-d+1], [.5,0] ]); translate([h/2+4,0,0]) polygon([ [-.5,0], [-.5,-d+1], [.1,-d], [.1,0] ]); translate([0,-d-2,0]) square([h-k,2-k],center=true);*/ } module kit_connector(w,h,c,k,n) { difference() { convex_polygon(w,n); // Use pythagorian theorom to find the // distance between polygon points a = sqrt( pow(-w*sin(360/n),2) + pow(w-(w*cos(360/n)),2) ); // Calculate the distance between the origin // and halfway between two points b = sqrt(pow(w,2) - pow(a/2,2)); // Subtract the cutout from each side of the polygon for ( i = [1:n] ) { translate([b*sin(i*(360/n)),b*cos(i*(360/n))]) rotate([0,0,i*(360/-n)]) cutout(h,CUTOUT_DEPTH,c,k); } } } module kit_plate(d,xn,yn,c,k) { difference() { square([d[0],d[1]],center=true); for ( i = [1:yn] ) { translate([(d[0]/-2)+(i*(d[0]/(yn+1))),d[1]/2,0]) cutout(d[2],CUTOUT_DEPTH,c,k); translate([(d[0]/-2)+(i*(d[0]/(yn+1))),d[1]/-2,0]) rotate([0,0,180]) cutout(d[2],CUTOUT_DEPTH,c,k); } for ( i = [1:xn] ) { translate([d[0]/-2,(d[1]/2)-(i*(d[1]/(xn+1))),0]) rotate([0,0,90]) cutout(d[2],CUTOUT_DEPTH,c,k); translate([d[0]/2,(d[1]/2)-(i*(d[1]/(xn+1))),0]) rotate([0,0,-90]) cutout(d[2],CUTOUT_DEPTH,c,k); } } }