From 58fc149bbe89062e9db7e889a5744861e415f691 Mon Sep 17 00:00:00 2001 From: Dejvino Date: Wed, 20 Jan 2021 15:55:17 +0100 Subject: [PATCH] Extracted common code out --- src/common.scad | 11 +++++++++++ src/harness.scad | 8 +------- src/main.scad | 2 +- src/platform.scad | 10 +++------- src/platform_common.scad | 21 +++++++++++++++++++++ src/strap.scad | 14 +++++++++----- src/strap_common.scad | 7 +++++-- 7 files changed, 51 insertions(+), 22 deletions(-) create mode 100644 src/common.scad create mode 100644 src/platform_common.scad diff --git a/src/common.scad b/src/common.scad new file mode 100644 index 0000000..5113437 --- /dev/null +++ b/src/common.scad @@ -0,0 +1,11 @@ +use +include + +module cubi(s, fillet=0, edges=EDGES_ALL) { + if ($preview) { + cube(s, center=true); + } else { + cuboid(s, fillet=fillet, edges=edges); + } +} + diff --git a/src/harness.scad b/src/harness.scad index 23f9e69..97c39ed 100644 --- a/src/harness.scad +++ b/src/harness.scad @@ -22,13 +22,7 @@ function use_slideout_backplane() = is_model_strict(MODEL_HARNESS_BOTTOM_PIP) || backplane_pip_slideout=10; -module cubi(s, fillet=0, edges=EDGES_ALL) { - if ($preview) { - cube(s, center=true); - } else { - cuboid(s, fillet=fillet, edges=edges); - } -} +use module dotted_grill_cutout(vents_area, vents_x=10, vents_y=10, mesh=1.5, cut_corners=false) { function is_corner(x, y, xm, ym) = (x == 0 || x == xm) && (y == 0 || y == ym); diff --git a/src/main.scad b/src/main.scad index 1b875d2..be9b92e 100644 --- a/src/main.scad +++ b/src/main.scad @@ -3,4 +3,4 @@ include include include -//include +include diff --git a/src/platform.scad b/src/platform.scad index 9324a19..95ae8d8 100644 --- a/src/platform.scad +++ b/src/platform.scad @@ -11,6 +11,7 @@ use use use +use // DEBUG: //validation = 1; @@ -40,13 +41,8 @@ module platform(base) { cube(size, center=true); module strap_connectors() { - offset=get_platform_strap_connector_offset(); - down(size.z/2) { - for (i=[0:3]) { - translate([((i%2*(-2)+1) * offset.x), -((round(i/2)%2*(-2)+1) * offset.y), offset.z]) - zrot(90 + (round(i/2)%2*180)) - link_connector_pin(); - } + down(size.z/2) foreach_platform_strap_connector() { + link_connector_pin(); } } diff --git a/src/platform_common.scad b/src/platform_common.scad new file mode 100644 index 0000000..67d6c34 --- /dev/null +++ b/src/platform_common.scad @@ -0,0 +1,21 @@ +// dependency: https://github.com/revarbat/BOSL +include +use +use +use +use + +use +use + +use + +module foreach_platform_strap_connector() { + offset=get_platform_strap_connector_offset(); + for (i=[0:3]) { + translate([((i%2*(-2)+1) * offset.x), -((round(i/2)%2*(-2)+1) * offset.y), offset.z]) + zrot(90 + (round(i/2)%2*180)) + children(); + } +} + diff --git a/src/strap.scad b/src/strap.scad index 03766d8..6423e3c 100644 --- a/src/strap.scad +++ b/src/strap.scad @@ -6,6 +6,8 @@ use use include +use + use if (is_model_strict(MODEL_LINKS)) { @@ -249,11 +251,13 @@ module clip_ratcheting(ratchet_length=28) { // === Export === if (is_model(MODEL_DEMO)) { - translate([-20, -40, -10]) zrot(-90) { - link_chain(links_count, include_terminal=include_terminal); - right(links_count * get_link_segment_size().x + get_link_clip_size().x) { - clip(); - right(get_link_clip_size().x) clip_ratcheting(); + foreach_platform_strap_connector() { + zrot(180) down(get_link_segment_size().z/2) { + link_chain(links_count, include_terminal=include_terminal); + /*right(links_count * get_link_segment_size().x + get_link_clip_size().x) { + clip(); + right(get_link_clip_size().x) clip_ratcheting(); + }*/ } } } else { diff --git a/src/strap_common.scad b/src/strap_common.scad index a005a07..92a1812 100644 --- a/src/strap_common.scad +++ b/src/strap_common.scad @@ -6,6 +6,8 @@ include use +use + module pin() { segment_size=get_link_segment_size(); h=segment_size.y; @@ -33,7 +35,7 @@ module pin_socket() { module arm() { segment_size=get_link_segment_size(); arm_size=get_link_joiner_arm_size(); - fwd(segment_size.y/2 + arm_size.y/2 - 1) right(arm_size.x/2 - 1) cuboid(arm_size, fillet=1, edges=EDGES_FRONT + EDGES_Y_ALL); + fwd(segment_size.y/2 + arm_size.y/2 - 1) right(arm_size.x/2 - 1) cubi(arm_size, fillet=1, edges=EDGES_FRONT + EDGES_Y_ALL); } module armFront() { arm(); @@ -46,9 +48,10 @@ module armJoiner() { arm_size=get_link_joiner_arm_size(); segment_size=get_link_segment_size(); joiner_size=[arm_size.x-get_link_socket_size().x, segment_size.y, segment_size.z]; - right(joiner_size.x/2 + get_link_socket_size().x/2 + gap) cuboid(joiner_size, fillet=1, edges=EDGES_Z_ALL + EDGES_BOTTOM); + right(joiner_size.x/2 + get_link_socket_size().x/2 + gap) cubi(joiner_size, fillet=1, edges=EDGES_Z_ALL + EDGES_BOTTOM); } module link_arms() { + $fn=$preview?4:20; armFront(); armBack(); armJoiner();