--- /dev/null
+eps = 0.01;
+
+board_screw_w = 101.85;
+board_screw_h = 76.3;
+board_zoff = 10;
+board_screw_supp = 3;
+board_screw_d = 2.5;
+board_sep = 5; // realne je 4 mm na kazdou stranu
+board_sep2 = 14; // na strane kabelu vic mista
+thin_wall = 1.5;
+box_z = 40;
+box_w = board_screw_w + board_sep + board_sep2 + 2*thin_wall;
+box_h = board_screw_h + 2*board_sep + 2*thin_wall;
+
+screw_support_in = 5;
+
+clip_w = 14;
+clip_h = 4;
+screw_d = 5;
+screw_head_d = 10;
+
+x_cable_xoff = 35;
+cable_ext = 8;
+cable_wall = 2;
+cable_top = 6;
+cable_d = 10;
+nylon_d = 3;
+
+y_cable_yoff = 70;
+y_cable_rot = 60;
+y_cable_xoff = box_w + 3;
+
+cable_back = 20; // keep space for rotating it
+
+module extrusion_clip(width, thick) {
+ difference() {
+ union() {
+ cube([20, width, thick]);
+ hull() {
+ translate([6, 0, 0]) cube([8, width, thick]);
+ translate([7, 0, 0]) cube([6, width, thick+1.5]);
+ }
+ }
+ translate([10, width/2, -eps])
+ cylinder(r = screw_d/2, h = thick+1.5+2*eps, $fn = 6);
+ }
+}
+
+module cable_inlet() {
+ hull() {
+ translate([-cable_d/2, -cable_back, 0])
+ cube([cable_d/2, cable_back*0.8, box_z]);
+ translate([-cable_d/2-cable_top, -cable_back,
+ box_z - cable_wall - cable_d])
+ cube([cable_d + 2*cable_top, cable_back+cable_ext,
+ cable_d+cable_wall]);
+ }
+}
+
+module cable_inlet_hole() {
+ translate([-cable_d/2, -cable_back-eps, box_z-cable_d])
+ cube([cable_d, cable_back + cable_ext + 2*eps, cable_d+eps]);
+ translate([0, -cable_back-eps, box_z-cable_d-cable_wall - nylon_d/2])
+ rotate([-90, 0, 0])
+ cylinder(r = nylon_d/2, h = cable_ext + cable_back + 2*eps,
+ $fn = 6);
+ for (x = [-1, 1]) scale([x, 1, 1])
+ translate([cable_d/2 + cable_top/2, cable_ext/2, box_z - cable_d])
+ rotate([0, 0, 90])
+ cylinder(r = board_screw_d/2, h = cable_d + eps, $fn = 6);
+}
+
+difference() {
+ union() {
+ cube([box_w, box_h, box_z]);
+ translate([-20, 0, 0]) extrusion_clip(clip_w, clip_h);
+ translate([clip_h, box_h, clip_h])
+ rotate([0, -90, 0]) extrusion_clip(clip_w, clip_h);
+ // side beam
+ hull() {
+ translate([eps, 0, 6+clip_h]) cube([eps, box_h, 8]);
+ translate([-1.5, 0, 7+clip_h]) cube([1.5, box_h, 6]);
+ }
+
+ // top strut
+ hull() {
+ translate([0, box_h, 0]) cube([clip_h, clip_w, clip_h]);
+ translate([box_w-eps, box_h, 0]) cube([eps, eps, clip_h]);
+ }
+ // x cable
+ translate([x_cable_xoff, box_h, 0])
+ cable_inlet();
+ // y cable
+ translate([y_cable_xoff, y_cable_yoff, 0])
+ rotate([0, 0, -y_cable_rot])
+ cable_inlet();
+ }
+
+ // board base
+ translate([thin_wall, thin_wall, board_zoff])
+ cube([box_w - 2*thin_wall, box_h - 2*thin_wall, box_z]);
+ // board screw supports
+ translate([thin_wall, thin_wall+board_sep+screw_support_in,
+ board_zoff - board_screw_supp])
+ cube([box_w - 2*thin_wall,
+ board_screw_h - 2*screw_support_in, box_z]);
+ translate([thin_wall+board_sep+screw_support_in, thin_wall,
+ board_zoff - board_screw_supp])
+ cube([board_screw_w - 2*screw_support_in,
+ box_h - 2*thin_wall, box_z]);
+ // inner hole
+ translate([thin_wall+board_sep+screw_support_in,
+ thin_wall+board_sep+screw_support_in, thin_wall])
+ cube([board_screw_w - 2*screw_support_in,
+ board_screw_h - 2*screw_support_in, box_z]);
+
+ // ribs in the back side
+ let (
+ hole_min_w = 4,
+ rib_w = 2,
+ holes = floor((board_screw_w - 2*screw_support_in + rib_w)/(hole_min_w+rib_w)),
+ hole_w = (board_screw_w - 2*screw_support_in + rib_w)/holes - rib_w
+ )
+ for (i = [0:1:holes-1]) {
+ translate([thin_wall+board_sep+screw_support_in
+ + i*(hole_w+rib_w), thin_wall+board_sep+screw_support_in, -eps])
+ cube([hole_w, box_h-2*board_sep-2*thin_wall-2*screw_support_in, thin_wall+2*eps]);
+ }
+ // holes in the bottom side
+ let (
+ hole_min_w = 10,
+ rib_w = 8,
+ hole_zoff = 15,
+ hole_h = 15,
+ holes = floor((box_w - 6*thin_wall)/(hole_min_w+rib_w)),
+ hole_w = (box_w - 6*thin_wall + rib_w)/holes - rib_w
+ )
+ for (i = [0:1:holes-1]) {
+ translate([3*thin_wall + i*(hole_w+rib_w), -eps, hole_zoff])
+ cube([hole_w, thin_wall + 2*eps, hole_h]);
+ }
+
+ // screw holes
+ for (x = [0, 1]) for (y = [0, 1])
+ translate([thin_wall+board_sep + x*board_screw_w,
+ thin_wall+board_sep + y*board_screw_h,
+ thin_wall])
+ cylinder(r = board_screw_d/2, h = box_z, $fn = 6);
+
+ // usb slot
+ translate([thin_wall + board_sep + 69.5, box_h - thin_wall - eps,
+ board_zoff + 1])
+ cube([14, thin_wall+2*eps, 11]);
+ // microsd slot
+ translate([thin_wall + board_sep + 48, box_h - thin_wall - eps,
+ board_zoff + 1])
+ cube([16, thin_wall+2*eps, 4]);
+ // x cable hole
+ translate([x_cable_xoff, box_h, 0])
+ cable_inlet_hole();
+
+ // y cable hole
+ translate([y_cable_xoff, y_cable_yoff, 0])
+ rotate([0, 0, -y_cable_rot])
+ cable_inlet_hole();
+}
+