include <../config/terminal_mount.scad> module terminal_mount_object() { size = terminal_mount_size; thickness = terminal_mount_thickness; screw = terminal_mount_screw; screw_mount = screw + thickness * 2; module mount_shape() { union() { move_y = size.y / 2 / 3; move_x = size.x / 2 / 3; translate([0, move_y + size.y / 3 - screw_mount / 2]) { square([size.x, screw_mount], center = true); } translate([0, -move_y]) { square([size.x, screw_mount], center = true); } translate([move_x, 0]) { square([screw_mount, size.y], center = true); } translate([-move_x, 0]) { square([screw_mount, size.y], center = true); } } } module mount_object() { linear_extrude(height = thickness, center = true) { mount_shape(); } } module screw_mounting() { module bottom() { union() { circle(d = screw_mount); translate([-screw_mount / 4, 0]) { square([screw_mount / 2, screw_mount], center = true); } } } module bottom_object() { linear_extrude(height = size.z + thickness, center = true) { bottom(); } } module drop() { full_size = size.z + thickness; hull() { translate([0, 0, full_size / 2 + 5 / 2]) { linear_extrude(height = 5, center = true) { square([screw_mount, screw_mount], center = true); } } move_z = -(full_size / 2 - thickness + 1 / $fn / 2); move_x = screw_mount / 2 - 1 / $fn / 2; translate([move_x, 0, move_z]) { linear_extrude(height = 1 / $fn, center = true) { square([1 / $fn, screw_mount], center = true); } } } } module screw_difference() { union() { cylinder(d = screw, h = size.z + thickness, center = true); hull_height = screw / 2; hull_move_z = hull_height / 2 - (size.z + thickness) / 2 + thickness; translate([0, 0, hull_move_z]) { cylinder( d2 = screw * 2, d1 = screw, h = hull_height, center = true ); } second_height = size.z - hull_height; second_move_z = second_height / 2 - (size.z + thickness) / 2 + thickness + hull_height; translate([0, 0, second_move_z]) { cylinder(d = screw * 2, h = second_height, center = true); } } } render() { difference() { bottom_object(); drop(); screw_difference(); } } } module screws() { bottom_y = -size.y / 2 - screw_mount / 2; bottom_x = -size.x / 2 / 3; top_x = size.x / 2 + screw_mount / 2; top_y = size.y / 2 / 3 + size.y / 3 - screw_mount / 2; middle_x = size.x / 2 + screw_mount / 2; middle_y = -size.y / 2 / 3; translate([bottom_x, bottom_y, 0]) { rotate(270) { screw_mounting(); } } translate([-bottom_x, bottom_y, 0]) { rotate(270) { screw_mounting(); } } translate([top_x, top_y, 0]) { rotate(0) { screw_mounting(); } } translate([-top_x, top_y, 0]) { rotate(180) { screw_mounting(); } } translate([middle_x, middle_y, 0]) { rotate(0) { screw_mounting(); } } translate([-middle_x, middle_y, 0]) { rotate(180) { screw_mounting(); } } } module result() { translate([0, 0, size.z / 2]) { mount_object(); } screws(); } color("#005522") { render() { result(); } } }