// Plastikowa wkładka do krzesła biurowego
include <BOSL2/std.scad>

// część wewnętrzna
in_width = 17.7;
in_width2 = 17.0;
in_length = 30;
in_h=36.9; // including the half-circle
in_h2=36.0;

in_hole_d=10.0;
in_hole_dist = 13; // hole distance from the end cap
in_hole_h = 20 + 5; // +5 for clearance

// część zewnętrzna
out_t = 5;
out_d = 10;

out_width = in_width + out_t;
out_h = in_h + out_t;

$fn=360;

// model
// wnętrze
difference() {
  union() {
    cube([in_width2, in_length, in_h2-in_width2/2]);
    translate([in_width2/2,0,in_h2-in_width2/2]) rotate([-90,0,0])
      cylinder(d=in_width2, h=in_length);
  }
  translate([in_width2/2,in_hole_dist,-0.1]) cylinder(d=in_hole_d, h=in_hole_h);
}
// zewnątrz
translate([out_width/2 - out_t/2,0,(out_h-out_width/2)/2 - out_t/2])
  union() {
  cuboid([out_width,5,out_h-out_width/2], chamfer=1);
  translate([0,0,out_h/2-out_width/4]) rotate([90,0,0])
    cyl(d=out_width, h=out_t, chamfer=1);
}