Add bottom component as a single sliding Print-in-Place model

This commit is contained in:
Dejvino 2021-01-11 14:38:06 +01:00
parent 118fe703b5
commit d8329f5401

View File

@ -7,15 +7,18 @@ use <BOSL/sliders.scad>
// DEBUG: // DEBUG:
//validation = 1; //validation = 1;
//xray = 1; XRAY_POSITIVE=1;
XRAY_BACKPLANE=2;
//xray = 2;
// EXPORT: // EXPORT:
MODEL_HARNESS_LEFT=1; MODEL_HARNESS_LEFT=1;
MODEL_HARNESS_RIGHT=2; MODEL_HARNESS_RIGHT=2;
MODEL_HARNESS_TOP=3; MODEL_HARNESS_BOTTOM_PIP=3;
MODEL_HARNESS_SLIDER_FRONT=4; MODEL_HARNESS_TOP=4;
MODEL_HARNESS_SLIDER_BACK=5; MODEL_HARNESS_SLIDER_FRONT=5;
export=1; // [0:5] MODEL_HARNESS_SLIDER_BACK=6;
export=3; // [0:6]
function is_not_export() = is_undef(export) || export == 0; function is_not_export() = is_undef(export) || export == 0;
function is_export() = !is_not_export(); function is_export() = !is_not_export();
function is_model_strict(m) = is_export() && export == m; function is_model_strict(m) = is_export() && export == m;
@ -23,6 +26,8 @@ function is_model(m) = is_not_export() || export == m;
function get_phone_size() = [160, 76.7, 10]; function get_phone_size() = [160, 76.7, 10];
backplane_pip_slideout=10;
module cubi(s, fillet=0, edges=EDGES_ALL) { module cubi(s, fillet=0, edges=EDGES_ALL) {
if ($preview) { if ($preview) {
cube(s, center=true); cube(s, center=true);
@ -123,7 +128,21 @@ module phone_harness() {
} }
} }
module shell_backplane(groove) { module shell_backplane(groove) {
down(hs.z/2 - shell_wall/6) up(backplane_rim_size.z/2) right(harness_divider.x) scale(groove ? 1.01 : 1) cubi(backplane_rim_size, fillet=5, edges=EDGES_Z_LF); down(hs.z/2 - shell_wall/6) up(backplane_rim_size.z/2) right(harness_divider.x) {
back(backplane_rim_size.y/2) {
teeth=4;
segment=backplane_rim_size.y/teeth;
tooth_size=[backplane_rim_size.x, segment/2, backplane_rim_size.z];
for (i = [0:teeth-1]) {
fwd(i*segment) fwd(tooth_size.y) scale(groove ? 1.02 : 1) cubi(tooth_size, fillet=2, edges=EDGES_Z_LF);
}
}
left(backplane_pip_slideout + 11) if (is_model_strict(MODEL_HARNESS_BOTTOM_PIP)) {
joiner_size=[7 + (groove?backplane_pip_slideout:0), backplane_rim_size.y, backplane_rim_size.z];
scale(groove ? 1.02 : 1) left(-joiner_size.x/2) cubi(joiner_size, fillet=2, edges=EDGES_Z_LF);
}
}
} }
// ==== SHELL SLIDER AND RAIL ==== // ==== SHELL SLIDER AND RAIL ====
@ -291,6 +310,10 @@ module phone_harness() {
if (is_model(MODEL_HARNESS_LEFT)) model_harness_left(); if (is_model(MODEL_HARNESS_LEFT)) model_harness_left();
if (is_model(MODEL_HARNESS_RIGHT)) model_harness_right(); if (is_model(MODEL_HARNESS_RIGHT)) model_harness_right();
if (is_model_strict(MODEL_HARNESS_BOTTOM_PIP)) {
model_harness_left();
right(backplane_pip_slideout) model_harness_right();
}
if (is_model(MODEL_HARNESS_TOP)) model_harness_top(); if (is_model(MODEL_HARNESS_TOP)) model_harness_top();
if (is_model(MODEL_HARNESS_SLIDER_FRONT)) model_harness_slider_front(); if (is_model(MODEL_HARNESS_SLIDER_FRONT)) model_harness_slider_front();
if (is_model(MODEL_HARNESS_SLIDER_BACK)) model_harness_slider_back(); if (is_model(MODEL_HARNESS_SLIDER_BACK)) model_harness_slider_back();
@ -308,7 +331,11 @@ if (!is_undef(validation)) {
} else { } else {
intersection() { intersection() {
if (!is_undef(xray)) { if (!is_undef(xray)) {
span_cube([0,1000*xray], [0,1000*xray], [-1000,1000]); if (xray == XRAY_POSITIVE) {
span_cube([0,1000], [0,1000], [-1000,1000]);
} else if (xray == XRAY_BACKPLANE) {
span_cube([-1000,1000], [-1000,1000], [-1000,-7]);
}
} }
union() { union() {
if (is_not_export()) { if (is_not_export()) {