diff --git a/src/common.scad b/src/common.scad index 5113437..a80f0e7 100644 --- a/src/common.scad +++ b/src/common.scad @@ -9,3 +9,5 @@ module cubi(s, fillet=0, edges=EDGES_ALL) { } } +function vec_sum(v, w) = [v.x + w.x, v.y + w.y, v.z + w.z]; + diff --git a/src/harness.scad b/src/harness.scad index 97c39ed..084c6f8 100644 --- a/src/harness.scad +++ b/src/harness.scad @@ -395,7 +395,7 @@ module phone_harness() { } module model() { - up(get_platform_size().z + get_harness_size().z/2) phone_harness(); + up(get_harness_size().z/2) phone_harness(); } if (!is_undef(validation)) { diff --git a/src/platform.scad b/src/platform.scad index 95ae8d8..cb368cc 100644 --- a/src/platform.scad +++ b/src/platform.scad @@ -1,4 +1,6 @@ include +//export=MODEL_PLATFORM_HARNESS; +//export=MODEL_PLATFORM_STRAP; // dependency: https://github.com/revarbat/BOSL include @@ -10,6 +12,7 @@ use use use +use use use @@ -33,21 +36,109 @@ module model_prop_arm() { // <<< // Blocks: +module lock_pin(groove) { + slack=groove + ?[1, 0.5, 0.3] + :[0, 0, 0]; + pin_size=get_platform_lock_pin_size(); + size=vec_sum(pin_size, slack); + down(size.z/2) + translate([slack.x/2, slack.y/2, slack.z/2]) + xrot(-4) zrot(-90) right_triangle([size.y, size.x, size.z]); +} +module lock_arm() { + size=get_platform_lock_arm_size(); + down(get_platform_top_size().z) back(size.y/2) right(size.x/2) cube(size, center=true); + joiner_size=[get_platform_lock_pin_size().x, size.y, get_platform_top_size().z]; + translate([joiner_size.x/2, joiner_size.y/2, -joiner_size.z/2 + size.z/2]) cube(joiner_size, center=true); +} +module lock_mechanism_button(groove=false) { + button_size=groove + ?[10,5] + :[7,4.5]; + size=[button_size.x, get_platform_wall()*7, button_size.y]; + translate([get_platform_lock_pin_size().x*1.5, -get_platform_size().y/2+size.y*1.3, -get_platform_size().z/2]) + cube(size, center=true); +} +module lock_buttons_cutout() { + module cutout_side(groove) { + translate(get_platform_lock_pin_pos()) lock_mechanism_button(groove=true); + } + cutout_side(); + scale([1, -1, 1]) cutout_side(); +} +module lock_mechanism() { + lock_pin(groove=false); + lock_arm(); + lock_mechanism_button(); +} +module lock_socket() { + pin_size=get_platform_lock_pin_size(); + size=[pin_size.x, pin_size.y, pin_size.z]; + module socket_connector() { + conn_size=[pin_size.x+4, get_platform_wall()*3, get_platform_top_size().z]; + up(pin_size.z/2) fwd(pin_size.y+conn_size.y/2) right(pin_size.x/2) { + prismoid(size1=[conn_size.x, conn_size.y], size2=[conn_size.x, conn_size.y-2], shift=[0, -1], h=conn_size.z/2); + down(conn_size.z/4) cube([conn_size.x, conn_size.y, conn_size.z/2], center=true); + } + } + down(pin_size.z) + translate(get_platform_lock_pin_pos()) { + fwd(pin_size.y) scale([1, -1, -1]) lock_pin(); + socket_connector(); + } +} +module platform_locks_pins() { + platform_size=get_platform_size(); + lock_pin_size=get_platform_lock_pin_size(); + module lock_side(groove) { + translate(get_platform_lock_pin_pos()) lock_mechanism(); + } + lock_side(); + scale([1, -1, 1]) lock_side(); +} +module platform_locks_sockets() { + lock_socket(); + scale([1, -1, 1]) lock_socket(); +} module platform(base) { size=get_platform_size(); + base_size=size; + wall=get_platform_wall(); + top_size=get_platform_top_size(); top=!base; - up(top?size.z:0) - color(top?"Olive":"YellowGreen") - cube(size, center=true); + module base_platform() { + module base_platform_core() { + braced_thinning_wall(h=size.y, l=size.x, thick=size.z, wall=0, strut=wall, orient=ORIENT_X_90); + } + + difference() { + base_platform_core(); + translate(get_platform_top_pos()) down(top_size.z/2) prismoid(size1=[top_size.x,top_size.y], size2=[base_size.x-2,base_size.y-2], h=top_size.z); + lock_buttons_cutout(); + } + } + module top_platform() { + up((base_size.z-top_size.z)/2) + braced_thinning_wall(h=top_size.y, l=top_size.x, thick=top_size.z, wall=0, strut=wall/4, orient=ORIENT_X_90); + } + module strap_connectors() { - down(size.z/2) foreach_platform_strap_connector() { + //down(size.z/2) + foreach_platform_strap_connector() { link_connector_pin(); } } + color(top?"Olive":"YellowGreen") if (base) { + base_platform(); + platform_locks_pins(); strap_connectors(); + } else { + top_platform(); + platform_locks_sockets(); } } @@ -61,6 +152,12 @@ module model_platform_strap() { } // Export: -if (is_model(MODEL_PLATFORM_HARNESS)) model_platform_harness(); -if (is_model(MODEL_PLATFORM_STRAP)) model_platform_strap(); -if (is_model(MODEL_DEMO)) model_prop_arm(); +difference() { + union() { + if (is_model(MODEL_PLATFORM_HARNESS)) model_platform_harness(); + if (is_model(MODEL_PLATFORM_STRAP)) model_platform_strap(); + //if (is_model(MODEL_DEMO)) model_prop_arm(); + } + // xray: + //left(500+5) cube([1000, 1000, 1000], center=true); +} \ No newline at end of file diff --git a/src/specs_platform.scad b/src/specs_platform.scad index 51b9b15..ea734de 100644 --- a/src/specs_platform.scad +++ b/src/specs_platform.scad @@ -2,13 +2,22 @@ use use function get_platform_size() = [ - get_phone_size().x - 5, + get_phone_size().x - 30, get_phone_size().y - 5, - 5 + get_platform_wall()*3 + ]; +function get_platform_top_size() = [ + get_platform_size().x - 2*get_platform_wall(), + get_platform_size().y - 2*get_platform_wall(), + get_platform_size().z - get_platform_wall()]; +function get_platform_top_pos() = [0, 0, (get_platform_size().z-get_platform_top_size().z)/2]; +function get_platform_wall() = 3; +function get_platform_strap_connector_offset() = [ + (get_platform_size().x/2 - get_link_segment_size().y/2) - 3, + get_platform_size().y/2 + 4, + -get_link_segment_size().z/2 + 0.5 ]; -function get_platform_strap_connector_offset() = [ - (get_platform_size().x/2 - get_link_segment_size().y/2), - get_platform_size().y/2, - -get_link_segment_size().z/2 - ]; +function get_platform_lock_pin_size() = [20, 4, 3]; +function get_platform_lock_arm_size() = [65, 2, 3]; +function get_platform_lock_pin_pos() = [-20, -get_platform_top_size().y/2 + get_platform_wall()*4 + 1, get_platform_top_size().z/2];