// secret nut adapter for my subaru impreza (not model, real car :))

spacing = 0.25;
hexagon_size = 19;
hexagon_height = 20;
inner_circle_dia = 15;
outer_circle_inner_dia = 22;
secret_hexagon_solid_spacing = 4;
secret_depth = 13;

module sekretka(extent) {
union() {
  translate([0, 0, -3])
    cylinder(r=inner_circle_dia/2+extent, h=secret_depth+3, $fn=200);
  for (i = [0, 45, 90, 135, 180, 225, 292.5]) {
    rotate([0, 0, i])
    hull() {
      translate([0, -2.5/2, 0]) cube([inner_circle_dia/2+1+extent, 2.5, secret_depth]);
      translate([0, -4.5/2, 0]) cube([inner_circle_dia/2-0.5+extent, 4.5, secret_depth]);
    }
  }
  translate([0, 0, -4])
  difference() {
    cylinder(r=outer_circle_inner_dia/2+2, h=secret_depth+4, $fn=200);
    translate([0, 0, 4]) cylinder(r=outer_circle_inner_dia/2-extent, h=16, $fn=200);
  }
}
}

/*difference() {
  adapter();
  //sekretka(0.25);
  translate([0, -20, -1]) cube(size=[20, 40, 40]);
}*/

module adapter() {
  union() {
    translate([0, 0, secret_depth+secret_hexagon_solid_spacing]) cylinder(r=hexagon_size/2/sin(60), h=hexagon_height, $fn=6);
    difference() {
      translate([0, 0, -1]) cylinder(r=outer_circle_inner_dia/2-spacing, h=secret_depth+secret_hexagon_solid_spacing+1, $fn=200);
      sekretka(spacing);
    }
  }
}

projection(cut = true)
  translate([0, 0, -1])
  adapter();

projection(cut = true)
  translate([25, 0, -secret_depth-secret_hexagon_solid_spacing-1])
  adapter();

projection(cut = false)
  translate([50, 0, 0])
  adapter();

projection(cut = false)
  translate([-25, secret_depth+secret_hexagon_solid_spacing, 0])
  rotate([90, 90, 0])
  adapter();

projection(cut = true)
  translate([-50, secret_depth+secret_hexagon_solid_spacing, 0])
  rotate([90, 90, 0])
  adapter();
