Extracted common code out

This commit is contained in:
Dejvino 2021-01-20 15:55:17 +01:00
parent 659c75c628
commit 58fc149bbe
7 changed files with 51 additions and 22 deletions

11
src/common.scad Normal file
View File

@ -0,0 +1,11 @@
use <BOSL/shapes.scad>
include <BOSL/constants.scad>
module cubi(s, fillet=0, edges=EDGES_ALL) {
if ($preview) {
cube(s, center=true);
} else {
cuboid(s, fillet=fillet, edges=edges);
}
}

View File

@ -22,13 +22,7 @@ function use_slideout_backplane() = is_model_strict(MODEL_HARNESS_BOTTOM_PIP) ||
backplane_pip_slideout=10; backplane_pip_slideout=10;
module cubi(s, fillet=0, edges=EDGES_ALL) { use <common.scad>
if ($preview) {
cube(s, center=true);
} else {
cuboid(s, fillet=fillet, edges=edges);
}
}
module dotted_grill_cutout(vents_area, vents_x=10, vents_y=10, mesh=1.5, cut_corners=false) { 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); function is_corner(x, y, xm, ym) = (x == 0 || x == xm) && (y == 0 || y == ym);

View File

@ -3,4 +3,4 @@ include <export.scad>
include <harness.scad> include <harness.scad>
include <platform.scad> include <platform.scad>
//include <strap.scad> include <strap.scad>

View File

@ -11,6 +11,7 @@ use <specs_platform.scad>
use <specs_strap.scad> use <specs_strap.scad>
use <strap_common.scad> use <strap_common.scad>
use <platform_common.scad>
// DEBUG: // DEBUG:
//validation = 1; //validation = 1;
@ -40,13 +41,8 @@ module platform(base) {
cube(size, center=true); cube(size, center=true);
module strap_connectors() { module strap_connectors() {
offset=get_platform_strap_connector_offset(); down(size.z/2) foreach_platform_strap_connector() {
down(size.z/2) { link_connector_pin();
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();
}
} }
} }

21
src/platform_common.scad Normal file
View File

@ -0,0 +1,21 @@
// dependency: https://github.com/revarbat/BOSL
include <BOSL/constants.scad>
use <BOSL/transforms.scad>
use <BOSL/shapes.scad>
use <BOSL/masks.scad>
use <BOSL/sliders.scad>
use <specs_platform.scad>
use <specs_strap.scad>
use <strap_common.scad>
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();
}
}

View File

@ -6,6 +6,8 @@ use <BOSL/transforms.scad>
use <BOSL/shapes.scad> use <BOSL/shapes.scad>
include <BOSL/constants.scad> include <BOSL/constants.scad>
use <specs_platform.scad>
use <strap_common.scad> use <strap_common.scad>
if (is_model_strict(MODEL_LINKS)) { if (is_model_strict(MODEL_LINKS)) {
@ -249,11 +251,13 @@ module clip_ratcheting(ratchet_length=28) {
// === Export === // === Export ===
if (is_model(MODEL_DEMO)) { if (is_model(MODEL_DEMO)) {
translate([-20, -40, -10]) zrot(-90) { foreach_platform_strap_connector() {
link_chain(links_count, include_terminal=include_terminal); zrot(180) down(get_link_segment_size().z/2) {
right(links_count * get_link_segment_size().x + get_link_clip_size().x) { link_chain(links_count, include_terminal=include_terminal);
clip(); /*right(links_count * get_link_segment_size().x + get_link_clip_size().x) {
right(get_link_clip_size().x) clip_ratcheting(); clip();
right(get_link_clip_size().x) clip_ratcheting();
}*/
} }
} }
} else { } else {

View File

@ -6,6 +6,8 @@ include <BOSL/constants.scad>
use <specs_strap.scad> use <specs_strap.scad>
use <common.scad>
module pin() { module pin() {
segment_size=get_link_segment_size(); segment_size=get_link_segment_size();
h=segment_size.y; h=segment_size.y;
@ -33,7 +35,7 @@ module pin_socket() {
module arm() { module arm() {
segment_size=get_link_segment_size(); segment_size=get_link_segment_size();
arm_size=get_link_joiner_arm_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() { module armFront() {
arm(); arm();
@ -46,9 +48,10 @@ module armJoiner() {
arm_size=get_link_joiner_arm_size(); arm_size=get_link_joiner_arm_size();
segment_size=get_link_segment_size(); segment_size=get_link_segment_size();
joiner_size=[arm_size.x-get_link_socket_size().x, segment_size.y, segment_size.z]; 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() { module link_arms() {
$fn=$preview?4:20;
armFront(); armFront();
armBack(); armBack();
armJoiner(); armJoiner();