various plumbing to implement auto-masks for library, config changes and other modifications

This commit is contained in:
Edward Kisiel
2024-03-16 17:39:23 -04:00
parent 8bf424b99b
commit 0fb0f4daef
10 changed files with 1470 additions and 1068 deletions

View File

@@ -47,7 +47,7 @@ module add(type, loc_x, loc_y, loc_z, face, rotation, size, data, mask) {
mlen = mask[1];
msetback = mask[2];
mstyle = mask[3];
if(type == "rectangle") {
translate([loc_x,loc_y,loc_z]) rotate(rotation) slab_r([size_x,size_y,size_z],data[0]);
}
@@ -66,8 +66,11 @@ module add(type, loc_x, loc_y, loc_z, face, rotation, size, data, mask) {
if(type == "stl_model") {
translate([loc_x,loc_y,loc_z]) rotate(rotation) stl_model(data[0],data[1]);
}
if(type == "standoff") {
translate([loc_x,loc_y,loc_z]) rotate(rotation) standoff(data[0], mask);
}
if(type == "button") {
translate([loc_x,loc_y,loc_z]) rotate(rotation) buttons(data[1],[size_x,size_y,size_z],data[2],data[0]);
translate([loc_x,loc_y,loc_z]) rotate(rotation) buttons(data[1],[size_x,size_y,size_z],data[2],data[0],mask);
}
if(type == "button_top") {
translate([loc_x,loc_y,loc_z]) rotate(rotation) button_assembly(data[0],size_x,size_z);
@@ -79,22 +82,19 @@ module add(type, loc_x, loc_y, loc_z, face, rotation, size, data, mask) {
translate([loc_x,loc_y,loc_z]) rotate(rotation) batt_holder(data[0]);
}
if(type == "hk_uart_holder") {
translate([loc_x,loc_y,loc_z]) rotate(rotation) hk_uart_holder();
translate([loc_x,loc_y,loc_z]) rotate(rotation) hk_uart_holder(mask);
}
if(type == "hk_uart_strap") {
color("grey",1) translate([loc_x,loc_y,loc_z]) rotate(rotation) hk_uart_strap();
}
if(type == "standoff") {
translate([loc_x,loc_y,loc_z]) rotate(rotation) standoff(data[0]);
}
if(type == "hd_holder") {
translate([loc_x,loc_y,loc_z]) rotate(rotation) hd_mount(data[0],data[1],"horizontal","none");
translate([loc_x,loc_y,loc_z]) rotate(rotation) hd_mount(data[0],data[1], "horizontal", "none");
}
if(type == "hd_vertleft") {
translate([loc_x,loc_y,loc_z]) rotate(rotation) hd_mount(data[0],data[1],"vertical","left");
translate([loc_x,loc_y,loc_z]) rotate(rotation) hd_mount(data[0],data[1], "vertical", "left");
}
if(type == "hd_vertright") {
translate([loc_x,loc_y,loc_z]) rotate(rotation) hd_mount(data[0],data[1],"vertical","right");
translate([loc_x,loc_y,loc_z]) rotate(rotation) hd_mount(data[0],data[1], "vertical", "right");
}
if(type == "hd25") {
translate([loc_x,loc_y,loc_z]) rotate(rotation) hd25(data[0]);
@@ -106,31 +106,31 @@ module add(type, loc_x, loc_y, loc_z, face, rotation, size, data, mask) {
translate([loc_x,loc_y,loc_z]) rotate(rotation) hk_wb2();
}
if(type == "hc4_oled") {
translate([loc_x,loc_y,loc_z]) rotate(rotation) hk_hc4_oled();
translate([loc_x,loc_y,loc_z]) rotate(rotation) hk_hc4_oled(mask);
}
if(type == "hc4_oled_holder") {
translate([loc_x,loc_y,loc_z]) rotate(rotation) hk_hc4_oled_holder(face,size_z);
translate([loc_x,loc_y,loc_z]) rotate(rotation) hk_hc4_oled_holder(face, size_z, mask);
}
if(type == "h2_netcard") {
translate([loc_x,loc_y,loc_z]) rotate(rotation) hk_netcard();
translate([loc_x,loc_y,loc_z]) rotate(rotation) hk_netcard(mask);
}
if(type == "hk_lcd35") {
translate([loc_x,loc_y,loc_z]) rotate(rotation) hk_35lcd();
translate([loc_x,loc_y,loc_z]) rotate(rotation) hk_35lcd(mask);
}
if(type == "hk_m1s_ups") {
translate([loc_x,loc_y,loc_z]) rotate(rotation) hk_m1s_ups();
translate([loc_x,loc_y,loc_z]) rotate(rotation) hk_m1s_ups(mask);
}
if(type == "hk_uart") {
translate([loc_x,loc_y,loc_z]) rotate(rotation) hk_uart();
translate([loc_x,loc_y,loc_z]) rotate(rotation) hk_uart(mask);
}
if(type == "hk_vu7c") {
translate([loc_x,loc_y,loc_z]) rotate(rotation) hk_vu7c(data[0],data[1]);
translate([loc_x,loc_y,loc_z]) rotate(rotation) hk_vu7c(data[0],data[1],mask);
}
if(type == "hk_boom") {
translate([loc_x,loc_y,loc_z]) rotate(rotation) hk_boom(data[0],data[1]);
translate([loc_x,loc_y,loc_z]) rotate(rotation) hk_boom(data[0],data[1],mask);
}
if(type == "boom_speaker") {
translate([loc_x,loc_y,loc_z]) rotate(rotation) hk_boom_speaker(data[1],true,data[0]);
translate([loc_x,loc_y,loc_z]) rotate(rotation) hk_boom_speaker(data[1],true,data[0],mask);
}
if(type == "boom_grill") {
translate([loc_x,loc_y,loc_z]) rotate(rotation) hk_boom_grill(data[0],size_z);
@@ -139,7 +139,7 @@ module add(type, loc_x, loc_y, loc_z, face, rotation, size, data, mask) {
translate([loc_x,loc_y,loc_z]) rotate(rotation) boom_speaker_holder(data[0],data[1]);
}
if(type == "hk_speaker") {
translate([loc_x,loc_y,loc_z]) rotate(rotation) hk_speaker();
translate([loc_x,loc_y,loc_z]) rotate(rotation) hk_speaker(mask);
}
if(type == "fan_cover") {
translate([loc_x,loc_y,loc_z]) rotate(rotation) fan_cover(size_x, size_z, data[0]);
@@ -153,10 +153,10 @@ module add(type, loc_x, loc_y, loc_z, face, rotation, size, data, mask) {
}
if(type == "access_port") {
if(rotation[2] == 180) {
translate([loc_x+size_x,loc_y+size_y,loc_z]) rotate(rotation) access_port([size_x,size_y,size_z],data[0]);
translate([loc_x+size_x,loc_y+size_y,loc_z]) rotate(rotation) access_port([size_x,size_y,size_z],data[0],mask);
}
else {
translate([loc_x,loc_y,loc_z]) rotate(rotation) access_port([size_x,size_y,size_z],data[0]);
translate([loc_x,loc_y,loc_z]) rotate(rotation) access_port([size_x,size_y,size_z],data[0],mask);
}
}
if(type == "access_cover") {
@@ -177,7 +177,7 @@ module add(type, loc_x, loc_y, loc_z, face, rotation, size, data, mask) {
translate([loc_x,loc_y,loc_z]) rotate(rotation) h3_port_extender_holder(data[1],data[0]);
}
if(type == "hk_pwr_button") {
translate([loc_x,loc_y,loc_z]) rotate(rotation) hk_pwr_button();
translate([loc_x,loc_y,loc_z]) rotate(rotation) hk_pwr_button(mask);
}
if(type == "keyhole") {
translate([loc_x,loc_y,loc_z]) rotate(rotation) keyhole(data[0]);
@@ -188,7 +188,4 @@ module add(type, loc_x, loc_y, loc_z, face, rotation, size, data, mask) {
if(type == "nut_holder") {
translate([loc_x,loc_y,loc_z]) rotate(rotation) nut_holder(data[0], data[1], size_x, size_y, size_z);
}
if(type == "standoff") {
translate([loc_x,loc_y,loc_z]) rotate(rotation) standoff(data[0]);
}
}

View File

@@ -273,7 +273,7 @@ module case_bottom(case_design) {
mask = accessory_data[a[0]][i+10];
if(class == "add1" && face == "bottom") {
parametric_move_add(type, loc_x, loc_y, loc_z, face, rotation, parametric, size, data, mask);
parametric_move_add(type, loc_x, loc_y, loc_z, face, rotation, parametric, size, data, [false,mask[1],mask[2],mask[3]]);
}
}
}
@@ -589,79 +589,18 @@ module case_bottom(case_design) {
}
}
// create openings for additive
if (class == "add2" && face == "bottom" && type == "standoff") {
parametric_move_sub("round",loc_x,loc_y,loc_z-.1,face,rotation,parametric,
[6.5,size_y,floorthick+1],data,mask);
}
if ((class == "add1" || class == "add2") && type == "uart_holder") {
if(accessory_highlight == false) {
parametric_move_sub("microusb",loc_x+5.25,loc_y-5,loc_z+4,face,rotation,parametric,
[0,0,0],data,mask);
}
else {
#parametric_move_sub("microusb",loc_x+5.25,loc_y-5,loc_z+4,face,rotation,parametric,
[0,0,0],data,mask);
}
}
if ((class == "add1" || class == "add2") && face == "bottom" && type == "hc4_oled_holder") {
parametric_move_sub("rectangle",loc_x+1,loc_y+1.75,loc_z+25.5,face,rotation,parametric,
[26.5,wallthick+gap+4,15],[[.1,.1,.1,.1]],mask);
}
if ((class == "add1" || class == "add2") && face == "bottom" && type == "access_port") {
if(data[0] == "landscape") {
if(rotation[2] == 180) {
parametric_move_sub("rectangle",loc_x-6+size_x,loc_y+.5+size_y,loc_z-adj,face,rotation,
parametric,[size_x-17,size_y-1,floorthick+1],[[.1,.1,.1,.1]],mask);
parametric_move_sub("rectangle",loc_x-size_x+12.5+size_x,loc_y-(size_y/2)+6+size_y,loc_z-adj,
face,rotation,parametric,[5.5,10.5,floorthick+.12],[[5.5,5.5,5.5,5.5]],mask);
}
else {
parametric_move_sub("rectangle",loc_x+6,loc_y-.5,loc_z-adj,face,rotation,
parametric,[size_x-17,size_y-1,floorthick+1],[[.1,.1,.1,.1]],mask);
parametric_move_sub("rectangle",loc_x+size_x-12.5,loc_y+(size_y/2)-6,loc_z-adj,face,rotation,
parametric,[5.5,10.5,floorthick+.12],[[5.5,5.5,5.5,5.5]],mask);
}
// create openings for additive
if ((class == "add1" || class == "add2" || class == "model") && mask[0] == true) {
if(accessory_highlight == false) {
parametric_move_add(type,loc_x,loc_y,loc_z,face,rotation,parametric,[size_x,size_y,size_z],data,[true,mask[1],mask[2],mask[3]]);
}
else {
if(rotation[2] == 180) {
if(data[0] == "portrait") {
parametric_move_sub("rectangle",loc_x+size_x-.5,loc_y+size_y-5.75,loc_z-adj,face,
rotation,parametric,[size_x-1,size_y-17,floorthick+1],[[.1,.1,.1,.1]],mask);
parametric_move_sub("rectangle",loc_x-(size_x/2)+5+size_x,loc_y-size_y+12.5+size_y,
loc_z-adj,face,rotation,parametric,[10.5,5.5,floorthick+.12],[[5.5,5.5,5.5,5.5]],mask);
}
else {
parametric_move_sub("rectangle",loc_x-.5,loc_y-5.75,loc_z-adj,face,rotation,
parametric,[size_x-1,size_y-17,floorthick+1],[[.1,.1,.1,.1]],mask);
parametric_move_sub("rectangle",loc_x-(size_x/2)+5,loc_y-size_y+12.5,loc_z-adj,face,
rotation,parametric,[10.5,5.5,floorthick+.12],[[5.5,5.5,5.5,5.5]],mask);
}
}
else {
parametric_move_sub("rectangle",loc_x+.5,loc_y+5.75,loc_z-adj,face,rotation,
parametric,[size_x-1,size_y-17,floorthick+1],[[.1,.1,.1,.1]],mask);
parametric_move_sub("rectangle",loc_x+(size_x/2)-5,loc_y+size_y-12.5,loc_z-adj,face,rotation,
parametric,[10.5,5.5,floorthick+.12],[[5.5,5.5,5.5,5.5]],mask);
}
}
}
if ((class == "model") && face == "bottom" && type == "h2_netcard") {
parametric_move_sub("rectangle",loc_x+25,loc_y-6,loc_z-14,face,rotation,
parametric,[68.5,wallthick+3,14.5],[[1,1,1,1]],mask);
}
if ((class == "add1" || class == "add2") && face == "bottom" && type == "button") {
if(data[1] == "recess") {
#parametric_move_sub("sphere",loc_x,loc_y,loc_z,face,rotation,
parametric,[size_x-1,size_y,size_z],data,mask);
}
if(data[1] == "cutout") {
parametric_move_sub("rectangle",loc_x+10,loc_y+4,loc_z-adj,face,rotation,
parametric,[size_x+2,size_y+1,size_z+2*adj],[[.1,.1,.1,.1]],mask);
#parametric_move_add(type,loc_x,loc_y,loc_z,face,rotation,parametric,[size_x,size_y,size_z],data,[true,mask[1],mask[2],mask[3]]);
}
}
}
}
// ui access port
if(bottom_access_port_enable == true) {
@@ -716,7 +655,7 @@ module case_bottom(case_design) {
mask = accessory_data[a[0]][i+10];
if(class == "add2" && face == "bottom") {
parametric_move_add(type,loc_x,loc_y,loc_z,face,rotation,parametric,size,data,mask);
parametric_move_add(type, loc_x, loc_y, loc_z, face, rotation, parametric, size, data, [false,mask[1],mask[2],mask[3]]);
}
}
}

View File

@@ -212,11 +212,12 @@ module case_side(case_design, case_style, side) {
mask = accessory_data[a[0]][i+10];
if (class == "add1" && face == side) {
parametric_move_add(type,loc_x,loc_y,loc_z,face,rotation,parametric,size,data,mask);
parametric_move_add(type,loc_x,loc_y,loc_z,face,rotation,parametric,size,data,[false,mask[1],mask[2],mask[3]]);
}
}
}
}
// subtractive accessories
if(accessory_name != "none") {
for (i=[1:11:len(accessory_data[a[0]])-1]) {
class = accessory_data[a[0]][i];
@@ -244,61 +245,12 @@ module case_side(case_design, case_style, side) {
}
}
// create openings for additive
if ((class == "sub" && face == "bottom") || class == "suball") {
if((class == "add1" || class == "add2" || class == "model") && mask[0] == true) {
if(accessory_highlight == false) {
parametric_move_sub(type,loc_x,loc_y,loc_z,face,rotation,parametric,
[size_x,size_y,size_z],data,mask);
parametric_move_add(type,loc_x,loc_y,loc_z,face,rotation,parametric,[size_x,size_y,size_z],data,mask);
}
else {
#parametric_move_sub(type,loc_x,loc_y,loc_z,face,rotation,parametric,
[size_x,size_y,size_z],data,mask);
}
}
// create openings for additive
if (class == "add2" && face == "bottom" && type == "standoff") {
parametric_move_sub("round",loc_x,loc_y,-.1,face,rotation,parametric,
[6.5,size_y,floorthick+1],data,mask);
}
if ((class == "add1" || class == "add2") && face == "bottom" && type == "uart_holder") {
if(accessory_highlight == false) {
parametric_move_sub("microusb",loc_x+5.25,loc_y-5,loc_z+4,face,rotation,parametric,
[0,0,0],data,mask);
}
else {
#parametric_move_sub("microusb",loc_x+5.25,loc_y-5,loc_z+4,face,rotation,parametric,
[0,0,0],data,mask);
}
}
if ((class == "add1" || class == "add2") && face == "bottom" && type == "hc4_oled_holder") {
parametric_move_sub("rectangle",loc_x+1,loc_y+1.75,loc_z+25.5,face,rotation,
parametric,[26.5,wallthick+gap+4,15],[[.1,.1,.1,.1]],mask);
}
if ((class == "add1" || class == "add2") && face == "bottom" && type == "access_port") {
if(data[0] == "landscape") {
parametric_move_sub("rectangle",loc_x+6,loc_y-.5,loc_z-adj,face,rotation,
parametric,[size_x-17,size_y-1,floorthick+1],[[.1,.1,.1,.1]],mask);
parametric_move_sub("rectangle",loc_x+size_x-12.5,loc_y+(size_y/2)-6,loc_z-adj,face,rotation,
parametric,[5.5,10.5,floorthick+.12],[[5.5,5.5,5.5,5.5]],mask);
}
else {
parametric_move_sub("rectangle",loc_x+.5,loc_y+5.75,loc_z-adj,face,rotation,parametric,
[size_x-1,size_y-17,floorthick+1],[[.1,.1,.1,.1]],mask);
parametric_move_sub("rectangle",loc_x+(size_x/2)-5,loc_y+size_y-12.5,loc_z-adj,face,rotation,
parametric,[10.5,5.5,floorthick+.12],[[5.5,5.5,5.5,5.5]],mask);
}
}
if ((class == "model") && face == "bottom" && type == "h2_netcard") {
parametric_move_sub("rectangle",loc_x+25,loc_y-6,loc_z-14,face,rotation,
parametric,[68.5,wallthick+3,14.5],[[1,1,1,1]],mask);
}
if ((class == "add1" || class == "add2") && face == "bottom" && type == "button") {
if(data[1] == "recess") {
parametric_move_sub("sphere",loc_x,loc_y,loc_z,face,rotation,
parametric,[size_x-1,size_y,size_z],data,mask);
}
if(data[1] == "cutout") {
parametric_move_sub("rectangle",loc_x+10,loc_y+4,loc_z-adj,face,rotation,
parametric,[size_x+2,size_y+1,size_z+2*adj],[[.1,.1,.1,.1]],mask);
#parametric_move_add(type,loc_x,loc_y,loc_z,face,rotation,parametric,[size_x,size_y,size_z],data,mask);
}
}
}
@@ -344,7 +296,7 @@ module case_side(case_design, case_style, side) {
mask = accessory_data[a[0]][i+10];
if (class == "add2" && face == side) {
parametric_move_add(type,loc_x,loc_y,loc_z,face,rotation,parametric,size,data,mask);
parametric_move_add(type,loc_x,loc_y,loc_z,face,rotation,parametric,size,data,[false,mask[1],mask[2],mask[3]]);
}
}
}

View File

@@ -266,7 +266,7 @@ module case_top(case_design) {
mask = accessory_data[a[0]][i+10];
if (class == "add1" && face == "top") {
parametric_move_add(type,loc_x,loc_y,loc_z,face,rotation,parametric,size,data,mask);
parametric_move_add(type,loc_x,loc_y,loc_z,face,rotation,parametric,size,data,[false,mask[1],mask[2],mask[3]]);
}
}
}
@@ -531,39 +531,16 @@ module case_top(case_design) {
parametric,[size_x,size_y,size_z],data,mask);
}
}
// create openings for additive
if (class == "add2" && face == "top" && type == "standoff") {
parametric_move_sub("round",loc_x,loc_y,loc_z,face,rotation,parametric,[6.5,size_y,floorthick+1],data,mask);
}
if ((class == "add1" || class == "add2") && face == "bottom" && type == "uart_holder") {
if((class == "add1" || class == "add2" || class == "model") && mask[0] == true) {
if(accessory_highlight == false) {
parametric_move_sub("microusb",loc_x+5.25,loc_y-5,loc_z+4,face,rotation,parametric,[0,0,0],data,mask);
parametric_move_add(type,loc_x,loc_y,loc_z,face,rotation,parametric,[size_x,size_y,size_z],data,mask);
}
else {
#parametric_move_sub("microusb",loc_x+5.25,loc_y-5,loc_z+4,face,rotation,parametric,[0,0,0],data,mask);
#parametric_move_add(type,loc_x,loc_y,loc_z,face,rotation,parametric,[size_x,size_y,size_z],data,mask);
}
}
if ((class == "add1" || class == "add2") && face == "bottom" && type == "hc4_oled_holder") {
parametric_move_sub("rectangle",loc_x+1,loc_y+1.75,loc_z+26,face,rotation,
parametric,[26.5,wallthick+gap+4,14.5],[[.1,.1,.1,.1]],mask);
}
if ((class == "add1" || class == "add2") && face == "top" && type == "button") {
if(data[1] == "recess") {
parametric_move_sub("sphere",loc_x,loc_y,loc_z,face,rotation,
parametric,[size_x-1,size_y,size_z],data,mask);
}
if(data[1] == "cutout") {
parametric_move_sub("rectangle",loc_x+10,loc_y+4,loc_z-adj,face,rotation,
parametric,[size_x+2,size_y+1,size_z+2*adj],[[.1,.1,.1,.1]],mask);
}
}
if (class == "model" && face == "bottom" && type == "hk_boom" &&
rotation[0] == 90 && rotation[1] == 0 && rotation[2] == 0) {
parametric_move_sub("round",loc_x+11,loc_y-4,loc_z,face,[0,0,0],
parametric,[5,size_y,80],data,mask);
parametric_move_sub("slot",loc_x+37.5,loc_y-4.75,loc_z,face,[0,0,0],
parametric,[6,14,80],data,mask);
}
}
}
// sbc openings
@@ -617,7 +594,7 @@ module case_top(case_design) {
mask = accessory_data[a[0]][i+10];
if (class == "add2" && face == "top") {
parametric_move_add(type,loc_x,loc_y,loc_z,face,rotation,parametric,size,data,mask);
parametric_move_add(type,loc_x,loc_y,loc_z,face,rotation,parametric,size,data,[false,mask[1],mask[2],mask[3]]);
}
}
}

View File

@@ -64,7 +64,7 @@ module sub(type, loc_x, loc_y, loc_z, face, rotation, size, data, mask) {
translate([loc_x,loc_y,loc_z]) rotate(rotation) art(data[0],data[1],data[2]);
}
if(type == "button") {
translate([loc_x,loc_y,loc_z]) rotate(rotation) buttons(data[1],[size_x,size_y,size_z],data[2],data[0]);
translate([loc_x,loc_y,loc_z]) rotate(rotation) buttons(data[1],[size_x,size_y,size_z],data[2],data[0],mask);
}
if(type == "hd_holes") {
translate([loc_x,loc_y,loc_z]) rotate(rotation) hd_bottom_holes(data[0],data[2],"none","none",data[1]);
@@ -103,7 +103,7 @@ module sub(type, loc_x, loc_y, loc_z, face, rotation, size, data, mask) {
translate([loc_x,loc_y,loc_z]) rotate(rotation) h3_port_extender(data[0], true);
}
if(type == "hk_pwr_button") {
translate([loc_x,loc_y,loc_z]) rotate(rotation) hk_pwr_button(true);
translate([loc_x,loc_y,loc_z]) rotate(rotation) hk_pwr_button(mask);
}
if(type == "dsub") {
translate([loc_x,loc_y,loc_z]) rotate(rotation) dsub(data[0], true);