peg_size = 11;
base_size = 60;

base_thickness = 5;
peg_length = 50;

length = 70/2;

include <BOSL2/std.scad>
include <BOSL2/joiners.scad>

module dovetail_cutsom() {
  dovetail("male", width=15, height=3, slide=base_size, angle=20, taper=2);
}

difference() {
  union(){
    cylinder(h=base_thickness, d=base_size);
    translate([0,0,base_thickness]) cylinder(h=peg_length, d=peg_size);
  }
  dovetail_cutsom();
}

right(50) union() {
  dovetail_cutsom();
  rotate([0,0,180]) translate([0,base_size, 0]) dovetail_cutsom();
}

right(80) difference() {
  // translate([0,0,2.5]) cube([20,60,3.5], center=true);
  translate([0,0,1.5]) cube([20,50,6], center=true);
  dovetail_cutsom();
}

cap_h = 5;
cap_hole_h = 3;
cap_d = 20;

hole_tolerance = 0.7;

right(110) difference() {
  cylinder(d=cap_d, h=cap_h);
  translate([0,0,cap_h - cap_hole_h]) cylinder(d=peg_size + hole_tolerance, h=cap_h, $fn=8);
}