initial work for integrating sbc model framework v2

This commit is contained in:
Edward Kisiel
2024-01-29 17:40:12 -05:00
parent d5674f9f24
commit adf72494a1
29 changed files with 5959 additions and 6978 deletions

150
mod/add.scad Normal file
View File

@@ -0,0 +1,150 @@
/*
add(type,loc_x,loc_y,loc_z,size_x,size_y,size_z,rotation,face,side,case_z,data_1,data_2,data_3,data_4)
*/
/* addition module */
module add(type,loc_x,loc_y,loc_z,face,rotation,size_x,size_y,size_z,data_1,data_2,data_3,data_4) {
if(type == "rectangle") {
translate([loc_x,loc_y,loc_z]) rotate(rotation) slab_r([size_x,size_y,size_z],data_4);
}
if(type == "round") {
translate([loc_x,loc_y,loc_z]) rotate(rotation) cylinder(d=size_x,h=size_z);
}
if(type == "slot") {
translate([loc_x,loc_y,loc_z]) rotate(rotation) slot(size_x,size_y,size_z);
}
if(type == "text") {
translate([loc_x,loc_y,loc_z]) rotate(rotation) linear_extrude(height = size_z) text(data_3, size=data_1);
}
if(type == "art") {
translate([loc_x,loc_y,loc_z]) rotate(rotation) art(data_1,data_2,data_3);
}
if(type == "button") {
translate([loc_x,loc_y,loc_z]) rotate(rotation) button(data_3,[size_x,size_y,size_z],data_4,data_1);
}
if(type == "button_top") {
translate([loc_x,loc_y,loc_z]) rotate(rotation) button_assembly(data_3,size_x,size_z);
}
if(type == "pcb_holder") {
translate([loc_x,loc_y,loc_z]) rotate(rotation) pcb_holder([size_x,size_y,size_z],data_1);
}
if(type == "batt_holder") {
translate([loc_x,loc_y,loc_z]) rotate(rotation) batt_holder(data_1);
}
if(type == "uart_holder") {
translate([loc_x,loc_y,loc_z]) rotate(rotation) uart_holder();
}
if(type == "uart_strap") {
color("grey",1) translate([loc_x,loc_y,loc_z]) rotate(rotation) uart_strap();
}
if(type == "standoff") {
translate([loc_x,loc_y,loc_z]) rotate(rotation) standoff(data_4);
}
if(type == "hd_holder") {
translate([loc_x,loc_y,loc_z]) rotate(rotation) hd_mount(data_1,data_3,"horizontal","none");
}
if(type == "hd_vertleft") {
translate([loc_x,loc_y,loc_z]) rotate(rotation) hd_mount(data_1,data_3,"vertical","left");
}
if(type == "hd_vertright") {
translate([loc_x,loc_y,loc_z]) rotate(rotation) hd_mount(data_1,data_3,"vertical","right");
}
if(type == "hd25") {
translate([loc_x,loc_y,loc_z]) rotate(rotation) hd25(data_1);
}
if(type == "hd35") {
translate([loc_x,loc_y,loc_z]) rotate(rotation) hd35();
}
if(type == "hk_wb2") {
translate([loc_x,loc_y,loc_z]) rotate(rotation) hk_wb2();
}
if(type == "hc4_oled") {
translate([loc_x,loc_y,loc_z]) rotate(rotation) hc4_oled();
}
if(type == "hc4_oled_holder") {
translate([loc_x,loc_y,loc_z]) rotate(rotation) hc4_oled_holder(face,size_z);
}
if(type == "h2_netcard") {
translate([loc_x,loc_y,loc_z]) rotate(rotation) h2_netcard();
}
if(type == "hk_lcd35") {
translate([loc_x,loc_y,loc_z]) rotate(rotation) hk35_lcd();
}
if(type == "hk_m1s_ups") {
translate([loc_x,loc_y,loc_z]) rotate(rotation) hk_m1s_ups();
}
if(type == "hk_uart") {
translate([loc_x,loc_y,loc_z]) rotate(rotation) hk_uart();
}
if(type == "hk_vu7c") {
translate([loc_x,loc_y,loc_z]) rotate(rotation) hk_vu7c(data_1,data_2);
}
if(type == "hk_boom") {
translate([loc_x,loc_y,loc_z]) rotate(rotation) hk_boom(data_1,data_3);
}
if(type == "boom_speaker") {
translate([loc_x,loc_y,loc_z]) rotate(rotation) hk_boom_speaker(data_3,true,data_1);
}
if(type == "boom_grill") {
translate([loc_x,loc_y,loc_z]) rotate(rotation) hk_boom_grill(data_3,size_z);
}
if(type == "boom_speaker_holder") {
translate([loc_x,loc_y,loc_z]) rotate(rotation) boom_speaker_holder(data_1);
}
if(type == "hk_speaker") {
translate([loc_x,loc_y,loc_z]) rotate(rotation) hk_speaker();
}
if(type == "fan_cover") {
translate([loc_x,loc_y,loc_z]) rotate(rotation) fan_cover(size_x, size_z);
}
if(type == "vent_panel_hex") {
translate([loc_x,loc_y,loc_z]) rotate(rotation) vent_panel_hex(x=size_x, y=size_y, thick=size_z,
cell_size=data_1, cell_spacing=data_2, border=data_4, borders=data_3);
}
if(type == "feet") {
translate([loc_x,loc_y,loc_z]) rotate(rotation) feet(size_x, size_z);
}
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_3);
}
else {
translate([loc_x,loc_y,loc_z]) rotate(rotation) access_port([size_x,size_y,size_z],data_3);
}
}
if(type == "access_cover") {
if(rotation[2] == 180) {
color("grey",1) translate([loc_x+size_x,loc_y+size_y,loc_z]) rotate(rotation) access_cover([size_x,size_y,size_z],data_3);
}
else {
color("grey",1) translate([loc_x,loc_y,loc_z]) rotate(rotation) access_cover([size_x,size_y,size_z],data_3);
}
}
if(type == "boom_vring") {
translate([loc_x,loc_y,loc_z]) rotate(rotation) boom_vring(data_1);
}
if(type == "h3_port_extender") {
translate([loc_x,loc_y,loc_z]) rotate(rotation) h3_port_extender(data_3);
}
if(type == "h3_port_extender_holder") {
translate([loc_x,loc_y,loc_z]) rotate(rotation) h3_port_extender_holder(data_3,data_1);
}
if(type == "hk_pwr_button") {
translate([loc_x,loc_y,loc_z]) rotate(rotation) hk_pwr_button();
}
if(type == "keyhole") {
translate([loc_x,loc_y,loc_z]) rotate(rotation) keyhole(data_4);
}
if(type == "dsub") {
translate([loc_x,loc_y,loc_z]) rotate(rotation) dsub(data_4);
}
if(type == "nut_holder") {
translate([loc_x,loc_y,loc_z]) rotate(rotation) nut_holder(data_1, data_2, size_x, size_y, size_z);
}
if(type == "standoff") {
translate([loc_x,loc_y,loc_z]) rotate(rotation) standoff(data_4);
}
}

680
mod/case_bottom.scad Normal file
View File

@@ -0,0 +1,680 @@
// case bottom
module case_bottom(case_design) {
difference() {
union() {
difference() {
union() {
if(case_design == "shell") {
difference() {
translate([(width/2)-wallthick-gap,(depth/2)-wallthick-gap,bottom_height/2])
cube_fillet_inside([width,depth,bottom_height],
vertical=[c_fillet,c_fillet,c_fillet,c_fillet],
top=[0,0,0,0], bottom=[fillet,fillet,fillet,fillet,fillet], $fn=90);
translate([(width/2)-wallthick-gap,
(depth/2)-wallthick-gap,(bottom_height/2)+floorthick])
cube_fillet_inside([width-(wallthick*2),depth-(wallthick*2),bottom_height],
vertical=[c_fillet-1,c_fillet-1,c_fillet-1,c_fillet-1],
top=[0,0,0,0], bottom=[fillet,fillet,fillet,fillet,fillet], $fn=90);
}
}
if(case_design == "panel") {
union() {
translate([-gap,-gap,0])
cube([width-(2*wallthick),depth-(2*wallthick),floorthick]);
translate([(width*(1/5))-8-(wallthick+gap),depth-(2*wallthick)-gap-adj,0])
cube([8,wallthick+2*adj,floorthick]);
translate([width-(width*(1/5))-(wallthick+gap),depth-(2*wallthick)-gap-adj,0])
cube([8,wallthick+2*adj,floorthick]);
translate([(width*(1/5))-8-(wallthick+gap),-wallthick-gap+adj,0])
cube([8,wallthick+2*adj,floorthick]);
translate([width-(width*(1/5))-(wallthick+gap),-wallthick-gap+adj,0])
cube([8,wallthick+2*adj,floorthick]);
}
}
if(case_design == "stacked") {
translate([(width/2)-wallthick-gap,(depth/2)-wallthick-gap,floorthick/2])
cube_fillet_inside([width-(2*wallthick),depth-(2*wallthick),floorthick],
vertical=[c_fillet,c_fillet,c_fillet,c_fillet],
top=[0,0,0,0], bottom=[0,0,0,0], $fn=90);
}
if(case_design == "tray") {
difference() {
translate([(width/2)-wallthick-gap,(depth/2)-wallthick-gap,(bottom_height)/2])
cube_fillet_inside([width,depth,bottom_height],
vertical=[0,0,0,0], top=[0,0,0,0],
bottom=[fillet,fillet,fillet,fillet,fillet], $fn=90);
translate([(width/2)-wallthick-gap,(depth/2)-wallthick-gap,(bottom_height/2)+floorthick])
cube_fillet_inside([width-(wallthick*2),depth-(wallthick*2),bottom_height+adj],
vertical=[c_fillet-1,c_fillet-1,c_fillet-1,c_fillet-1],
top=[0,0,0,0],bottom=[2,2,2,2], $fn=90);
}
// right side nut
translate([width-wallthick-gap-wallthick-4+adj,wallthick+gap+10,
floorthick+3.4]) rotate([90,0,90])
cylinder(d=10, h=4, $fn=6);
// left side nut
translate([-adj-gap,wallthick+gap+10,floorthick+3.4])
rotate([90,0,90]) cylinder(d=10, h=4, $fn=6);
if(depth >= 75 && sbc_model != "visionfive2" && sbc_model != "visionfive2q" && sbc_model != "rock5b-v1.42" && sbc_model != "rock5bq-v1.42" && sbc_model != "rock5b-v1.3") {
translate([width-wallthick-gap-wallthick-4+adj,depth-wallthick-gap-10,
floorthick+3.4]) rotate([90,0,90]) cylinder(d=10, h=4, $fn=6);
translate([-adj-gap,depth-wallthick-gap-10,floorthick+3.4])
rotate([90,0,90]) cylinder(d=10, h=4, $fn=6);
}
else {
if(sbc_model == "visionfive2" || sbc_model == "visionfive2q" || sbc_model == "rock5b-v1.42" || sbc_model == "rock5bq-v1.42" || sbc_model == "rock5b-v1.3") {
translate([width-wallthick-gap-wallthick-4+adj,wallthick+gap+58,
floorthick+3.4]) rotate([90,0,90]) cylinder(d=10, h=4, $fn=6);
translate([-adj-gap,wallthick+gap+58,floorthick+3.4])
rotate([90,0,90]) cylinder(d=10, h=4, $fn=6);
}
else {
translate([width-wallthick-gap-wallthick-4+adj,wallthick+gap+40,
floorthick+3.4]) rotate([90,0,90]) cylinder(d=10, h=4, $fn=6);
translate([-adj-gap,wallthick+gap+40,floorthick+3.4])
rotate([90,0,90]) cylinder(d=10, h=4, $fn=6);
}
}
// front panel
if(case_style == "sides" || case_style == "vu5" || case_style == "vu7") {
translate([-wallthick-gap,depth-(2*wallthick)-gap,bottom_height-adj])
rotate([0,0,0]) cube([width,wallthick,top_height]);
}
else {
translate([-wallthick-gap,depth-(2*wallthick)-gap,bottom_height-adj])
rotate([0,0,0]) cube([width,wallthick,top_height-floorthick]);
}
// rear panel
translate([-wallthick-gap,-wallthick-gap,bottom_height-adj])
cube([width,wallthick,top_height-floorthick]);
}
if(case_design == "round") {
difference() {
translate([pcb_width/2,pcb_depth/2,bottom_height/2]) rotate([0,0,30])
cylinder_fillet_inside(h=bottom_height, r=case_diameter/2,
top=0, bottom=fillet, $fn=case_fn, fillet_fn=case_ffn, center=true);
translate([pcb_width/2,pcb_depth/2,(bottom_height/2)+floorthick]) rotate([0,0,30])
cylinder_fillet_inside(h=bottom_height+adj, r=(case_diameter/2)-lip/2,
top=0, bottom=fillet-1, $fn=case_fn, fillet_fn=case_ffn, center=true);
difference() {
translate([pcb_width/2,pcb_depth/2,bottom_height-lip]) rotate([0,0,30])
cylinder(h=lip+adj, r=(case_diameter/2)+1, $fn=case_fn);
translate([pcb_width/2,pcb_depth/2,bottom_height-lip]) rotate([0,0,30])
cylinder(h=lip+2*adj, r=(case_diameter/2)-lip/4, $fn=case_fn);
}
}
difference() {
translate([pcb_width/2,pcb_depth/2,(bottom_height/2)+2*floorthick]) rotate([0,0,30])
cylinder_fillet_inside(h=bottom_height+adj+floorthick+lip,
r=(case_diameter/2)-lip/2,top=0,bottom=fillet-1, $fn=case_fn,
fillet_fn=case_ffn, center=true);
if(width/depth >= 1.4 && sbc_model != "vim1" && sbc_model != "vim2" &&
sbc_model != "vim3l" && sbc_model != "vim3" && sbc_model != "vim4" &&
sbc_model != "rpizero" && sbc_model != "rpizero2w") {
translate([-16,(depth/2)-150,-adj])
cube([width+10,300,case_z-2*floorthick-2]);
translate([width-9,(depth/2)-62.5,bottom_height-2*adj])
cube([20,110,top_height-2*floorthick-2]);
}
else {
translate([-width/2,0,-adj])
cube([300,depth+100,case_z-2*floorthick-2]);
translate([(-width+50)/2,-50,bottom_height-2*adj])
cube([width+50,50+adj,top_height-2*floorthick-2]);
}
}
}
if(case_design == "hex") {
if(width/depth >= 1.4 && sbc_model != "vim1" && sbc_model != "vim2" &&
sbc_model != "vim3l" && sbc_model != "vim3" && sbc_model != "vim4" &&
sbc_model != "rpizero" && sbc_model != "rpizero2w") {
difference() {
translate([pcb_width/2,pcb_depth/2,bottom_height/2]) rotate([0,0,30])
cylinder_fillet_inside(h=bottom_height, r=case_diameter/2,
top=0, bottom=fillet, $fn=6, fillet_fn=case_ffn, center=true);
translate([pcb_width/2,pcb_depth/2,(bottom_height/2)+floorthick]) rotate([0,0,30])
cylinder_fillet_inside(h=bottom_height+adj,r=(case_diameter/2)-lip/2,top=0,
bottom=fillet-1,$fn=6,fillet_fn=case_ffn, center=true);
difference() {
translate([pcb_width/2,pcb_depth/2,bottom_height-lip]) rotate([0,0,30])
cylinder(h=lip+adj,r=(case_diameter/2)+1, $fn=6);
translate([pcb_width/2,pcb_depth/2,bottom_height-lip]) rotate([0,0,30])
cylinder(h=lip+2*adj,r=(case_diameter/2)-lip/4, $fn=6);
}
}
difference() {
translate([pcb_width/2,pcb_depth/2,(bottom_height/2)+2*floorthick]) rotate([0,0,30])
cylinder_fillet_inside(h=bottom_height+adj+floorthick+lip,
r=(case_diameter/2)-lip/2,top=0, bottom=fillet-1, $fn=6,
fillet_fn=case_ffn, center=true);
translate([-16,(depth/2)-150,-adj])
cube([width+10,300,case_z-2*floorthick-2]);
translate([width-9,(depth/2)-62.5,bottom_height-2*adj])
cube([20,110,top_height-2*floorthick-2]);
}
}
else {
difference() {
translate([pcb_width/2,pcb_depth/2,bottom_height/2]) rotate([0,0,0])
cylinder_fillet_inside(h=bottom_height, r=hex_diameter/2,
top=0, bottom=fillet, $fn=6, fillet_fn=case_ffn, center=true);
translate([pcb_width/2,pcb_depth/2,(bottom_height/2)+floorthick]) rotate([0,0,0])
cylinder_fillet_inside(h=bottom_height+adj,r=(hex_diameter/2)-lip/2,top=0,
bottom=fillet-1,$fn=6,fillet_fn=case_ffn, center=true);
difference() {
translate([pcb_width/2,pcb_depth/2,bottom_height-lip]) rotate([0,0,0])
cylinder(h=lip+adj,r=(hex_diameter/2)+1, $fn=6);
translate([pcb_width/2,pcb_depth/2,bottom_height-lip]) rotate([0,0,0])
cylinder(h=lip+2*adj,r=(hex_diameter/2)-lip/4, $fn=6);
}
}
difference() {
translate([pcb_width/2,pcb_depth/2,(bottom_height/2)+2*floorthick]) rotate([0,0,0])
cylinder_fillet_inside(h=bottom_height+adj+floorthick+lip,
r=(hex_diameter/2)-lip/2,top=0, bottom=fillet-1, $fn=6,
fillet_fn=case_ffn, center=true);
translate([-width/2,0,-adj])
cube([300,depth+100,case_z-2*floorthick-2]);
translate([(-width+50)/2,-50,bottom_height-2*adj])
cube([width+50,50+adj,top_height-2*floorthick-2]);
}
}
}
if(case_design == "snap") {
difference() {
translate([(width/2)-wallthick-gap,(depth/2)-wallthick-gap,(floorthick+case_z)/2])
cube_fillet_inside([width,depth,floorthick+case_z],
vertical=[c_fillet,c_fillet,c_fillet,c_fillet],
top=[0,0,0,0], bottom=[fillet,fillet,fillet,fillet,fillet], $fn=90);
translate([(width/2)-wallthick-gap,(depth/2)-wallthick-gap,floorthick+(floorthick+case_z)/2])
cube_fillet_inside([width-(wallthick*2),depth-(wallthick*2),case_z+floorthick],
vertical=[c_fillet-1,c_fillet-1,c_fillet-1,c_fillet-1],
top=[0,0,0,0], bottom=[fillet,fillet,fillet,fillet,fillet], $fn=90);
// snap top indent
translate([-gap-wallthick+.75,(depth/2)-(depth*.75)/2-gap-wallthick,case_z-.5])
rotate([0,45,0]) cube([4,depth*.75,4]);
translate([width-wallthick-gap-6.25,(depth/2)-(depth*.75)/2-gap-wallthick,case_z-.5])
rotate([0,45,0]) cube([4,depth*.75,4]);
}
}
if(case_design == "fitted") {
difference() {
translate([(width/2)-wallthick-gap,(depth/2)-wallthick-gap,case_z/2])
cube_fillet_inside([width,depth,case_z],
vertical=[c_fillet,c_fillet,c_fillet,c_fillet],
top=[0,0,0,0], bottom=[fillet,fillet,fillet,fillet,fillet], $fn=90);
translate([(width/2)-wallthick-gap,
(depth/2)-wallthick-gap,(case_z/2)+floorthick])
cube_fillet_inside([width-(wallthick*2),depth-(wallthick*2),case_z],
vertical=[c_fillet-1,c_fillet-1,c_fillet-1,c_fillet-1],
top=[0,0,0,0], bottom=[fillet,fillet,fillet,fillet,fillet], $fn=90);
difference() {
translate([(width/2)-wallthick-gap,(depth/2)-wallthick-gap,case_z-lip/2])
cube_fillet_inside([width+adj,depth+adj,lip+adj],
vertical=[c_fillet,c_fillet,c_fillet,c_fillet],
top=[0,0,0,0],bottom=[fillet,fillet,fillet,fillet,fillet], $fn=90);
translate([(width/2)-wallthick-gap,(depth/2)-wallthick-gap,case_z-lip/2])
cube_fillet_inside([width-wallthick,depth-wallthick,lip+adj],
vertical=[c_fillet-1,c_fillet-1,c_fillet-1,c_fillet-1],top=[0,0,0,0],
bottom=[fillet,fillet,fillet,fillet,fillet], $fn=90);
}
}
}
// additive accessories
if(accessory_name != "none") {
for (i=[1:15:len(accessory_data[a[0]])-1]) {
class = accessory_data[a[0]][i];
type = accessory_data[a[0]][i+1];
loc_x = accessory_data[a[0]][i+2];
loc_y = accessory_data[a[0]][i+3];
loc_z = accessory_data[a[0]][i+4];
face = accessory_data[a[0]][i+5];
rotation = accessory_data[a[0]][i+6];
parametric = accessory_data[a[0]][i+7];
size_x = accessory_data[a[0]][i+8];
size_y = accessory_data[a[0]][i+9];
size_z = accessory_data[a[0]][i+10];
data_1 = accessory_data[a[0]][i+11];
data_2 = accessory_data[a[0]][i+12];
data_3 = accessory_data[a[0]][i+13];
data_4 = accessory_data[a[0]][i+14];
if(class == "add1" && face == "bottom") {
parametric_move_add(type,loc_x,loc_y,loc_z,face,rotation,parametric,
size_x,size_y,size_z,data_1,data_2,data_3,data_4);
}
}
}
}
// side attachment holes
if(case_design == "tray") {
// right side bottom attachment holes
translate([width-2*(wallthick+gap)-sidethick-adj,wallthick+gap+10,
floorthick+3.4]) rotate([0,90,0]) cylinder(d=3, h=10+sidethick+(2*adj));
// right side bottom nut inset
translate([width-3.5-(2*wallthick)-gap-.6,wallthick+gap+10,
floorthick+3.4]) rotate([90,0,90]) cylinder(d=6.6, h=3.5, $fn=6);
// left side bottom attachment holes
translate([-wallthick-gap-adj,wallthick+gap+10,floorthick+3.4]) rotate([0,90,0])
cylinder(d=3, h=10+sidethick+(2*adj));
// left side bottom nut inset
translate([-gap+.6,wallthick+gap+10,floorthick+3.4])
rotate([90,0,90]) cylinder(d=6.6, h=3.5, $fn=6);
if(depth >= 75 && sbc_model != "visionfive2" && sbc_model != "visionfive2q" && sbc_model != "rock5b-v1.42" && sbc_model != "rock5bq-v1.42" && sbc_model != "rock5b-v1.3") {
translate([width-2*(wallthick+gap)-sidethick-adj,depth-wallthick-gap-10,
floorthick+3.4]) rotate([0,90,0])
cylinder(d=3, h=10+sidethick+(2*adj));
translate([-wallthick-gap-adj-6,depth-wallthick-gap-10,
floorthick+3.4]) rotate([0,90,0])
cylinder(d=3, h=10+sidethick+(2*adj));
translate([width-3.5-(2*wallthick)-gap-.6,depth-wallthick-gap-10,
floorthick+3.4])rotate([90,0,90]) cylinder(d=6.6, h=3.5, $fn=6);
translate([-gap+.6,depth-wallthick-gap-10,floorthick+3.4])
rotate([90,0,90]) cylinder(d=6.6, h=3.5, $fn=6);
}
else {
if(sbc_model == "visionfive2" || sbc_model == "visionfive2q" || sbc_model == "rock5b-v1.42" || sbc_model == "rock5bq-v1.42" || sbc_model == "rock5b-v1.3") {
translate([width-3*(wallthick+gap)-adj,wallthick+gap+58,
floorthick+3.4]) rotate([0,90,0])
cylinder(d=3, h=10+sidethick+(2*adj));
translate([-wallthick-gap-adj-6,wallthick+gap+58,
floorthick+3.4]) rotate([0,90,0])
cylinder(d=3, h=10+sidethick+(2*adj));
translate([width-3.5-(2*wallthick)-gap-.6,wallthick+gap+58,
floorthick+3.4])rotate([90,0,90]) cylinder(d=6.6, h=3.5, $fn=6);
translate([-gap+.6,wallthick+gap+58,floorthick+3.4])
rotate([90,0,90]) cylinder(d=6.6, h=3.5, $fn=6);
}
else {
translate([width-3*(wallthick+gap)-adj,wallthick+gap+40,
floorthick+3.4]) rotate([0,90,0]) cylinder(d=3, h=10+sidethick+(2*adj));
translate([-wallthick-gap-adj-6,wallthick+gap+40,
floorthick+3.4]) rotate([0,90,0]) cylinder(d=3, h=10+sidethick+(2*adj));
translate([width-3.5-(2*wallthick)-gap-.6,wallthick+gap+40,
floorthick+3.4])rotate([90,0,90]) cylinder(d=6.6, h=3.5, $fn=6);
translate([-gap+.6,wallthick+gap+40,floorthick+3.4])
rotate([90,0,90]) cylinder(d=6.6, h=3.5, $fn=6);
}
}
}
// pcb standoff holes
if(sbc_bottom_standoffs == true && bottom_standoff[5] != 4) {
for (i=[1:11:len(sbc_data[s[0]])-2]) {
class = sbc_data[s[0]][i+1];
type = sbc_data[s[0]][i+2];
id = sbc_data[s[0]][i+3];
pcb_hole_x = sbc_data[s[0]][i+4];
pcb_hole_y = sbc_data[s[0]][i+5];
pcb_hole_z = sbc_data[s[0]][i+6];
pcb_hole_size = sbc_data[s[0]][i+9][0];
pcb_hole_pos = sbc_data[s[0]][i+10][4];
if(class == "pcbhole" && id == pcb_id && (pcb_hole_pos == "left_rear" || pcb_hole_pos == "left_front" || pcb_hole_pos == "right_rear" || pcb_hole_pos == "right_front")) {
translate([pcb_hole_x,pcb_hole_y,-1]) cylinder(d=6.5, h=bottom_height);
}
}
}
// extended standoff holes
if(case_ext_standoffs == true) {
// right-rear standoff
if(width-pcb_loc_x-pcb_width >= 10 || pcb_loc_y >= 10) {
translate([width-(2*(wallthick+gap))-(c_fillet/2),(c_fillet/2),-1]) cylinder(d=6.5, h=bottom_height);
}
// right-front standoff
if((width-pcb_loc_x-pcb_width >= 10 && depth-pcb_loc_y-pcb_depth >= 10) || width-pcb_loc_x-pcb_width >= 10) {
translate([width-(c_fillet/2)-(2*(wallthick+gap)),
depth-(c_fillet/2)-(2*(wallthick+gap)),-1]) cylinder(d=6.5, h=bottom_height);
}
// left-rear standoff
if(pcb_loc_x >= 10 || pcb_loc_y >= 10) {
translate([(c_fillet/2),(c_fillet/2),-1]) cylinder(d=6.5, h=bottom_height);
}
// left-front standoff
if(pcb_loc_x >= 10 || depth-pcb_loc_y-pcb_depth >= 10) {
translate([(c_fillet/2),depth-(c_fillet/2)-(2*(wallthick+gap)),-1])
cylinder(d=6.5, h=bottom_height);
}
}
}
// pcb standoffs
if(sbc_bottom_standoffs == true) {
for (i=[1:11:len(sbc_data[s[0]])-2]) {
class = sbc_data[s[0]][i+1];
type = sbc_data[s[0]][i+2];
id = sbc_data[s[0]][i+3];
pcb_hole_x = sbc_data[s[0]][i+4];
pcb_hole_y = sbc_data[s[0]][i+5];
pcb_hole_z = sbc_data[s[0]][i+6];
pcb_hole_size = sbc_data[s[0]][i+9][0];
pcb_hole_pos = sbc_data[s[0]][i+10][4];
if(pcb_hole_x!=0 && pcb_hole_y!=0) {
if (pcb_hole_pos == "left_rear") {
normal_standoff = [bottom_standoff[0],
bottom_height-pcb_z+pcb_loc_z+bottom_rear_left,
bottom_standoff[2],
bottom_standoff[3],
bottom_standoff[4],
bottom_standoff[5],
bottom_standoff[6],
bottom_standoff[7],
bottom_standoff[8],
bottom_standoff[9],
bottom_standoff[10]];
translate([pcb_hole_x,pcb_hole_y,0]) standoff(normal_standoff);
}
if (pcb_hole_pos == "left_front") {
normal_standoff = [bottom_standoff[0],
bottom_height-pcb_z+pcb_loc_z+bottom_front_left,
bottom_standoff[2],
bottom_standoff[3],
bottom_standoff[4],
bottom_standoff[5],
bottom_standoff[6],
bottom_standoff[7],
bottom_standoff[8],
bottom_standoff[9],
bottom_standoff[10]];
translate([pcb_hole_x,pcb_hole_y,0]) standoff(normal_standoff);
}
if (pcb_hole_pos == "right_rear") {
normal_standoff = [bottom_standoff[0],
bottom_height-pcb_z+pcb_loc_z+bottom_rear_right,
bottom_standoff[2],
bottom_standoff[3],
bottom_standoff[4],
bottom_standoff[5],
bottom_standoff[6],
bottom_standoff[7],
bottom_standoff[8],
bottom_standoff[9],
bottom_standoff[10]];
translate([pcb_hole_x,pcb_hole_y,0]) standoff(normal_standoff);
}
if (pcb_hole_pos == "right_front") {
normal_standoff = [bottom_standoff[0],
bottom_height-pcb_z+pcb_loc_z+bottom_front_right,
bottom_standoff[2],
bottom_standoff[3],
bottom_standoff[4],
bottom_standoff[5],
bottom_standoff[6],
bottom_standoff[7],
bottom_standoff[8],
bottom_standoff[9],
bottom_standoff[10]];
translate([pcb_hole_x,pcb_hole_y,0]) standoff(normal_standoff);
}
}
}
}
// extended standoffs
if(case_ext_standoffs == true) {
// right-rear standoff
if(width-pcb_loc_x-pcb_width >= 10 || pcb_loc_y >= 10) {
translate([width-(2*(wallthick+gap))-(c_fillet/2),(c_fillet/2),0]) standoff(bottom_ext_standoff);
}
// right-front standoff
if((width-pcb_loc_x-pcb_width >= 10 && depth-pcb_loc_y-pcb_depth >= 10) || width-pcb_loc_x-pcb_width >= 10) {
translate([width-(c_fillet/2)-(2*(wallthick+gap)),
depth-(c_fillet/2)-(2*(wallthick+gap)),0]) standoff(bottom_ext_standoff);
}
// left-rear standoff
if(pcb_loc_x >= 10 || pcb_loc_y >= 10) {
translate([(c_fillet/2),(c_fillet/2),0]) standoff(bottom_ext_standoff);
}
// left-front standoff
if(pcb_loc_x >= 10 || depth-pcb_loc_y-pcb_depth >= 10) {
translate([(c_fillet/2),depth-(c_fillet/2)-(2*(wallthick+gap)),0])
standoff(bottom_ext_standoff);
}
}
// standoff sidewall support
if(sidewall_support == true && sbc_bottom_standoffs == true) {
if(pcb_width/pcb_depth >= 1.4) {
for (i=[1:11:len(sbc_data[s[0]])-2]) {
pcb_hole_x = sbc_data[s[0]][i+4]+pcb_loc_x;
pcb_hole_y = sbc_data[s[0]][i+5]+pcb_loc_y;
pcb_hole_z = sbc_data[s[0]][i+6];
pcb_hole_size = sbc_data[s[0]][i+9][0];
pcb_hole_pos = sbc_data[s[0]][i+10][4];
if(pcb_hole_x!=0 && pcb_hole_y!=0) {
if(pcb_hole_pos == "left_rear") {
translate([pcb_hole_x-1, pcb_hole_y-(bottom_standoff[0]/2)-(gap+adj)-1,0])
cube([2,gap+1.6,bottom_height-pcb_z+pcb_loc_z+bottom_rear_left]);
}
if(pcb_hole_pos == "left_front") {
translate([pcb_hole_x-1, pcb_hole_y+(bottom_standoff[0]/2)-.6+adj,0])
cube([2,gap+1.6,bottom_height-pcb_z+pcb_loc_z+bottom_front_left]);
}
if(pcb_hole_pos == "right_rear") {
translate([pcb_hole_x-1, pcb_hole_y-(bottom_standoff[0]/2)-(gap+adj)-1,0])
cube([2,gap+1.6,bottom_height-pcb_z+pcb_loc_z+bottom_rear_right]);
}
if(pcb_hole_pos == "right_front") {
translate([pcb_hole_x-1, pcb_hole_y+(bottom_standoff[0]/2)-.6+adj,0])
cube([2,gap+1.6,bottom_height-pcb_z+pcb_loc_z+bottom_front_right]);
}
}
}
}
else {
for (i=[1:11:len(sbc_data[s[0]])-2]) {
pcb_hole_x = sbc_data[s[0]][i+4]+pcb_loc_x;
pcb_hole_y = sbc_data[s[0]][i+5]+pcb_loc_y;
pcb_hole_z = sbc_data[s[0]][i+6];
pcb_hole_size = sbc_data[s[0]][i+9][0];
pcb_hole_pos = sbc_data[s[0]][i+10][4];
if(pcb_hole_x!=0 && pcb_hole_y!=0) {
if(pcb_hole_pos == "left_rear" && sbc_model != "n2l") {
translate([pcb_hole_x-(bottom_standoff[0]/2)-2.6+adj, pcb_hole_y-gap,0])
cube([gap+1.6,2,bottom_height-pcb_z+pcb_loc_z+bottom_rear_left]);
}
if (pcb_hole_pos == "left_rear" && sbc_model == "n2l") {
translate([pcb_hole_x-1, pcb_hole_y-(bottom_standoff[0]/2)-(gap+adj)-1,0])
cube([2,gap+1.6,bottom_height-pcb_z+pcb_loc_z+bottom_rear_left]);
}
if(pcb_hole_pos == "left_front" && sbc_model != "n2l") {
translate([pcb_hole_x-(bottom_standoff[0]/2)-2.6+adj, pcb_hole_y-gap,0])
cube([gap+1.6,2,bottom_height-pcb_z+pcb_loc_z+bottom_front_left]);
}
if(pcb_hole_pos == "left_front" && sbc_model == "n2l") {
translate([pcb_hole_x-1, pcb_hole_y+(bottom_standoff[0]/2)-.6+adj,0])
cube([2,gap+1.6,bottom_height-pcb_z+pcb_loc_z+bottom_front_left]);
}
if (pcb_hole_pos == "right_rear") {
translate([pcb_hole_x+(bottom_standoff[0]/2)-.5+adj, pcb_hole_y-gap,0])
cube([gap+1.5,2,bottom_height-pcb_z+pcb_loc_z+bottom_rear_right]);
}
if (pcb_hole_pos == "right_front") {
translate([pcb_hole_x+(bottom_standoff[0]/2)-.5+adj, pcb_hole_y-gap,0])
cube([gap+1.5,2,bottom_height-pcb_z+pcb_loc_z+bottom_front_right]);
}
}
}
}
}
// extended standoff sidewall support
if(case_ext_standoffs == true && sidewall_support == true) {
// right-rear standoff
if(width-pcb_loc_x-pcb_width >= 10 || pcb_loc_y >= 10) {
translate([width-(2*(wallthick+gap))-(c_fillet/2)+(bottom_ext_standoff[0]/2)-.5,
(c_fillet/2)-1,0]) cube([gap+adj+2,2,bottom_ext_standoff[1]]);
}
// right-front standoff
if((width-pcb_loc_x-pcb_width >= 10 && depth-pcb_loc_y-pcb_depth >= 10)
|| width-pcb_loc_x-pcb_width >= 10) {
translate([width-(2*(wallthick+gap))-(c_fillet/2)+(bottom_ext_standoff[0]/2)-.5,
depth-(c_fillet/2)-(2*(wallthick+gap))-1,0])
cube([gap+adj+2,2,bottom_ext_standoff[1]]);
}
// left-rear standoff
if(pcb_loc_x >= 10 || pcb_loc_y >= 10) {
translate([(c_fillet/2)-(wallthick+gap)-(bottom_ext_standoff[0]/2)+.6,
(c_fillet/2)-1,0]) cube([gap+adj+2,2,bottom_ext_standoff[1]]);
}
// left-front standoff
if(pcb_loc_x >= 10 || depth-pcb_loc_y-pcb_depth >= 10) {
translate([(c_fillet/2)-(wallthick+gap)-(bottom_ext_standoff[0]/2)+.6,
depth-(c_fillet/2)-(2*(wallthick+gap))-1,0])
cube([gap+adj+2,2,bottom_ext_standoff[1]]);
}
}
}
// subtractive accessories
if(accessory_name != "none") {
for (i=[1:15:len(accessory_data[a[0]])-1]) {
class = accessory_data[a[0]][i];
type = accessory_data[a[0]][i+1];
loc_x = accessory_data[a[0]][i+2];
loc_y = accessory_data[a[0]][i+3];
loc_z = accessory_data[a[0]][i+4];
face = accessory_data[a[0]][i+5];
rotation = accessory_data[a[0]][i+6];
parametric = accessory_data[a[0]][i+7];
size_x = accessory_data[a[0]][i+8];
size_y = accessory_data[a[0]][i+9];
size_z = accessory_data[a[0]][i+10];
data_1 = accessory_data[a[0]][i+11];
data_2 = accessory_data[a[0]][i+12];
data_3 = accessory_data[a[0]][i+13];
data_4 = accessory_data[a[0]][i+14];
if ((class == "sub" && face == "bottom") || class == "suball") {
if(accessory_highlight == false) {
parametric_move_sub(type,loc_x,loc_y,loc_z,face,rotation,parametric,
size_x,size_y,size_z,data_1,data_2,data_3,data_4);
}
else {
#parametric_move_sub(type,loc_x,loc_y,loc_z,face,rotation,parametric,
size_x,size_y,size_z,data_1,data_2,data_3,data_4);
}
}
// 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_1,data_2,data_3,data_4);
}
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_1,data_2,data_3,data_4);
}
else {
#parametric_move_sub("microusb",loc_x+5.25,loc_y-5,loc_z+4,face,rotation,parametric,
0,0,0,data_1,data_2,data_3,data_4);
}
}
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,data_1,data_2,data_3,[.1,.1,.1,.1]);
}
if ((class == "add1" || class == "add2") && face == "bottom" && type == "access_port") {
if(data_3 == "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,data_1,data_2,data_3,[.1,.1,.1,.1]);
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,data_1,data_2,data_3,[5.5,5.5,5.5,5.5]);
}
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,data_1,data_2,data_3,[.1,.1,.1,.1]);
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,data_1,data_2,data_3,[5.5,5.5,5.5,5.5]);
}
}
else {
if(rotation[2] == 180) {
if(data_3 == "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,data_1,data_2,data_3,[.1,.1,.1,.1]);
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,data_1,data_2,data_3,
[5.5,5.5,5.5,5.5]);
}
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,data_1,data_2,data_3,[.1,.1,.1,.1]);
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,data_1,data_2,data_3,[5.5,5.5,5.5,5.5]);
}
}
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,data_1,data_2,data_3,[.1,.1,.1,.1]);
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,data_1,data_2,data_3,[5.5,5.5,5.5,5.5]);
}
}
}
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,data_1,data_2,data_3,[1,1,1,1]);
}
if ((class == "add1" || class == "add2") && face == "bottom" && type == "button") {
if(data_3 == "recess") {
#parametric_move_sub("sphere",loc_x,loc_y,loc_z,face,rotation,
parametric,size_x-1,size_y,size_z,data_1,data_2,data_3,0);
}
if(data_3 == "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,data_1,data_2,data_3,[.1,.1,.1,.1]);
}
}
}
}
// sbc openings
if(sbc_highlight == true) {
#translate([pcb_loc_x ,pcb_loc_y,bottom_height-pcb_z+pcb_loc_z-adj]) sbc(sbc_model,"default",0,"default","default",true);
}
else {
translate([pcb_loc_x ,pcb_loc_y,bottom_height-pcb_z+pcb_loc_z-adj]) sbc(sbc_model,"default",0,"default","default",true);
}
// clean fillets
if(case_design == "shell") {
translate([(width/2)-wallthick-gap,(depth/2)-wallthick-gap,bottom_height/2])
cube_negative_fillet([width,depth,bottom_height], radius=-1,
vertical=[c_fillet,c_fillet,c_fillet,c_fillet], top=[0,0,0,0],
bottom=[fillet,fillet,fillet,fillet,fillet], $fn=90);
}
}
// additive accessories
if(accessory_name != "none") {
for (i=[1:15:len(accessory_data[a[0]])-1]) {
class = accessory_data[a[0]][i];
type = accessory_data[a[0]][i+1];
loc_x = accessory_data[a[0]][i+2];
loc_y = accessory_data[a[0]][i+3];
loc_z = accessory_data[a[0]][i+4];
face = accessory_data[a[0]][i+5];
rotation = accessory_data[a[0]][i+6];
parametric = accessory_data[a[0]][i+7];
size_x = accessory_data[a[0]][i+8];
size_y = accessory_data[a[0]][i+9];
size_z = accessory_data[a[0]][i+10];
data_1 = accessory_data[a[0]][i+11];
data_2 = accessory_data[a[0]][i+12];
data_3 = accessory_data[a[0]][i+13];
data_4 = accessory_data[a[0]][i+14];
if(class == "add2" && face == "bottom") {
parametric_move_add(type,loc_x,loc_y,loc_z,face,rotation,parametric,
size_x,size_y,size_z,data_1,data_2,data_3,data_4);
}
}
}
}

322
mod/case_side.scad Normal file
View File

@@ -0,0 +1,322 @@
// case side
module case_side(case_design,case_style,side) {
difference() {
union() {
if(case_design == "panel") {
if(side == "rear") {
difference() {
union() {
translate([-gap,-wallthick-gap,-floorthick])
cube([width-2*wallthick,wallthick,case_z+2*floorthick]);
// right hook
difference() {
translate([width-(2*wallthick)-gap-adj,-wallthick-gap,
((case_z)/2)-4])
cube([(2*wallthick)+.5,wallthick,8]);
translate([width-(2*wallthick)-gap-adj,-wallthick-gap-adj,
((case_z)/2)-4-adj])
cube([wallthick+.25,wallthick+(2*adj),4.25]);
}
// left hook
difference() {
translate([-(2*wallthick)-gap-adj-.25,-wallthick-gap,
((case_z)/2)-4])
cube([(2*wallthick)+.5,wallthick,8]);
translate([-wallthick-gap-adj-.25,-wallthick-gap-adj,
((case_z)/2)-4-adj])
cube([wallthick+.25,wallthick+(2*adj),4.25]);
}
}
// top slots
translate([(width*(1/5))-8.25-(wallthick+gap),-wallthick-gap-adj,
case_z-floorthick-.25])
cube([8.5,wallthick+2*adj,floorthick+.5]);
translate([width-(width*(1/5))-(wallthick+gap)-.25,-wallthick-gap-adj,
case_z-floorthick-.25])
cube([8.5,wallthick+2*adj,floorthick+.5]);
// bottom slots
translate([(width*(1/5))-8.25-(wallthick+gap),-wallthick-gap-adj,-.25])
cube([8.5,wallthick+2*adj,floorthick+.5]);
translate([width-(width*(1/5))-(wallthick+gap)-.25,-wallthick-gap-adj,-.25])
cube([8.5,wallthick+2*adj,floorthick+.5]);
}
}
if(side == "front") {
difference() {
union() {
translate([-gap,depth-2*(wallthick)-gap,-floorthick])
cube([width-2*wallthick,wallthick,case_z+2*floorthick]);
// right hook
difference() {
translate([width-(2*wallthick)-gap-adj,depth-2*(wallthick)-gap-adj,
((case_z)/2)-4])
cube([(2*wallthick)+.5,wallthick,8]);
translate([width-(2*wallthick)-gap-adj,
depth-2*(wallthick)-adj-gap-adj,((case_z)/2)-4-adj])
cube([wallthick+.25,wallthick+(2*adj),4.25]);
}
// left hook
difference() {
translate([-(2*wallthick)-gap-adj-.25,depth-2*(wallthick)-gap-adj,(
(case_z)/2)-4])
cube([(2*wallthick)+.5,wallthick,8]);
translate([-wallthick-gap-adj-.25,depth-2*(wallthick)-adj-gap-adj,
((case_z)/2)-4-adj])
cube([wallthick+.25,wallthick+(2*adj),4.25]);
}
}
// top slots
translate([(width*(1/5))-8.25-(wallthick+gap),depth-2*wallthick-gap-adj,
case_z-floorthick-.25])
cube([8.5,wallthick+2*adj,floorthick+.5]);
translate([width-(width*(1/5))-(wallthick+gap)-.25,depth-2*wallthick-gap-adj,
case_z-floorthick-.25])
cube([8.5,wallthick+2*adj,floorthick+.5]);
// bottom slots
translate([(width*(1/5))-8.25-(wallthick+gap),depth-2*wallthick-gap-adj,-.25])
cube([8.5,wallthick+2*adj,floorthick+.5]);
translate([width-(width*(1/5))-(wallthick+gap)-.25,
depth-2*wallthick-gap-adj,-.25]) cube([8.5,wallthick+2*adj,floorthick+.5]);
}
}
if(side == "right") {
difference() {
translate([width-(2*wallthick)-gap,-(2*wallthick)-gap,-wallthick])
cube([wallthick,depth+2*wallthick,case_z+(2*wallthick)]);
translate([width-(2*wallthick)-gap-adj,-wallthick-gap-.25,
((case_z)/2)]) cube([wallthick+2*adj,wallthick+.5,8.5]);
translate([width-(2*wallthick)-gap-adj,depth-2*(wallthick)-gap-.25,
((case_z)/2)])
cube([wallthick+2*adj,wallthick+.5,8.5]);
}
}
if(side == "left") {
difference() {
translate([-wallthick-gap,-(2*wallthick)-gap,-wallthick])
cube([wallthick,depth+2*wallthick,case_z+(2*wallthick)]);
translate([-wallthick-gap-adj,-wallthick-gap-.25,((case_z)/2)])
cube([wallthick+2*adj,wallthick+.5,8.5]);
translate([-wallthick-gap-adj,depth-2*(wallthick)-gap-.25,
((case_z)/2)])
cube([wallthick+2*adj,wallthick+.5,8.5]);
}
}
}
if(case_design == "tray" && case_style == "sides") {
if(side == "right") {
difference() {
union() {
translate([width-wallthick-gap,-(2*wallthick)-gap,0])
cube([sidethick,depth+2*wallthick,case_z+(2*wallthick)]);
translate([width-gap-wallthick-1+adj,depth-2*(wallthick+gap)-.5,case_z+(2*wallthick)-2])
cube([1,6,2]);
translate([width-gap-wallthick-1+adj,-2*(wallthick+gap)+1.5,case_z+(2*wallthick)-2])
cube([1,6,2]);
// top rail
translate([width-6.9-adj,-gap,case_z-floorthick-.5])
cube([4,depth-2*(wallthick+gap),2]);
}
// right side bottom attachment holes
translate([width-2*(wallthick+gap)-sidethick-adj,wallthick+gap+10,
((bottom_height+floorthick)/2)-1]) rotate([0,90,0]) cylinder(d=3, h=10+sidethick+(2*adj));
if(depth >= 75) {
translate([width-2*(wallthick+gap)-sidethick-adj,depth-wallthick-gap-10,
((bottom_height+floorthick)/2)-1]) rotate([0,90,0])
cylinder(d=3, h=10+sidethick+(2*adj));
}
else {
translate([width-2*(wallthick+gap)-sidethick-adj,wallthick+gap+40,
((bottom_height+floorthick)/2)-1]) rotate([0,90,0])
cylinder(d=3, h=10+sidethick+(2*adj));
}
}
}
if(side == "left") {
difference() {
union() {
translate([-wallthick-gap-sidethick,-(2*wallthick)-gap,0])
cube([sidethick,depth+2*wallthick,case_z+(2*wallthick)]);
translate([-gap-wallthick-adj,depth-2*(wallthick+gap)-.5,case_z+(2*wallthick)-2])
cube([1,6,2]);
translate([-gap-wallthick-adj,-2*(wallthick+gap)+1.5,case_z+(2*wallthick)-2])
cube([1,6,2]);
// top rail
translate([-wallthick-gap-adj,-gap,case_z-floorthick-.5])
cube([4,depth-2*(wallthick+gap),2]);
}
// left side bottom attachment holes
translate([-wallthick-gap-adj-5,wallthick+gap+10,
((bottom_height+floorthick)/2)-1]) rotate([0,90,0]) cylinder(d=3, h=10+sidethick+(2*adj));
if(depth >= 75) {
translate([-wallthick-gap-adj-6,depth-wallthick-gap-10,
((bottom_height+floorthick)/2)-1]) rotate([0,90,0])
cylinder(d=3, h=10+sidethick+(2*adj));
}
else {
translate([-wallthick-gap-adj-6,wallthick+gap+40,
((bottom_height+floorthick)/2)-1]) rotate([0,90,0])
cylinder(d=3, h=10+sidethick+(2*adj));
}
}
}
}
if(case_design == "tray" && case_style == "vu5") {
cheight = case_z+90;
vesa = 75;
vu_holder(case_style,side,vesa,cheight);
}
if(case_design == "tray" && case_style == "vu7") {
cheight = case_z+122;
vesa = 100;
vu_holder(case_style,side,vesa,cheight);
}
// additive accessories
if(accessory_name != "none") {
for (i=[1:15:len(accessory_data[a[0]])-1]) {
class = accessory_data[a[0]][i];
type = accessory_data[a[0]][i+1];
loc_x = accessory_data[a[0]][i+2];
loc_y = accessory_data[a[0]][i+3];
loc_z = accessory_data[a[0]][i+4];
face = accessory_data[a[0]][i+5];
rotation = accessory_data[a[0]][i+6];
parametric = accessory_data[a[0]][i+7];
size_x = accessory_data[a[0]][i+8];
size_y = accessory_data[a[0]][i+9];
size_z = accessory_data[a[0]][i+10];
data_1 = accessory_data[a[0]][i+11];
data_2 = accessory_data[a[0]][i+12];
data_3 = accessory_data[a[0]][i+13];
data_4 = accessory_data[a[0]][i+14];
if (class == "add1" && face == side) {
parametric_move_add(type,loc_x,loc_y,loc_z,face,rotation,parametric,
size_x,size_y,size_z,data_1,data_2,data_3,data_4);
}
}
}
}
if(accessory_name != "none") {
for (i=[1:15:len(accessory_data[a[0]])-1]) {
class = accessory_data[a[0]][i];
type = accessory_data[a[0]][i+1];
loc_x = accessory_data[a[0]][i+2];
loc_y = accessory_data[a[0]][i+3];
loc_z = accessory_data[a[0]][i+4];
face = accessory_data[a[0]][i+5];
rotation = accessory_data[a[0]][i+6];
parametric = accessory_data[a[0]][i+7];
size_x = accessory_data[a[0]][i+8];
size_y = accessory_data[a[0]][i+9];
size_z = accessory_data[a[0]][i+10];
data_1 = accessory_data[a[0]][i+11];
data_2 = accessory_data[a[0]][i+12];
data_3 = accessory_data[a[0]][i+13];
data_4 = accessory_data[a[0]][i+14];
if ((class == "sub" && face == side) || class == "suball") {
if(accessory_highlight == false) {
parametric_move_sub(type,loc_x,loc_y,loc_z,face,rotation,parametric,
size_x,size_y,size_z,data_1,data_2,data_3,data_4);
}
else {
#parametric_move_sub(type,loc_x,loc_y,loc_z,face,rotation,parametric,
size_x,size_y,size_z,data_1,data_2,data_3,data_4);
}
}
// create openings for additive
if ((class == "sub" && face == "bottom") || class == "suball") {
if(accessory_highlight == false) {
parametric_move_sub(type,loc_x,loc_y,loc_z,face,rotation,parametric,
size_x,size_y,size_z,data_1,data_2,data_3,data_4);
}
else {
#parametric_move_sub(type,loc_x,loc_y,loc_z,face,rotation,parametric,
size_x,size_y,size_z,data_1,data_2,data_3,data_4);
}
}
// 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_1,data_2,data_3,data_4);
}
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_1,data_2,data_3,data_4);
}
else {
#parametric_move_sub("microusb",loc_x+5.25,loc_y-5,loc_z+4,face,rotation,parametric,
0,0,0,data_1,data_2,data_3,data_4);
}
}
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,data_1,data_2,data_3,[.1,.1,.1,.1]);
}
if ((class == "add1" || class == "add2") && face == "bottom" && type == "access_port") {
if(data_3 == "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,data_1,data_2,data_3,[.1,.1,.1,.1]);
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,data_1,data_2,data_3,[5.5,5.5,5.5,5.5]);
}
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,data_1,data_2,data_3,[.1,.1,.1,.1]);
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,data_1,data_2,data_3,[5.5,5.5,5.5,5.5]);
}
}
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,data_1,data_2,data_3,[1,1,1,1]);
}
if ((class == "add1" || class == "add2") && face == "bottom" && type == "button") {
if(data_3 == "recess") {
parametric_move_sub("sphere",loc_x,loc_y,loc_z,face,rotation,
parametric,size_x-1,size_y,size_z,data_1,data_2,data_3,0);
}
if(data_3 == "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,data_1,data_2,data_3,[.1,.1,.1,.1]);
}
}
}
}
// sbc openings
if(sbc_highlight == true) {
#translate([pcb_loc_x ,pcb_loc_y,bottom_height-pcb_z+pcb_loc_z-adj]) sbc(sbc_model,"default",0,"default","default",true);
}
else {
translate([pcb_loc_x ,pcb_loc_y,bottom_height-pcb_z+pcb_loc_z-adj]) sbc(sbc_model,"default",0,"default","default",true);
}
}
if(accessory_name != "none") {
for (i=[1:15:len(accessory_data[a[0]])-1]) {
class = accessory_data[a[0]][i];
type = accessory_data[a[0]][i+1];
loc_x = accessory_data[a[0]][i+2];
loc_y = accessory_data[a[0]][i+3];
loc_z = accessory_data[a[0]][i+4];
face = accessory_data[a[0]][i+5];
rotation = accessory_data[a[0]][i+6];
parametric = accessory_data[a[0]][i+7];
size_x = accessory_data[a[0]][i+8];
size_y = accessory_data[a[0]][i+9];
size_z = accessory_data[a[0]][i+10];
data_1 = accessory_data[a[0]][i+11];
data_2 = accessory_data[a[0]][i+12];
data_3 = accessory_data[a[0]][i+13];
data_4 = accessory_data[a[0]][i+14];
if (class == "add2" && face == side) {
parametric_move_add(type,loc_x,loc_y,loc_z,face,rotation,parametric,
size_x,size_y,size_z,data_1,data_2,data_3,data_4);
}
}
}
}

595
mod/case_top.scad Normal file
View File

@@ -0,0 +1,595 @@
// case top
module case_top(case_design) {
difference() {
union() {
difference() {
union() {
if(case_design == "shell") {
difference() {
translate([(width/2)-wallthick-gap,
(depth/2)-wallthick-gap,bottom_height+(top_height/2)])
cube_fillet_inside([width,depth,top_height],
vertical=[c_fillet,c_fillet,c_fillet,c_fillet],
top=[fillet,fillet,fillet,fillet,fillet],
bottom=[0,0,0,0], $fn=90);
translate([(width/2)-wallthick-gap,(depth/2)-wallthick-gap,
bottom_height+(top_height/2)-floorthick])
cube_fillet_inside([width-(wallthick*2),depth-(wallthick*2),top_height],
vertical=[c_fillet-1,c_fillet-1,c_fillet-1,c_fillet-1],
top=[fillet,fillet,fillet,fillet,fillet],
bottom=[0,0,0,0], $fn=90);
}
}
if(case_design == "panel") {
union() {
translate([-gap,-gap,case_z-floorthick])
cube([width-(2*wallthick),depth-(2*wallthick),floorthick]);
translate([(width*(1/5))-8-(wallthick+gap),depth-(2*wallthick)-gap-adj,
case_z-floorthick])
cube([8,wallthick+2*adj,floorthick]);
translate([width-(width*(1/5))-(wallthick+gap),depth-(2*wallthick)-gap-adj,
case_z-floorthick])
cube([8,wallthick+2*adj,floorthick]);
translate([(width*(1/5))-8-(wallthick+gap),-wallthick-gap+adj,
case_z-floorthick])
cube([8,wallthick+2*adj,floorthick]);
translate([width-(width*(1/5))-(wallthick+gap),-wallthick-gap+adj,
case_z-floorthick])
cube([8,wallthick+2*adj,floorthick]);
}
}
if(case_design == "stacked") {
translate([(width/2)-wallthick-gap,(depth/2)-wallthick-gap,
case_z-(floorthick/2)])
cube_fillet_inside([width-(2*wallthick),depth-(2*wallthick),floorthick],
vertical=[c_fillet,c_fillet,c_fillet,c_fillet],
top=[0,0,0,0], bottom=[0,0,0,0], $fn=90);
}
if(case_design == "tray" && (case_style == "vu5" || case_style == "vu7" || case_style == "sides")) {
translate([-wallthick-gap+.5,-wallthick-gap,case_z])
cube([width-1,depth,floorthick]);
translate([-wallthick-gap+.5,-wallthick-gap,
case_z-floorthick+adj]) cube([width-1,wallthick,wallthick]);
}
if(case_design == "tray" && case_style == "none") {
difference() {
translate([(width/2)-wallthick-gap,(depth/2)-wallthick-gap,case_z/2])
cube_fillet_inside([width+2*wallthick+1,depth,case_z],
vertical=[0,0,0,0], top=[0,fillet,0,fillet,fillet],
bottom=[0,0,0,0], $fn=90);
translate([(width/2)-wallthick-gap,(depth/2)-wallthick-gap,(case_z/2)-floorthick+.25])
cube_fillet_inside([width+1,depth+(wallthick*2),case_z],
vertical=[c_fillet-1,c_fillet-1,c_fillet-1,c_fillet-1],
top=[0,0,0,0],bottom=[0,0,0,0], $fn=90);
// right side bottom attachment hole
translate([width-2*(wallthick+gap)-sidethick-adj,wallthick+gap+10,
floorthick+3.4]) rotate([0,90,0]) cylinder(d=3, h=10+sidethick+(2*adj));
// left side bottom attachment hole
translate([-2*(wallthick+gap)-sidethick-adj,wallthick+gap+10,
floorthick+3.4]) rotate([0,90,0]) cylinder(d=3, h=10+sidethick+(2*adj));
if(depth >= 75 && sbc_model != "visionfive2" && sbc_model != "visionfive2q"&& sbc_model != "rock5b-v1.42" && sbc_model != "rock5bq-v1.42" && sbc_model != "rock5b-v1.3") {
translate([width-2*(wallthick+gap)-sidethick-adj,depth-wallthick-gap-10,
floorthick+3.4]) rotate([0,90,0]) cylinder(d=3, h=10+sidethick+(2*adj));
translate([-wallthick-gap-adj-6,depth-wallthick-gap-10,
floorthick+3.4]) rotate([0,90,0]) cylinder(d=3, h=10+sidethick+(2*adj));
}
else {
if(sbc_model == "visionfive2" || sbc_model == "visionfive2q" || sbc_model == "rock5b-v1.42" || sbc_model == "rock5bq-v1.42" || sbc_model == "rock5b-v1.3") {
translate([width-2*(wallthick+gap)-sidethick-adj,wallthick+gap+58,
floorthick+3.4]) rotate([0,90,0]) cylinder(d=3, h=10+sidethick+(2*adj));
translate([-wallthick-gap-adj-6,wallthick+gap+58,
floorthick+3.4]) rotate([0,90,0]) cylinder(d=3, h=10+sidethick+(2*adj));
}
else {
translate([width-2*(wallthick+gap)-sidethick-adj,wallthick+gap+40,
floorthick+3.4]) rotate([0,90,0]) cylinder(d=3, h=10+sidethick+(2*adj));
translate([-wallthick-gap-adj-6,wallthick+gap+40,
floorthick+3.4]) rotate([0,90,0]) cylinder(d=3, h=10+sidethick+(2*adj));
}
}
}
}
if(case_design == "round") {
difference() {
translate([pcb_width/2,pcb_depth/2,bottom_height+(top_height/2)-lip/2]) rotate([0,0,30])
cylinder_fillet_inside(h=top_height+lip, r=case_diameter/2,
top=fillet, bottom=0, $fn=case_fn, fillet_fn=case_ffn, center=true);
translate([pcb_width/2,pcb_depth/2,bottom_height+(top_height/2)-floorthick-lip/2]) rotate([0,0,30])
cylinder_fillet_inside(h=top_height+lip, r=(case_diameter/2)-wallthick,
top=fillet-1, bottom=0, $fn=case_fn, fillet_fn=case_ffn, center=true);
translate([pcb_width/2,pcb_depth/2,bottom_height-adj-lip/2]) rotate([0,0,30])
cylinder_fillet_inside(h=lip+2*adj, r=(case_diameter/2)-wallthick/2+tol/2,
top=fillet-1, bottom=0, $fn=case_fn, fillet_fn=case_ffn, center=true);
// io cutout
if(width/depth >= 1.4 && sbc_model != "vim1" && sbc_model != "vim2" &&
sbc_model != "vim3l" && sbc_model != "vim3" && sbc_model != "vim4" &&
sbc_model != "rpizero" && sbc_model != "rpizero2w") {
translate([width,(depth/2)-wallthick-gap,bottom_height-lip+top_height/2-floorthick])
cube_fillet_inside([18,depth-2*(wallthick+gap)-1,top_height+lip+2],
vertical=[0,0,0,0], top=[0,0,0,0], bottom=[0,0,0,0], $fn=90);
}
else {
translate([(width/2)-wallthick-gap,-20,bottom_height-lip+top_height/2-floorthick])
cube_fillet_inside([width-2*(wallthick+gap)-1,40,top_height+lip+2],
vertical=[0,0,0,0], top=[0,0,0,0], bottom=[0,0,0,0], $fn=90);
}
}
if(width/depth >= 1.4 && sbc_model != "vim1" && sbc_model != "vim2" &&
sbc_model != "vim3l" && sbc_model != "vim3" && sbc_model != "vim4" &&
sbc_model != "rpizero" && sbc_model != "rpizero2w") {
translate([width-2*wallthick-gap-.95,depth/2-wallthick-gap-(depth-2*(floorthick+gap))/2,
bottom_height]) cube([wallthick-adj,depth-2*(floorthick+gap),top_height+adj]);
}
else {
translate([-.95,depth/2-2*wallthick-gap-(depth-2*(floorthick+gap))/2,
bottom_height]) cube([width-2*(floorthick+gap),wallthick-adj,top_height+adj]);
}
}
if(case_design == "hex") {
if(width/depth >= 1.4 && sbc_model != "vim1" && sbc_model != "vim2" &&
sbc_model != "vim3l" && sbc_model != "vim3" && sbc_model != "vim4" &&
sbc_model != "rpizero" && sbc_model != "rpizero2w") {
difference() {
translate([pcb_width/2,pcb_depth/2,bottom_height+(top_height/2)-lip/2]) rotate([0,0,30])
cylinder_fillet_inside(h=top_height+lip, r=case_diameter/2,
top=fillet, bottom=0, $fn=6, fillet_fn=case_ffn, center=true);
translate([pcb_width/2,pcb_depth/2,bottom_height+(top_height/2)-floorthick-lip/2]) rotate([0,0,30])
cylinder_fillet_inside(h=top_height+lip, r=(case_diameter/2)-wallthick,
top=fillet-1, bottom=0, $fn=6, fillet_fn=case_ffn, center=true);
translate([pcb_width/2,pcb_depth/2,bottom_height-adj-lip/2]) rotate([0,0,30])
cylinder_fillet_inside(h=lip+2*adj, r=(case_diameter/2)-wallthick/2+tol/2,
top=fillet-1, bottom=0, $fn=6, fillet_fn=case_ffn, center=true);
// io cutout
translate([width,(depth/2)-wallthick-gap,bottom_height-lip+top_height/2-floorthick])
cube_fillet_inside([18,depth-2*(wallthick+gap)-1,top_height+lip+2],
vertical=[0,0,0,0], top=[0,0,0,0], bottom=[0,0,0,0], $fn=90);
}
}
else {
difference() {
translate([pcb_width/2,pcb_depth/2,bottom_height+(top_height/2)-lip/2]) rotate([0,0,0])
cylinder_fillet_inside(h=top_height+lip, r=hex_diameter/2,
top=fillet, bottom=0, $fn=6, fillet_fn=case_ffn, center=true);
translate([pcb_width/2,pcb_depth/2,bottom_height+(top_height/2)-floorthick-lip/2])
rotate([0,0,0]) cylinder_fillet_inside(h=top_height+lip, r=(hex_diameter/2)-wallthick,
top=fillet-1, bottom=0, $fn=6, fillet_fn=case_ffn, center=true);
translate([pcb_width/2,pcb_depth/2,bottom_height-adj-lip/2]) rotate([0,0,0])
cylinder_fillet_inside(h=lip+2*adj, r=(hex_diameter/2)-wallthick/2+tol/2,
top=fillet-1, bottom=0, $fn=6, fillet_fn=case_ffn, center=true);
// io cutout
translate([(width/2)-wallthick-gap,-23,bottom_height-lip+top_height/2-floorthick])
cube_fillet_inside([width-2*(wallthick+gap),40,top_height+lip+2],
vertical=[0,0,0,0], top=[0,0,0,0], bottom=[0,0,0,0], $fn=90);
}
}
if(width/depth >= 1.4 && sbc_model != "vim1" && sbc_model != "vim2" &&
sbc_model != "vim3l" && sbc_model != "vim3" && sbc_model != "vim4" &&
sbc_model != "rpizero" && sbc_model != "rpizero2w") {
translate([width-2*wallthick-gap-.95,depth/2-wallthick-gap-(depth-2*(floorthick+gap))/2,
bottom_height]) cube([wallthick-adj,depth-2*(floorthick+gap),top_height+adj]);
}
else {
translate([0,depth/2-2.25*(wallthick+gap)-(depth-2*(floorthick+gap))/2,
bottom_height]) cube([width-2*(floorthick+gap),wallthick-adj,top_height+adj]);
}
}
if(case_design == "snap") {
translate([(width/2)-wallthick-gap,(depth/2)-wallthick-gap,floorthick*1.5+case_z])
cube_fillet_inside([width,depth,floorthick],
vertical=[c_fillet,c_fillet,c_fillet,c_fillet],
top=[0,0,0,0],bottom=[fillet,fillet,fillet,fillet,fillet], $fn=90);
difference() {
translate([(width/2)-wallthick-gap,(depth/2)-wallthick-gap,case_z-adj])
cube_fillet_inside([width-2*wallthick-tol,depth-2*wallthick-tol,2*floorthick+1.5],
vertical=[c_fillet,c_fillet,c_fillet,c_fillet],
top=[0,0,0,0],bottom=[fillet,fillet,fillet,fillet,fillet], $fn=90);
translate([(width/2)-wallthick-gap,(depth/2)-wallthick-gap,case_z-adj])
cube_fillet_inside([width-(3*wallthick),depth-(3*wallthick),2*floorthick+1.5+adj],
vertical=[c_fillet-1,c_fillet-1,c_fillet-1,c_fillet-1],top=[0,0,0,0],
bottom=[fillet,fillet,fillet,fillet,fillet], $fn=90);
}
// snap top outdent
difference() {
translate([-wallthick-gap+1.25+tol,(depth/2)-((depth*.75)/2)+2.5-gap-wallthick,case_z-.5])
rotate([0,45,0]) cube([4,(depth*.75)-5,4]);
translate([-wallthick-gap+3,(depth/2)-((depth*.75)/2)+1.25-gap-wallthick,case_z+floorthick-5.75])
rotate([0,0,0]) cube([6,(depth*.75)-2,6]);
}
difference() {
translate([width-wallthick-gap-6.8-tol,(depth/2)-((depth*.75)/2)+2.5-gap-wallthick,case_z-.5])
rotate([0,45,0]) cube([4,(depth*.75)-5,4]);
translate([width-wallthick-gap-8.5,(depth/2)-((depth*.75)/2)+1.25-gap-wallthick,case_z+floorthick-5.75])
rotate([0,0,0]) cube([6,(depth*.75)-2,6]);
}
}
if(case_design == "fitted") {
difference() {
translate([(width/2)-wallthick-gap,
(depth/2)-wallthick-gap,case_z+floorthick/2-(lip)/2])
cube_fillet_inside([width,depth,lip+floorthick],
vertical=[c_fillet,c_fillet,c_fillet,c_fillet],
top=[fillet,fillet,fillet,fillet,fillet],
bottom=[0,0,0,0], $fn=90);
translate([(width/2)-wallthick-gap,(depth/2)-wallthick-gap,case_z-floorthick-1])
cube_fillet_inside([width-wallthick+tol,depth-wallthick+tol,lip+floorthick],
vertical=[c_fillet-1,c_fillet-1,c_fillet-1,c_fillet-1],
top=[fillet,fillet,fillet,fillet,fillet],
bottom=[0,0,0,0], $fn=90);
}
}
if(accessory_name != "none") {
for (i=[1:15:len(accessory_data[a[0]])-1]) {
class = accessory_data[a[0]][i];
type = accessory_data[a[0]][i+1];
loc_x = accessory_data[a[0]][i+2];
loc_y = accessory_data[a[0]][i+3];
loc_z = accessory_data[a[0]][i+4];
face = accessory_data[a[0]][i+5];
rotation = accessory_data[a[0]][i+6];
parametric = accessory_data[a[0]][i+7];
size_x = accessory_data[a[0]][i+8];
size_y = accessory_data[a[0]][i+9];
size_z = accessory_data[a[0]][i+10];
data_1 = accessory_data[a[0]][i+11];
data_2 = accessory_data[a[0]][i+12];
data_3 = accessory_data[a[0]][i+13];
data_4 = accessory_data[a[0]][i+14];
if (class == "add1" && face == "top") {
parametric_move_add(type,loc_x,loc_y,loc_z,face,rotation,
parametric,size_x,size_y,size_z,data_1,data_2,data_3,data_4);
}
}
}
}
// pcb standoff holes
if(sbc_top_standoffs == true && top_standoff[5] != 4) {
for (i=[1:11:len(sbc_data[s[0]])-2]) {
class = sbc_data[s[0]][i+1];
type = sbc_data[s[0]][i+2];
id = sbc_data[s[0]][i+3];
pcb_hole_x = sbc_data[s[0]][i+4]+pcb_loc_x;
pcb_hole_y = sbc_data[s[0]][i+5]+pcb_loc_y;
pcb_hole_z = sbc_data[s[0]][i+6];
pcb_hole_size = sbc_data[s[0]][i+9][0];
pcb_hole_pos = sbc_data[s[0]][i+10][4];
if (class == "pcbhole" && id == pcb_id && (pcb_hole_pos == "left_rear" || pcb_hole_pos == "left_front" || pcb_hole_pos == "right_rear" || pcb_hole_pos == "right_front")) {
#translate([pcb_hole_x,pcb_hole_y,top_height+1]) cylinder(d=6.5, h=top_height);
}
}
}
// extended standoff holes
if(case_ext_standoffs == true) {
// right-rear standoff
if(width-pcb_loc_x-pcb_width >= 10 || pcb_loc_y >= 10) {
translate([width-(2*(wallthick+gap))-(c_fillet/2),(c_fillet/2),top_height+1])
cylinder(d=6.5, h=top_height);
}
// right-front standoff
if((width-pcb_loc_x-pcb_width >= 10 && depth-pcb_loc_y-pcb_depth >= 10) || width-pcb_loc_x-pcb_width >= 10) {
translate([width-(c_fillet/2)-(2*(wallthick+gap)),
depth-(c_fillet/2)-(2*(wallthick+gap)),top_height+1]) cylinder(d=6.5, h=top_height);
}
// left-rear standoff
if(pcb_loc_x >= 10 || pcb_loc_y >= 10) {
translate([(c_fillet/2),(c_fillet/2),top_height+1]) cylinder(d=6.5, h=top_height);
}
// left-front standoff
if(pcb_loc_x >= 10 || depth-pcb_loc_y-pcb_depth >= 10) {
translate([+(c_fillet/2),depth-(c_fillet/2)-(2*(wallthick+gap)),
top_height+1]) cylinder(d=6.5, h=top_height+1);
}
}
}
// pcb standoffs
if(sbc_top_standoffs == true) {
for (i=[1:11:len(sbc_data[s[0]])-2]) {
class = sbc_data[s[0]][i+1];
type = sbc_data[s[0]][i+2];
id = sbc_data[s[0]][i+3];
pcb_hole_x = sbc_data[s[0]][i+4]+pcb_loc_x;
pcb_hole_y = sbc_data[s[0]][i+5]+pcb_loc_y;
pcb_hole_z = sbc_data[s[0]][i+6];
pcb_hole_size = sbc_data[s[0]][i+9][0];
pcb_hole_pos = sbc_data[s[0]][i+10][4];
if(class == "pcbhole" && id == pcb_id && (pcb_hole_pos == "left_rear" || pcb_hole_pos == "left_front" || pcb_hole_pos == "right_rear" || pcb_hole_pos == "right_front")) {
if (pcb_hole_pos == "left_rear") {
normal_standoff = [top_standoff[0],
top_height+pcb_loc_z+top_rear_left,
top_standoff[2],
top_standoff[3],
top_standoff[4],
top_standoff[5],
top_standoff[6],
top_standoff[7],
top_standoff[8],
top_standoff[9],
top_standoff[10]];
translate([pcb_hole_x,pcb_hole_y,case_z]) standoff(normal_standoff);
}
if (pcb_hole_pos == "left_front") {
normal_standoff = [top_standoff[0],
top_height+pcb_loc_z+top_front_left,
top_standoff[2],
top_standoff[3],
top_standoff[4],
top_standoff[5],
top_standoff[6],
top_standoff[7],
top_standoff[8],
top_standoff[9],
top_standoff[10]];
translate([pcb_hole_x,pcb_hole_y,case_z]) standoff(normal_standoff);
}
if (pcb_hole_pos == "right_rear") {
normal_standoff = [top_standoff[0],
top_height+pcb_loc_z+top_rear_right,
top_standoff[2],
top_standoff[3],
top_standoff[4],
top_standoff[5],
top_standoff[6],
top_standoff[7],
top_standoff[8],
top_standoff[9],
top_standoff[10]];
translate([pcb_hole_x,pcb_hole_y,case_z]) standoff(normal_standoff);
}
if (pcb_hole_pos == "right_front") {
normal_standoff = [top_standoff[0],
top_height+pcb_loc_z+top_front_right,
top_standoff[2],
top_standoff[3],
top_standoff[4],
top_standoff[5],
top_standoff[6],
top_standoff[7],
top_standoff[8],
top_standoff[9],
top_standoff[10]];
translate([pcb_hole_x,pcb_hole_y,case_z]) standoff(normal_standoff);
}
}
}
}
// extended standoffs
if(case_ext_standoffs == true) {
// right-rear standoff
if(width-pcb_loc_x-pcb_width >= 10 || pcb_loc_y >= 10) {
translate([width-(2*(wallthick+gap))-(c_fillet/2),(c_fillet/2),case_z])
standoff(top_ext_standoff);
}
// right-front standoff
if((width-pcb_loc_x-pcb_width >= 10 && depth-pcb_loc_y-pcb_depth >= 10)
|| width-pcb_loc_x-pcb_width >= 10) {
translate([width-(c_fillet/2)-(2*(wallthick+gap)),
depth-(c_fillet/2)-(2*(wallthick+gap)),case_z]) standoff(top_ext_standoff);
}
// left-rear standoff
if(pcb_loc_x >= 10 || pcb_loc_y >= 10) {
translate([(c_fillet/2),(c_fillet/2),case_z]) standoff(top_ext_standoff);
}
// left-front standoff
if(pcb_loc_x >= 10 || depth-pcb_loc_y-pcb_depth >= 10) {
translate([(c_fillet/2),depth-(c_fillet/2)-(2*(wallthick+gap)),
case_z]) standoff(top_ext_standoff);
}
}
// standoff sidewall support
if(sidewall_support == true && sbc_top_standoffs == true) {
if(pcb_width/pcb_depth >= 1.4) {
for (i=[1:11:len(sbc_data[s[0]])-2]) {
class = sbc_data[s[0]][i+1];
type = sbc_data[s[0]][i+2];
id = sbc_data[s[0]][i+3];
pcb_hole_x = sbc_data[s[0]][i+4]+pcb_loc_x;
pcb_hole_y = sbc_data[s[0]][i+5]+pcb_loc_y;
pcb_hole_z = sbc_data[s[0]][i+6];
pcb_hole_size = sbc_data[s[0]][i+9][0];
pcb_hole_pos = sbc_data[s[0]][i+10][4];
if(pcb_hole_x!=0 && pcb_hole_y!=0) {
if (pcb_hole_pos == "left_rear") {
translate([pcb_hole_x-1, pcb_hole_y-(top_standoff[0]/2)-(gap-adj)-1.4,
case_z-top_height-top_rear_left]) cube([2,gap+1.6,top_height+top_rear_left]);
}
if (pcb_hole_pos == "left_front") {
translate([pcb_hole_x-1, pcb_hole_y+(top_standoff[0]/2)-.6+adj,case_z-top_height-top_front_left])
cube([2,gap+1.6,top_height+top_front_left]);
}
if (pcb_hole_pos == "right_rear") {
translate([pcb_hole_x-1, pcb_hole_y-(top_standoff[0]/2)-(gap-adj)-1.4,
case_z-top_height-top_rear_right]) cube([2,gap+1.6,top_height+top_rear_right]);
}
if (pcb_hole_pos == "right_front") {
translate([pcb_hole_x-1, pcb_hole_y+(top_standoff[0]/2)-.6+adj,case_z-top_height-top_front_right])
cube([2,gap+1.6,top_height+top_front_right]);
}
}
}
}
else {
for (i=[1:11:len(sbc_data[s[0]])-2]) {
class = sbc_data[s[0]][i+1];
type = sbc_data[s[0]][i+2];
id = sbc_data[s[0]][i+3];
pcb_hole_x = sbc_data[s[0]][i+4]+pcb_loc_x;
pcb_hole_y = sbc_data[s[0]][i+5]+pcb_loc_y;
pcb_hole_z = sbc_data[s[0]][i+6];
pcb_hole_size = sbc_data[s[0]][i+9][0];
pcb_hole_pos = sbc_data[s[0]][i+10][4];
if(pcb_hole_x!=0 && pcb_hole_y!=0) {
if (i == 7 && sbc_model != "n2l") {
translate([pcb_hole_x-(top_standoff[0]/2)-gap-adj-1,pcb_hole_y-1,
bottom_height-top_rear_left]) cube([gap+adj+1.6,2,top_height+top_rear_left]);
}
if (pcb_hole_pos == "left_rear" && sbc_model == "n2l") {
translate([pcb_hole_x-1, pcb_hole_y-(top_standoff[0]/2)-(gap-adj)-1.4,
case_z-top_height-top_rear_left]) cube([2,gap+1.6,top_height+top_rear_left]);
}
if (pcb_hole_pos == "left_front" && sbc_model != "n2l") {
translate([pcb_hole_x-(top_standoff[0]/2)-gap-adj-1,pcb_hole_y-1,
bottom_height-top_front_left]) cube([gap+adj+1.6,2,top_height+top_front_left]);
}
if (pcb_hole_pos == "left_front" && sbc_model == "n2l") {
translate([pcb_hole_x-1, pcb_hole_y+(top_standoff[0]/2)-.6+adj,case_z-top_height-top_front_left])
cube([2,gap+1.6,top_height+top_front_left]);
}
if (pcb_hole_pos == "right_rear") {
translate([pcb_hole_x+(top_standoff[0]/2)-adj-.45,pcb_hole_y-1,
bottom_height-top_rear_right]) cube([gap+adj+1.6,2,top_height+top_rear_right]);
}
if (pcb_hole_pos == "right_front") {
translate([pcb_hole_x+(top_standoff[0]/2)-adj-.45,pcb_hole_y-1,
bottom_height-top_front_right]) cube([gap+adj+1.6,2,top_height+top_front_right]);
}
}
}
}
}
// extended standoff sidewall support
if(case_ext_standoffs == true && sidewall_support == true) {
// right-rear standoff
if(width-pcb_loc_x-pcb_width >= 10 || pcb_loc_y >= 10) {
translate([width-(2*(wallthick+gap))-(c_fillet/2)+(top_ext_standoff[0]/2)-.6,
(c_fillet/2)-1,bottom_height]) cube([gap+adj+2,2,top_height]);
}
// right-front standoff
if((width-pcb_loc_x-pcb_width >= 10 && depth-pcb_loc_y-pcb_depth >= 10)
|| width-pcb_loc_x-pcb_width >= 10) {
translate([width-(2*(wallthick+gap))-(c_fillet/2)+(top_ext_standoff[0]/2)-.6,
depth-(c_fillet/2)-(2*(wallthick+gap))-1,bottom_height])
cube([gap+adj+2,2,top_height]);
}
// left-rear standoff
if(pcb_loc_x >= 10 || pcb_loc_y >= 10) {
translate([(c_fillet/2)-(wallthick+gap)-(top_ext_standoff[0]/2)+.6,(c_fillet/2)-1,
bottom_height]) cube([gap+adj+2,2,top_height]);
}
// left-front standoff
if(pcb_loc_x >= 10 || depth-pcb_loc_y-pcb_depth >= 10) {
translate([(c_fillet/2)-(wallthick+gap)-(top_ext_standoff[0]/2)+.6,
depth-(c_fillet/2)-(2*(wallthick+gap))-1, bottom_height])
cube([gap+adj+2,2,top_height]);
}
}
}
// subtractive accessories
if(accessory_name != "none") {
for (i=[1:15:len(accessory_data[a[0]])-1]) {
class = accessory_data[a[0]][i];
type = accessory_data[a[0]][i+1];
loc_x = accessory_data[a[0]][i+2];
loc_y = accessory_data[a[0]][i+3];
loc_z = accessory_data[a[0]][i+4];
face = accessory_data[a[0]][i+5];
rotation = accessory_data[a[0]][i+6];
parametric = accessory_data[a[0]][i+7];
size_x = accessory_data[a[0]][i+8];
size_y = accessory_data[a[0]][i+9];
size_z = accessory_data[a[0]][i+10];
data_1 = accessory_data[a[0]][i+11];
data_2 = accessory_data[a[0]][i+12];
data_3 = accessory_data[a[0]][i+13];
data_4 = accessory_data[a[0]][i+14];
if ((class == "sub" && face == "top") || class == "suball") {
if(accessory_highlight == false) {
parametric_move_sub(type,loc_x,loc_y,loc_z,face,rotation,
parametric,size_x,size_y,size_z,data_1,data_2,data_3,data_4);
}
else {
#parametric_move_sub(type,loc_x,loc_y,loc_z,face,rotation,
parametric,size_x,size_y,size_z,data_1,data_2,data_3,data_4);
}
}
// 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_1,data_2,data_3,data_4);
}
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_1,data_2,data_3,data_4);
}
else {
#parametric_move_sub("microusb",loc_x+5.25,loc_y-5,loc_z+4,face,rotation,parametric,
0,0,0,data_1,data_2,data_3,data_4);
}
}
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,data_1,data_2,data_3,[.1,.1,.1,.1]);
}
if ((class == "add1" || class == "add2") && face == "top" && type == "button") {
if(data_3 == "recess") {
parametric_move_sub("sphere",loc_x,loc_y,loc_z,face,rotation,
parametric,size_x-1,size_y,size_z,data_1,data_2,data_3,0);
}
if(data_3 == "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,data_1,data_2,data_3,[.1,.1,.1,.1]);
}
}
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_1,data_2,data_3,data_4);
parametric_move_sub("slot",loc_x+37.5,loc_y-4.75,loc_z,face,[0,0,0],
parametric,6,14,80,data_1,data_2,data_3,data_4);
}
}
}
// sbc openings
if(sbc_highlight == true) {
#translate([pcb_loc_x ,pcb_loc_y,bottom_height-pcb_z+pcb_loc_z-adj]) sbc(sbc_model,"default",0,"default","default",true);
}
else {
translate([pcb_loc_x ,pcb_loc_y,bottom_height-pcb_z+pcb_loc_z-adj]) sbc(sbc_model,"default",0,"default","default",true);
}
// clean fillets
if(case_design == "shell") {
translate(([(width/2)-wallthick-gap,(depth/2)-wallthick-gap,
bottom_height+(top_height/2)]) )
cube_negative_fillet([width,depth,top_height], radius=-1,
vertical=[c_fillet,c_fillet,c_fillet,c_fillet],
top=[fillet,fillet,fillet,fillet,fillet],
bottom=[0,0,0,0], $fn=90);
}
}
// additive accessories
if(accessory_name != "none") {
for (i=[1:15:len(accessory_data[a[0]])-1]) {
class = accessory_data[a[0]][i];
type = accessory_data[a[0]][i+1];
loc_x = accessory_data[a[0]][i+2];
loc_y = accessory_data[a[0]][i+3];
loc_z = accessory_data[a[0]][i+4];
face = accessory_data[a[0]][i+5];
rotation = accessory_data[a[0]][i+6];
parametric = accessory_data[a[0]][i+7];
size_x = accessory_data[a[0]][i+8];
size_y = accessory_data[a[0]][i+9];
size_z = accessory_data[a[0]][i+10];
data_1 = accessory_data[a[0]][i+11];
data_2 = accessory_data[a[0]][i+12];
data_3 = accessory_data[a[0]][i+13];
data_4 = accessory_data[a[0]][i+14];
if (class == "add2" && face == "top") {
parametric_move_add(type,loc_x,loc_y,loc_z,face,rotation,parametric,
size_x,size_y,size_z,data_1,data_2,data_3,data_4);
}
}
}
}

221
mod/fillets.scad Normal file
View File

@@ -0,0 +1,221 @@
// Stephanie Shaltes
// https://github.com/StephS/i2_xends/blob/master/inc/fillets.scad
//
// 20200329 Additional maintenance and debug by hominoid @ www.forum.odroid.com
function poly_sides_r(r) = (max(round(4 * r),3)+1);
// 2d primitive for outside fillets.
module fillet_2d_o(fillet_r, fillet_angle=90, fillet_fn=0) {
add=0.01;
f_fn=(fillet_fn>0) ? fillet_fn*4 : (ceil(poly_sides_r(fillet_r)/4)*4);
if (fillet_r>0) {
intersection() {
circle(r=fillet_r, $fn=f_fn);
polygon([
[0-add, 0-add],
[0-add, fillet_r],
[fillet_r * tan(fillet_angle/2), fillet_r],
[fillet_r * sin(fillet_angle), fillet_r * cos(fillet_angle)-add]
]);
}
}
}
// 2d primitive for inside fillets.
module fillet_2d_i(fillet_r, fillet_angle=90, fillet_fn=0) {
add=0.01;
f_fn=(fillet_fn>0) ? fillet_fn*4 : (ceil(poly_sides_r(fillet_r)/4)*4);
if (fillet_r>0) {
translate([fillet_r * tan(fillet_angle/2), fillet_r, 0])
difference() {
polygon([
[0, 0],
[0, -fillet_r-add],
[-fillet_r * tan(fillet_angle/2)-add, -fillet_r-add],
[-fillet_r * sin(fillet_angle)-add, -fillet_r * cos(fillet_angle)]
]);
circle(r=fillet_r, $fn=f_fn);
}
}
}
// 3d rotated outside fillet.
module fillet_polar_o(inner_r, fillet_r, fillet_angle=90, fillet_fn=0, rotate_fn=0) {
if (fillet_r>0) {
rotate_extrude(convexity=8, $fn=rotate_fn) {
translate([inner_r, 0, 0]) {
fillet_2d_o(fillet_r, fillet_angle, fillet_fn);
}
}
}
}
// 3d rotated inside fillet.
module fillet_polar_i(inner_r, fillet_r, fillet_angle=90, fillet_fn=0, rotate_fn=0) {
if (fillet_r>0) {
rotate_extrude(convexity=8, $fn=rotate_fn) {
translate([inner_r, 0, 0]) {
fillet_2d_i(fillet_r, fillet_angle, fillet_fn); }
}
}
}
// 3d rotated inside fillet negative.
module fillet_polar_i_n(outer_r, fillet_r, fillet_angle=90, fillet_fn=0, rotate_fn=0) {
if (fillet_r>0) {
rotate_extrude(convexity=8, $fn=rotate_fn) {
translate([outer_r, 0, 0]) {
rotate(90) fillet_2d_i(fillet_r, fillet_angle, fillet_fn); }
}
}
}
// 3d linear outside fillet.
module fillet_linear_o(l, fillet_r, fillet_angle=90, fillet_fn=0, add=0.02) {
if (fillet_r>0) {
translate([0,0,-add/2])
linear_extrude(height=l+add, center=false) {
fillet_2d_o(fillet_r, fillet_angle, fillet_fn);
}
}
}
// 3d linear inside fillet.
module fillet_linear_i(l, fillet_r, fillet_angle=90, fillet_fn=0, add=0.02) {
if (fillet_r>0) {
translate([0,0,-add/2])
linear_extrude(height=l+add, center=false) {
fillet_2d_i(fillet_r, fillet_angle, fillet_fn);
}
}
}
module cube_negative_fillet(size, radius=-1, vertical=[3,3,3,3], top=[0,0,0,0], bottom=[0,0,0,0], $fn=90, vertical_fn=[0,0,0,0], top_fn=[0,0,0,0], bottom_fn=[0,0,0,0]){
vertical_fn= ($fn>0) ? [$fn,$fn,$fn,$fn] : vertical_fn;
top_fn= ($fn>0) ? [$fn,$fn,$fn,$fn] : top_fn;
bottom_fn= ($fn>0) ? [$fn,$fn,$fn,$fn] : bottom_fn;
j=[1,0,1,0];
for (i=[0:3]) {
if (radius > -1) {
rotate([0, 0, 90*i]) translate([size[1-j[i]]/2, size[j[i]]/2, 0]) translate([0, 0, -size[2]/2]) rotate([0,0,180]) fillet_linear_i(l=size[2], fillet_r=radius, fillet_angle=90, fillet_fn=$fn); //fillet(radius, size[2], $fn=$fn);
} else {
rotate([0, 0, 90*i]) translate([size[1-j[i]]/2, size[j[i]]/2, 0]) translate([0, 0, -size[2]/2]) rotate([0,0,180]) fillet_linear_i(l=size[2], fillet_r=vertical[i], fillet_angle=90, fillet_fn=vertical_fn[i]); //fillet(vertical[i], size[2], $fn=$fn);
}
rotate([90*i, -90, 0]) translate([size[2]/2, size[j[i]]/2, 0 ]) translate([0, 0, -size[1-j[(i)]]/2]) rotate([0,0,180]) fillet_linear_i(l=size[1-j[(i)]], fillet_r=top[(i)], fillet_angle=90, fillet_fn=top_fn[i]); // fillet(top[i], size[1-j[i]], $fn=$fn);
rotate([90*(4-i), 90, 0]) translate([size[2]/2, size[j[i]]/2, 0]) translate([0, 0, -size[1-j[(i)]]/2]) rotate([0,0,180]) fillet_linear_i(l=size[1-j[(i)]], fillet_r=bottom[(i)], fillet_angle=90, fillet_fn=bottom_fn[i]); //fillet(bottom[i], size[1-j[i]], $fn=$fn);
}
}
module cube_positive_fillet(size, radius=-1, vertical=[0,0,0,0], top=[0,0,0,0], bottom=[0,0,0,0], vertical_angle=[90,90,90,90], top_angle=[90,90,90,90], bottom_angle=[90,90,90,90], vertical_flip=[0,0,0,0], top_flip=[0,0,0,0], bottom_flip=[0,0,0,0], $fn=0){
j=[1,0,1,0];
for (i=[0:3]) {
if (radius > -1) {
rotate([0, 0, 90*i]) translate([size[1-j[i]]/2, size[j[i]]/2, 0]) translate([0, 0, -size[2]/2]) rotate([0,0,90]) fillet_linear_i(l=size[2], fillet_r=radius, fillet_angle=90, fillet_fn=$fn); //fillet(radius, size[2], $fn=$fn);
} else {
rotate([0, 0, 90*i]) translate([size[1-j[i]]/2, size[j[i]]/2, 0]) translate([0, 0, -size[2]/2]) rotate([0,0,180-vertical_angle[i]+(90+vertical_angle[i])*vertical_flip[i]]) fillet_linear_i(l=size[2], fillet_r=vertical[i], fillet_angle=vertical_angle[i], fillet_fn=$fn); //fillet(vertical[i], size[2], $fn=$fn);
}
rotate([90*i, -90, 0]) translate([size[2]/2, size[j[i]]/2, 0 ]) translate([0, 0, -size[1-j[(i)]]/2]) rotate([0,0,(180-top_angle[i])+(90+top_angle[i])*top_flip[i]]) fillet_linear_i(l=size[1-j[(i)]], fillet_r=top[(i)], fillet_angle=180-top_angle[i], fillet_fn=$fn); // fillet(top[i], size[1-j[i]], $fn=$fn);
rotate([90*(4-i), 90, 0]) translate([size[2]/2, size[j[i]]/2, 0]) translate([0, 0, -size[1-j[(i)]]/2]) rotate([0,0,180-bottom_angle[i]+(90+bottom_angle[i])*bottom_flip[i]]) fillet_linear_i(l=size[1-j[(i)]], fillet_r=bottom[(i)], fillet_angle=bottom_angle[i], fillet_fn=$fn); //fillet(bottom[i], size[1-j[i]], $fn=$fn);
}
}
module cube_positive_fillet_corners(size, radius=-1, vertical=[0,0,0,0], top=[0,0,0,0], bottom=[0,0,0,0], vertical_angle=[90,90,90,90], top_angle=[90,90,90,90], bottom_angle=[90,90,90,90], vertical_flip=[0,0,0,0], top_flip=[0,0,0,0], bottom_flip=[0,0,0,0], $fn=90){
j=[1,0,1,0];
//bottom
for (i=[0:3]) {
render(convexity=4) intersection() {
/*
if (radius > -1) {
rotate([0, 0, 90*i]) translate([size[1-j[i]]/2, size[j[i]]/2, 0]) translate([0, 0, -size[2]/2-radius]) rotate([0,0,90]) fillet_linear_i(l=size[2]+radius*2, r=radius, fillet_angle=90, fillet_fn=$fn); //fillet(radius, size[2], $fn=$fn);
} else {
rotate([0, 0, 90*i]) translate([size[1-j[i]]/2, size[j[i]]/2, 0]) translate([0, 0, -size[2]/2-vertical[i]]) rotate([0,0,180-vertical_angle[i]+(90+vertical_angle[i])*vertical_flip[i]]) fillet_linear_i(l=size[2]+vertical[i]*2, r=vertical[i], fillet_angle=vertical_angle[i], fillet_fn=$fn); //fillet(vertical[i], size[2], $fn=$fn);
}
*/
rotate([90*(4-i), 90, 0]) translate([size[2]/2, size[j[i]]/2, 0]) translate([0, 0, -size[1-j[(i)]]/2-bottom[(i)]]) rotate([0,0,180-bottom_angle[i]+(90+bottom_angle[i])*bottom_flip[i]]) fillet_linear_i(l=size[1-j[(i)]]+bottom[(i)]*4, fillet_r=bottom[(i)], fillet_angle=bottom_angle[i], fillet_fn=$fn); //fillet(bottom[i], size[1-j[i]], $fn=$fn);
rotate([90*(4-((i+1)%4)), 90, 0]) translate([size[2]/2, size[j[((i+1)%4)]]/2, 0]) translate([0, 0, -size[1-j[((i+1)%4)]]/2-bottom[((i+1)%4)]]) rotate([0,0,180-bottom_angle[((i+1)%4)]+(90+bottom_angle[((i+1)%4)])*bottom_flip[((i+1)%4)]]) fillet_linear_i(l=size[1-j[(((i+1)%4))]]+bottom[(((i+1)%4))]*4, fillet_r=bottom[(((i+1)%4))], fillet_angle=bottom_angle[((i+1)%4)], fillet_fn=$fn); //fillet(bottom[i], size[1-j[i]], $fn=$fn);
}
}
// top
for (i=[0:3]) {
render(convexity=4) intersection() {
rotate([90*i, -90, 0]) translate([size[2]/2, size[j[i]]/2, 0 ]) translate([0, 0, -size[1-j[(i)]]/2-top[(i)]]) rotate([0,0,(180-top_angle[i])+(90+top_angle[i])*top_flip[i]]) fillet_linear_i(l=size[1-j[(i)]]+top[(i)]*4, fillet_r=top[(i)], fillet_angle=180-top_angle[i], fillet_fn=$fn); // fillet(top[i], size[1-j[i]], $fn=$fn);
rotate([90*((i+1)%4), -90, 0]) translate([size[2]/2, size[j[((i+1)%4)]]/2, 0 ]) translate([0, 0, -size[1-j[(((i+1)%4))]]/2-top[(((i+1)%4))]]) rotate([0,0,(180-top_angle[((i+1)%4)])+(90+top_angle[((i+1)%4)])*top_flip[((i+1)%4)]]) fillet_linear_i(l=size[1-j[(((i+1)%4))]]+top[(((i+1)%4))]*4, fillet_r=top[(((i+1)%4))], fillet_angle=180-top_angle[((i+1)%4)], fillet_fn=$fn); // fillet(top[i], size[1-j[i]], $fn=$fn);
}
}
}
module cube_fillet_inside(size, radius=-1, vertical=[0,0,0,0], top=[0,0,0,0], bottom=[0,0,0,0], $fn=90, vertical_fn=[0,0,0,0], top_fn=[0,0,0,0], bottom_fn=[0,0,0,0]){
//makes CENTERED cube with round corners
// if you give it radius, it will fillet vertical corners.
//othervise use vertical, top, bottom arrays
//when viewed from top, it starts in upper right corner (+x,+y quadrant) , goes counterclockwise
//top/bottom fillet starts in direction of Y axis and goes CCW too
if (radius == 0) {
cube(size, center=true);
} else {
difference() {
cube(size, center=true);
cube_negative_fillet(size, radius, vertical, top, bottom, $fn, vertical_fn, top_fn, bottom_fn);
}
}
}
module cylinder_fillet_inside(h=10, r=10, top=3, bottom=3, $fn=0, fillet_fn=0, center=false) {
c_fn=($fn>0) ? $fn : poly_sides_r(r);
rotfix=(($fn>0) ? 0 : 180/c_fn);
cent=(center) ? -h/2 : 0;
// echo (c_fn);
translate([0,0,cent])
difference() {
cylinder(h=h,r=r,$fn=c_fn);
rotate ([0,0,rotfix]) {
fillet_polar_i_n(outer_r=r, fillet_r=bottom,
fillet_angle=90, fillet_fn=fillet_fn, rotate_fn=c_fn);
translate([0,0,h]) mirror ([0,0,1])
fillet_polar_i_n(outer_r=r, fillet_r=top,
fillet_angle=90, fillet_fn=fillet_fn, rotate_fn=c_fn);
}
}
}
module cylinder_fillet_outside(h=10, r=10, top=3, bottom=3, $fn=0, fillet_fn=0, center=false) {
c_fn=($fn>0) ? $fn : poly_sides_r(r);
rotfix=(($fn>0) ? 0 : 180/c_fn);
cent=(center) ? -h/2 : 0;
// echo (c_fn);
translate([0,0,cent]) {
cylinder(h=h,r=r,$fn=c_fn);
rotate ([0,0,rotfix]) {
fillet_polar_i(inner_r=r, fillet_r=bottom, fillet_angle=90,
fillet_fn=fillet_fn, rotate_fn=c_fn);
translate([0,0,h]) mirror ([0,0,1])
fillet_polar_i(inner_r=r, fillet_r=top, fillet_angle=90,
fillet_fn=fillet_fn, rotate_fn=c_fn);
}
}
}
//cube([20,20,20], center=true);
//cube_positive_fillet_corners([20,20,20], radius=-1, vertical=[0,0,0,0], top=[3,3,3,3], bottom=[3,3,3,3], top_angle=[90,90,90,90], top_flip=[0,0,0,0], $fn=10);
//cube_positive_fillet([20,20,20], radius=-1, vertical=[0,0,0,0], top=[3,3,3,3], bottom=[3,3,3,3], top_angle=[90,90,90,90], top_flip=[0,0,0,0], $fn=10);
//translate([-12,23,0]) cube_fillet_inside([20,20,20], vertical=[0,0,0,0], top=[3,3,3,3], bottom=[3,3,3,3], $fn=10);
//translate([23,-12,0]) cylinder_fillet_inside(h=20, r=10, top=3, bottom=3, $fn=0, fillet_fn=10, center=true);
//translate([0,0,23]) cylinder_fillet_outside(h=20, r=10, top=3, bottom=3, $fn=0, fillet_fn=10, center=true);

243
mod/indent.scad Normal file
View File

@@ -0,0 +1,243 @@
/* indent module */
module indent(loc_x,loc_y,loc_z,rotation,side,class,type,wallthick,gap,floorthick,pcb_z) {
adj = .01;
$fn=90;
// hdmi indent
if(class == "video" && type == "hdmi_a" && side == "top" && rotation == 0) {
place(loc_x+2.375,-(wallthick+gap)+wallthick/2,loc_z+3.75,12,10,rotation,side)
rotate([90,0,0]) slot(12,10,wallthick);
}
if(class == "video" && type == "hdmi_a" && side == "top" && rotation == 90) {
place(-gap-wallthick/2,loc_y,loc_z+3.75,12,10,rotation,side)
rotate([90,0,0]) slot(12,10,wallthick);
}
if(class == "video" && type == "hdmi_a" && side == "top" && rotation == 180) {
place(loc_x,depth-(wallthick+gap)-10-wallthick/2,loc_z+3.75,12,10,rotation,side)
rotate([90,0,0]) slot(12,10,wallthick);
}
if(class == "video" && type == "hdmi_a" && side == "top" && rotation == 270) {
place(width-(wallthick+gap)-10-wallthick/2,loc_y+2.375,loc_z+3.75,12,10,rotation,side)
rotate([90,0,0]) slot(12,10,wallthick);
}
if(class == "video" && type == "hdmi_a" && side == "bottom" && rotation == 0) {
place(loc_x,-(wallthick+gap)+wallthick/2,loc_z-pcb_z-3.75,12,10,rotation,side)
rotate([90,0,0]) slot(12,10,wallthick);
}
if(class == "video" && type == "hdmi_a" && side == "bottom" && rotation == 90) {
place(width-(wallthick+gap)-10-wallthick/2,loc_y,loc_z-5.25,12,10,rotation,side)
rotate([90,0,0]) slot(12,10,wallthick);
}
if(class == "video" && type == "hdmi_a" && side == "bottom" && rotation == 180) {
place(loc_x+2.375,depth-(wallthick+gap)-10-wallthick/2,loc_z-pcb_z-3.75,12,10,rotation,side)
rotate([90,0,0]) slot(12,10,wallthick);
}
if(class == "video" && type == "hdmi_a" && side == "bottom" && rotation == 270) {
place(-gap-wallthick/2,loc_y+1.75,loc_z-pcb_z-3.75,12,10,rotation,side)
rotate([90,0,0]) slot(12,10,wallthick);
}
// hdmi micro indent
if(class == "video" && type == "hdmi_micro" && rotation == 0 && side == "top") {
place(loc_x-.5,-(wallthick+gap)+wallthick/2,loc_z+1.5,6,8,rotation,side)
rotate([90,0,0]) slot(6,8,wallthick);
}
if(class == "video" && type == "hdmi_micro" && rotation == 90 && side == "top") {
place(-gap-wallthick/2,loc_y+1.5,loc_z+1.5,6,8,rotation,side)
rotate([90,0,0]) slot(6,8,wallthick);
}
if(class == "video" && type == "hdmi_micro" && rotation == 180 && side == "top") {
place(loc_x+1,depth-(wallthick+gap)-8-wallthick/2,loc_z+1.5,6,8,rotation,side)
rotate([90,0,0]) slot(6,8,wallthick);
}
if(class == "video" && type == "hdmi_micro" && rotation == 270 && side == "top") {
place(width-(wallthick+gap)-8-wallthick/2,loc_y-.75,loc_z+1.5,6,8,rotation,side)
rotate([90,0,0]) slot(6,8,wallthick);
}
if(class == "video" && type == "hdmi_micro" && rotation == 0 && side == "bottom") {
place(loc_x+1.5,-(wallthick+gap)+wallthick/2,loc_z-3,6,8,rotation,side)
rotate([90,0,0]) slot(6,8,wallthick);
}
if(class == "video" && type == "hdmi_micro" && rotation == 90 && side == "bottom") {
place(width-(wallthick+gap)-8-wallthick/2,loc_y+1.25,loc_z-3,6,8,rotation,side)
rotate([90,0,0]) slot(6,8,wallthick);
}
if(class == "video" && type == "hdmi_micro" && rotation == 180 && side == "bottom") {
place(loc_x-1,depth-(wallthick+gap)-8-wallthick/2,loc_z-3,6,8,rotation,side)
rotate([90,0,0]) slot(6,8,wallthick);
}
if(class == "video" && type == "hdmi_micro" && rotation == 270 && side == "bottom") {
place(-gap-wallthick/2,loc_y-.5,loc_z-3,6,8,rotation,side)
rotate([90,0,0]) slot(6,8,wallthick);
}
// hdmi mini indent
if(class == "video" && type == "hdmi_mini" && rotation == 0 && side == "top") {
place(loc_x+.5,loc_y-gap-wallthick/2+1,loc_z+1.5,6,10,rotation,side)
rotate([90,0,0]) slot(6,10,wallthick);
}
if(class == "video" && type == "hdmi_mini" && rotation == 90 && side == "top") {
place(loc_x-wallthick/2,loc_y+3.5,loc_z+1.5,6,8,rotation,side)
rotate([90,0,0]) slot(6,8,wallthick);
}
if(class == "video" && type == "hdmi_mini" && rotation == 180 && side == "top") {
place(loc_x+4.5,loc_y-wallthick/2,loc_z+1.5,6,10,rotation,side)
rotate([90,0,0]) slot(6,10,wallthick);
}
if(class == "video" && type == "hdmi_mini" && rotation == 270 && side == "top") {
place(loc_x+wallthick/2,loc_y+1.5,loc_z+1.5,6,8,rotation,side)
rotate([90,0,0]) slot(6,8,wallthick);
}
if(class == "video" && type == "hdmi_mini" && rotation == 0 && side == "bottom") {
place(loc_x+4.5,loc_y-gap-wallthick/2+1,loc_z-3,6,10,rotation,side)
rotate([90,0,0]) slot(6,10,wallthick);
}
if(class == "video" && type == "hdmi_mini" && rotation == 90 && side == "bottom") {
place(loc_x+wallthick/2,loc_y+3.5,loc_z-3,6,8,rotation,side)
rotate([90,0,0]) slot(6,8,wallthick);
}
if(class == "video" && type == "hdmi_mini" && rotation == 180 && side == "bottom") {
place(loc_x+.5,loc_y-wallthick/2,loc_z-3,6,10,rotation,side)
rotate([90,0,0]) slot(6,10,wallthick);
}
if(class == "video" && type == "hdmi_mini" && rotation == 270 && side == "bottom") {
place(loc_x-wallthick/2,loc_y+1.5,loc_z-3,6,8,rotation,side)
rotate([90,0,0]) slot(6,8,wallthick);
}
// power plug indent
if(type == "pwr5.5_7.5x11.5" && rotation == 0 && side == "top") {
place(loc_x+3.75,-(wallthick+gap)+wallthick/2,loc_z+6.25,10,10,rotation,side)
rotate([90,0,0]) cylinder(d=10, h=wallthick);
}
if(type == "pwr5.5_7.5x11.5" && rotation == 90 && side == "top") {
place(-gap-wallthick/2,loc_y-6.25,loc_z+6.25,10,10,rotation,side)
rotate([90,0,0]) cylinder(d=10, h=wallthick);
}
if(type == "pwr5.5_7.5x11.5" && rotation == 180 && side == "top") {
place(loc_x-6.5,depth-10-(wallthick+gap)-wallthick/2,loc_z+6.25,10,10,rotation,side)
rotate([90,0,0]) cylinder(d=10, h=wallthick);
}
if(type == "pwr5.5_7.5x11.5" && rotation == 270 && side == "top") {
place(width-(wallthick+gap)-10-wallthick/2,loc_y+3.75,loc_z+6.25,10,10,rotation,side)
rotate([90,0,0]) cylinder(d=10, h=wallthick);
}
if(type == "pwr2.5_5x7.5" && rotation == 0 && side == "top") {
place(loc_x+2.75,-(wallthick+gap)+wallthick/2,loc_z+2.1,7,7,rotation,side)
rotate([90,0,0]) cylinder(d=7, h=wallthick);
}
if(type == "pwr2.5_5x7.5" && rotation == 90 && side == "top") {
place(-(wallthick+gap)+wallthick/2,loc_y-4.5,loc_z+2,7,7,rotation,side)
rotate([90,0,0]) cylinder(d=7, h=wallthick);
}
if(type == "pwr2.5_5x7.5" && rotation == 180 && side == "top") {
place(loc_x-4.5,depth-(wallthick+gap)-7-wallthick/2,loc_z+2,7,7,rotation,side)
rotate([90,0,0]) cylinder(d=7, h=wallthick);
}
if(type == "pwr2.5_5x7.5" && rotation == 270 && side == "top") {
place(width-(wallthick+gap)-7-wallthick/2,loc_y+2.5,loc_z+2,7,7,rotation,side)
rotate([90,0,0]) cylinder(d=7, h=wallthick);
}
// micro usb indent
if(class == "usb2" && type == "micro" && rotation == 0 && side == "top") {
place(loc_x-.5,-(wallthick+gap)+wallthick/2,loc_z+1.9,6,8,rotation,side)
rotate([90,0,0]) slot(6,8,wallthick);
}
if(class == "usb2" && type == "micro" && rotation == 90 && side == "top") {
place(-gap-wallthick/2,loc_y+1.5,loc_z+1.9,6,8,rotation,side)
rotate([90,0,0]) slot(6,8,wallthick);
}
if(class == "usb2" && type == "micro" && rotation == 180 && side == "top") {
place(loc_x+1.5,depth-(wallthick+gap)-8-wallthick/2,loc_z+1.9,6,8,rotation,side)
rotate([90,0,0]) slot(6,8,wallthick);
}
if(class == "usb2" && type == "micro" && rotation == 270 && side == "top") {
place(width-(wallthick+gap)-8-wallthick/2,loc_y-.5,loc_z+1.9,6,8,rotation,side)
rotate([90,0,0]) slot(6,8,wallthick);
}
if(class == "usb2" && type == "micro" && rotation == 0 && side == "bottom") {
place(loc_x+1.5,-(wallthick+gap)+wallthick/2,loc_z-3.25,6,8,rotation,side)
rotate([90,0,0]) slot(6,8,wallthick);
}
if(class == "usb2" && type == "micro" && rotation == 90 && side == "bottom") {
place(width-(wallthick+gap)-8-wallthick/2,loc_y+1.5,loc_z-3.25,6,8,rotation,side)
rotate([90,0,0]) slot(6,8,wallthick);
}
if(class == "usb2" && type == "micro" && rotation == 180 && side == "bottom") {
place(loc_x-.5,depth-(wallthick+gap)-8-wallthick/2,loc_z-3.25,6,8,rotation,side)
rotate([90,0,0]) slot(6,8,wallthick);
}
if(class == "usb2" && type == "micro" && rotation == 270 && side == "bottom") {
place(-gap-wallthick/2,loc_y-.5,loc_z-3.25,6,8,rotation,side)
rotate([90,0,0]) slot(6,8,wallthick);
}
// single horizontal usbc indent
if(class == "usbc" && type == "single_horizontal" && rotation == 0 && side == "top") {
place(loc_x+.5,-(wallthick+gap)+wallthick/2,loc_z+1.75,6,8,rotation,side)
rotate([90,0,0]) slot(6,8,wallthick);
}
if(class == "usbc" && type == "single_horizontal" && rotation == 90 && side == "top") {
place(-gap-wallthick/2,loc_y+2.5,loc_z+1.75,6,8,rotation,side)
rotate([90,0,0]) slot(6,8,wallthick);
}
if(class == "usbc" && type == "single_horizontal" && rotation == 180 && side == "top") {
place(loc_x+2.5,depth-(wallthick+gap)-8-wallthick/2,loc_z+2,6,8,rotation,side)
rotate([90,0,0]) slot(6,8,wallthick);
}
if(class == "usbc" && type == "single_horizontal" && rotation == 270 && side == "top") {
place(width-(wallthick+gap)-8-wallthick/2,loc_y+.5,loc_z+1.75,6,8,rotation,side)
rotate([90,0,0]) slot(6,8,wallthick);
}
if(class == "usbc" && type == "single_horizontal" && rotation == 0 && side == "bottom") {
place(loc_x+2.75,-(wallthick+gap)+wallthick/2,loc_z-3.25,6,8,rotation,side)
rotate([90,0,0]) slot(6,8,wallthick);
}
if(class == "usbc" && type == "single_horizontal" && rotation == 90 && side == "bottom") {
place(width-(wallthick+gap)-8-wallthick/2,loc_y+2.5,loc_z-3.25,6,8,rotation,side)
rotate([90,0,0]) slot(6,8,wallthick-(wallthick+gap)+wallthick/2);
}
if(class == "usbc" && type == "single_horizontal" && rotation == 180 && side == "bottom") {
place(loc_x+.5,depth-(wallthick+gap)-8-wallthick/2,loc_z-3.25,6,8,rotation,side)
rotate([90,0,0]) slot(6,8,wallthick);
}
if(class == "usbc" && type == "single_horizontal" && rotation == 270 && side == "bottom") {
place(-gap-wallthick/2,loc_y+.5,loc_z-3.25,6,8,rotation,side)
rotate([90,0,0]) slot(6,8,wallthick);
}
// audio jack indent
if(class == "audio" && type == "jack_3.5" && rotation == 0 && side == "top") {
place(loc_x+3.15,-(wallthick+gap)+wallthick/2,loc_z+2,8,8,rotation,side)
rotate([90,0,0]) cylinder(d=10, h=wallthick);
}
if(class == "audio" && type == "jack_3.5" && rotation == 90 && side == "top") {
place(-gap-wallthick/2,loc_y-4.6,loc_z+2,8,8,rotation,side)
rotate([90,0,0]) cylinder(d=10, h=wallthick);
}
if(class == "audio" && type == "jack_3.5" && rotation == 180 && side == "top") {
place(loc_x-4.6,depth-(wallthick+gap)-8-wallthick/2,loc_z+2,8,8,rotation,side)
rotate([90,0,0]) cylinder(d=10, h=wallthick);
}
if(class == "audio" && type == "jack_3.5" && rotation == 270 && side == "top") {
place(width-(wallthick+gap)-8-wallthick/2,loc_y+3.15,loc_z+2,8,8,rotation,side)
rotate([90,0,0]) cylinder(d=10, h=wallthick);
}
if(class == "audio" && type == "jack_3.5" && rotation == 0 && side == "bottom") {
place(loc_x-4.6,-(wallthick+gap)+wallthick/2,loc_z-3.5,8,8,rotation,side)
rotate([90,0,0]) cylinder(d=10, h=wallthick);
}
if(class == "audio" && type == "jack_3.5" && rotation == 90 && side == "bottom") {
place(width-(wallthick+gap)-8-wallthick/2,loc_y-4.6,loc_z-3.5,8,8,rotation,side)
rotate([90,0,0]) cylinder(d=10, h=wallthick);
}
if(class == "audio" && type == "jack_3.5" && rotation == 180 && side == "bottom") {
place(loc_x+3.15,depth-(wallthick+gap)-8-wallthick/2,loc_z-3.5,8,8,rotation,side)
rotate([90,0,0]) cylinder(d=10, h=wallthick);
}
if(class == "audio" && type == "jack_3.5" && rotation == 270 && side == "bottom") {
place(-gap-wallthick/2,loc_y+3.15,loc_z-3.5,8,8,rotation,side)
rotate([90,0,0]) cylinder(d=10, h=wallthick);
}
}

301
mod/parametric_move.scad Normal file
View File

@@ -0,0 +1,301 @@
module parametric_move_add(type,loc_x,loc_y,loc_z,face,rotation,parametric,
size_x,size_y,size_z,data_1,data_2,data_3,data_4) {
// absolute no parametrics
if(parametric[1] == false && parametric[2] == false && parametric[3] == false) {
add(type,loc_x,loc_y,loc_z,face,rotation,size_x,size_y,size_z,data_1,data_2,data_3,data_4);
}
// x axis accessory parametrics
if(parametric[1] == true && parametric[2] == false && parametric[3] == false) {
if(parametric[0] == "case") {
add(type,loc_x+case_offset_x,loc_y,loc_z,
face,rotation,size_x,size_y,size_z,data_1,data_2,data_3,data_4);
}
if(parametric[0] == "sbc") {
add(type,loc_x+pcb_loc_x,loc_y,loc_z,
face,rotation,size_x,size_y,size_z,data_1,data_2,data_3,data_4);
}
}
// y axis accessory parametrics
if(parametric[1] == false && parametric[2] == true && parametric[3] == false) {
if(parametric[0] == "case") {
add(type,loc_x,loc_y+case_offset_y,loc_z,
face,rotation,size_x,size_y,size_z,data_1,data_2,data_3,data_4);
}
if(parametric[0] == "sbc") {
add(type,loc_x,loc_y+pcb_loc_y,loc_z,
face,rotation,size_x,size_y,size_z,data_1,data_2,data_3,data_4);
}
}
// z axis accessory parametrics
if(parametric[1] == false && parametric[2] == false && parametric[3] == true) {
if(parametric[0] == "case" && face == "top") {
add(type,loc_x,loc_y,loc_z+case_offset_tz+case_offset_bz,
face,rotation,size_x,size_y,size_z,data_1,data_2,data_3,data_4);
}
if(parametric[0] == "case" && face == "bottom") {
add(type,loc_x,loc_y,loc_z+case_offset_bz,
face,rotation,size_x,size_y,size_z,data_1,data_2,data_3,data_4);
}
if(parametric[0] == "case" && face != "bottom" && face != "top") {
add(type,loc_x,loc_y,loc_z,
face,rotation,size_x,size_y,size_z,data_1,data_2,data_3,data_4);
}
if(parametric[0] == "sbc") {
add(type,loc_x,loc_y,loc_z+pcb_loc_z,
face,rotation,size_x,size_y,size_z,data_1,data_2,data_3,data_4);
}
if(parametric[0] == "sbc-case_z" && face == "top") {
add(type,loc_x,loc_y,loc_z+case_offset_tz+case_offset_bz,
face,rotation,size_x,size_y,size_z,data_1,data_2,data_3,data_4);
}
if(parametric[0] == "sbc-case_z" && face == "bottom") {
add(type,loc_x,loc_y,loc_z+case_offset_bz,
face,rotation,size_x,size_y,size_z,data_1,data_2,data_3,data_4);
}
}
// xy axis accessory parametrics
if(parametric[1] == true && parametric[2] == true && parametric[3] == false) {
if(parametric[0] == "case") {
add(type,loc_x+case_offset_x,loc_y+case_offset_y,loc_z,
face,rotation,size_x,size_y,size_z,data_1,data_2,data_3,data_4);
}
if(parametric[0] == "sbc") {
add(type,loc_x+pcb_loc_x,loc_y+pcb_loc_y,loc_z,
face,rotation,size_x,size_y,size_z,data_1,data_2,data_3,data_4);
}
}
// xz axis accessory parametrics
if(parametric[1] == true && parametric[2] == false && parametric[3] == true) {
if(parametric[0] == "case" && face == "top") {
add(type,loc_x+case_offset_x,loc_y,loc_z+case_offset_tz+case_offset_bz,
face,rotation,size_x,size_y,size_z,data_1,data_2,data_3,data_4);
}
if(parametric[0] == "case" && face == "bottom") {
add(type,loc_x+case_offset_x,loc_y,loc_z+case_offset_bz,
face,rotation,size_x,size_y,size_z,data_1,data_2,data_3,data_4);
}
if(parametric[0] == "case" && face != "bottom" && face != "top") {
add(type,loc_x+case_offset_x,loc_y,loc_z,
face,rotation,size_x,size_y,size_z,data_1,data_2,data_3,data_4);
}
if(parametric[0] == "sbc") {
add(type,loc_x+pcb_loc_x,loc_y,loc_z+pcb_loc_z,
face,rotation,size_x,size_y,size_z,data_1,data_2,data_3,data_4);
}
if(parametric[0] == "sbc-case_z" && face == "top") {
add(type,loc_x+pcb_loc_x,loc_y,loc_z+case_offset_tz+case_offset_bz,
face,rotation,size_x,size_y,size_z,data_1,data_2,data_3,data_4);
}
if(parametric[0] == "sbc-case_z" && face == "bottom") {
add(type,loc_x+pcb_loc_x,loc_y,loc_z+case_offset_bz,
face,rotation,size_x,size_y,size_z,data_1,data_2,data_3,data_4);
}
}
// yz axis accessory parametrics
if(parametric[1] == false && parametric[2] == true && parametric[3] == true) {
if(parametric[0] == "case" && face == "top") {
add(type,loc_x,loc_y+case_offset_y,loc_z+case_offset_tz+case_offset_bz,
face,rotation,size_x,size_y,size_z,data_1,data_2,data_3,data_4);
}
if(parametric[0] == "case" && face == "bottom") {
add(type,loc_x,loc_y+case_offset_y,loc_z+case_offset_bz,
face,rotation,size_x,size_y,size_z,data_1,data_2,data_3,data_4);
}
if(parametric[0] == "case" && face != "bottom" && face != "top") {
add(type,loc_x,loc_y+case_offset_y,loc_z,
face,rotation,size_x,size_y,size_z,data_1,data_2,data_3,data_4);
}
if(parametric[0] == "sbc") {
add(type,loc_x,loc_y+pcb_loc_y,loc_z+pcb_loc_z,
face,rotation,size_x,size_y,size_z,data_1,data_2,data_3,data_4);
}
if(parametric[0] == "sbc-case_z" && face == "top") {
add(type,loc_x,loc_y+pcb_loc_y,loc_z+case_offset_tz+case_offset_bz,
face,rotation,size_x,size_y,size_z,data_1,data_2,data_3,data_4);
}
if(parametric[0] == "sbc-case_z" && face == "bottom") {
add(type,loc_x,loc_y+pcb_loc_y,loc_z+case_offset_bz,
face,rotation,size_x,size_y,size_z,data_1,data_2,data_3,data_4);
}
}
// xyz axis accessory parametrics
if(parametric[1] == true && parametric[2] == true && parametric[3] == true) {
if(parametric[0] == "case" && face == "top") {
add(type,loc_x+case_offset_x,loc_y+case_offset_y,loc_z+case_offset_tz+case_offset_bz,
face,rotation,size_x,size_y,size_z,data_1,data_2,data_3,data_4);
}
if(parametric[0] == "case" && face == "bottom") {
add(type,loc_x+case_offset_x,loc_y+case_offset_y,loc_z+case_offset_bz,
face,rotation,size_x,size_y,size_z,data_1,data_2,data_3,data_4);
}
if(parametric[0] == "case" && face != "bottom" && face != "top") {
add(type,loc_x+case_offset_x,loc_y+case_offset_y,loc_z,
face,rotation,size_x,size_y,size_z,data_1,data_2,data_3,data_4);
}
if(parametric[0] == "sbc") {
add(type,loc_x+pcb_loc_x,loc_y+pcb_loc_y,loc_z+pcb_loc_z,
face,rotation,size_x,size_y,size_z,data_1,data_2,data_3,data_4);
}
if(parametric[0] == "sbc-case_z" && face == "top") {
add(type,loc_x+pcb_loc_x,loc_y+pcb_loc_y,loc_z+case_offset_tz+case_offset_bz,
face,rotation,size_x,size_y,size_z,data_1,data_2,data_3,data_4);
}
if(parametric[0] == "sbc-case_z" && face == "bottom") {
add(type,loc_x+pcb_loc_x,loc_y+pcb_loc_y,loc_z+case_offset_bz,
face,rotation,size_x,size_y,size_z,data_1,data_2,data_3,data_4);
}
}
}
module parametric_move_sub(type,loc_x,loc_y,loc_z,face,rotation,parametric,
size_x,size_y,size_z,data_1,data_2,data_3,data_4) {
// absolute no parametrics
if(parametric[1] == false && parametric[2] == false && parametric[3] == false) {
sub(type,loc_x,loc_y,loc_z,face,rotation,size_x,size_y,size_z,data_1,data_2,data_3,data_4);
}
// x axis accessory parametrics
if(parametric[1] == true && parametric[2] == false && parametric[3] == false) {
if(parametric[0] == "case") {
sub(type,loc_x+case_offset_x,loc_y,loc_z,
face,rotation,size_x,size_y,size_z,data_1,data_2,data_3,data_4);
}
if(parametric[0] == "sbc") {
sub(type,loc_x+pcb_loc_x,loc_y,loc_z,
face,rotation,size_x,size_y,size_z,data_1,data_2,data_3,data_4);
}
}
// y axis accessory parametrics
if(parametric[1] == false && parametric[2] == true && parametric[3] == false) {
if(parametric[0] == "case") {
sub(type,loc_x,loc_y+case_offset_y,loc_z,
face,rotation,size_x,size_y,size_z,data_1,data_2,data_3,data_4);
}
if(parametric[0] == "sbc") {
sub(type,loc_x,loc_y+pcb_loc_y,loc_z,
face,rotation,size_x,size_y,size_z,data_1,data_2,data_3,data_4);
}
}
// z axis accessory parametrics
if(parametric[1] == false && parametric[2] == false && parametric[3] == true) {
if(parametric[0] == "case" && face == "top") {
sub(type,loc_x,loc_y,loc_z+case_offset_tz+case_offset_bz,
face,rotation,size_x,size_y,size_z,data_1,data_2,data_3,data_4);
}
if(parametric[0] == "case" && face == "bottom") {
sub(type,loc_x,loc_y,loc_z+case_offset_bz,
face,rotation,size_x,size_y,size_z,data_1,data_2,data_3,data_4);
}
if(parametric[0] == "case" && face != "bottom" && face != "top") {
sub(type,loc_x,loc_y,loc_z,
face,rotation,size_x,size_y,size_z,data_1,data_2,data_3,data_4);
}
if(parametric[0] == "sbc") {
sub(type,loc_x,loc_y,loc_z+pcb_loc_z,
face,rotation,size_x,size_y,size_z,data_1,data_2,data_3,data_4);
}
if(parametric[0] == "sbc-case_z" && face == "top") {
sub(type,loc_x,loc_y,loc_z+case_offset_tz+case_offset_bz,
face,rotation,size_x,size_y,size_z,data_1,data_2,data_3,data_4);
}
if(parametric[0] == "sbc-case_z" && face == "bottom") {
sub(type,loc_x,loc_y,loc_z+case_offset_bz,
face,rotation,size_x,size_y,size_z,data_1,data_2,data_3,data_4);
}
}
// xy axis accessory parametrics
if(parametric[1] == true && parametric[2] == true && parametric[3] == false) {
if(parametric[0] == "case") {
sub(type,loc_x+case_offset_x,loc_y+case_offset_y,loc_z,
face,rotation,size_x,size_y,size_z,data_1,data_2,data_3,data_4);
}
if(parametric[0] == "sbc") {
sub(type,loc_x+pcb_loc_x,loc_y+pcb_loc_y,loc_z,
face,rotation,size_x,size_y,size_z,data_1,data_2,data_3,data_4);
}
}
// xz axis accessory parametrics
if(parametric[1] == true && parametric[2] == false && parametric[3] == true) {
if(parametric[0] == "case" && face == "top") {
sub(type,loc_x+case_offset_x,loc_y,loc_z+case_offset_tz+case_offset_bz,
face,rotation,size_x,size_y,size_z,data_1,data_2,data_3,data_4);
}
if(parametric[0] == "case" && face == "bottom") {
sub(type,loc_x+case_offset_x,loc_y,loc_z+case_offset_bz,
face,rotation,size_x,size_y,size_z,data_1,data_2,data_3,data_4);
}
if(parametric[0] == "case" && face != "bottom" && face != "top") {
sub(type,loc_x+case_offset_x,loc_y,loc_z,
face,rotation,size_x,size_y,size_z,data_1,data_2,data_3,data_4);
}
if(parametric[0] == "sbc") {
sub(type,loc_x+pcb_loc_x,loc_y,loc_z+pcb_loc_z,
face,rotation,size_x,size_y,size_z,data_1,data_2,data_3,data_4);
}
if(parametric[0] == "sbc-case_z" && face == "top") {
sub(type,loc_x+pcb_loc_x,loc_y,loc_z+case_offset_tz+case_offset_bz,
face,rotation,size_x,size_y,size_z,data_1,data_2,data_3,data_4);
}
if(parametric[0] == "sbc-case_z" && face == "bottom") {
sub(type,loc_x+pcb_loc_x,loc_y,loc_z+case_offset_bz,
face,rotation,size_x,size_y,size_z,data_1,data_2,data_3,data_4);
}
}
// yz axis accessory parametrics
if(parametric[1] == false && parametric[2] == true && parametric[3] == true) {
if(parametric[0] == "case" && face == "top") {
sub(type,loc_x,loc_y+case_offset_y,loc_z+case_offset_tz+case_offset_bz,
face,rotation,size_x,size_y,size_z,data_1,data_2,data_3,data_4);
}
if(parametric[0] == "case" && face == "bottom") {
sub(type,loc_x,loc_y+case_offset_y,loc_z+case_offset_bz,
face,rotation,size_x,size_y,size_z,data_1,data_2,data_3,data_4);
}
if(parametric[0] == "case" && face != "bottom" && face != "top") {
sub(type,loc_x,loc_y+case_offset_y,loc_z,
face,rotation,size_x,size_y,size_z,data_1,data_2,data_3,data_4);
}
if(parametric[0] == "sbc") {
sub(type,loc_x,loc_y+pcb_loc_y,loc_z+pcb_loc_z,
face,rotation,size_x,size_y,size_z,data_1,data_2,data_3,data_4);
}
if(parametric[0] == "sbc-case_z" && face == "top") {
sub(type,loc_x,loc_y+pcb_loc_y,loc_z+case_offset_tz+case_offset_bz,
face,rotation,size_x,size_y,size_z,data_1,data_2,data_3,data_4);
}
if(parametric[0] == "sbc-case_z" && face == "bottom") {
sub(type,loc_x,loc_y+pcb_loc_y,loc_z+case_offset_bz,
face,rotation,size_x,size_y,size_z,data_1,data_2,data_3,data_4);
}
}
// xyz axis accessory parametrics
if(parametric[1] == true && parametric[2] == true && parametric[3] == true) {
if(parametric[0] == "case" && face == "top") {
sub(type,loc_x+case_offset_x,loc_y+case_offset_y,loc_z+case_offset_tz+case_offset_bz,
face,rotation,size_x,size_y,size_z,data_1,data_2,data_3,data_4);
}
if(parametric[0] == "case" && face == "bottom") {
sub(type,loc_x+case_offset_x,loc_y+case_offset_y,loc_z+case_offset_bz,
face,rotation,size_x,size_y,size_z,data_1,data_2,data_3,data_4);
}
if(parametric[0] == "case" && face != "bottom" && face != "top") {
sub(type,loc_x+case_offset_x,loc_y+case_offset_y,loc_z,
face,rotation,size_x,size_y,size_z,data_1,data_2,data_3,data_4);
}
if(parametric[0] == "sbc") {
sub(type,loc_x+pcb_loc_x,loc_y+pcb_loc_y,loc_z+pcb_loc_z,
face,rotation,size_x,size_y,size_z,data_1,data_2,data_3,data_4);
}
if(parametric[0] == "sbc-case_z" && face == "top") {
sub(type,loc_x+pcb_loc_x,loc_y+pcb_loc_y,loc_z+case_offset_tz+case_offset_bz,
face,rotation,size_x,size_y,size_z,data_1,data_2,data_3,data_4);
}
if(parametric[0] == "sbc-case_z" && face == "bottom") {
sub(type,loc_x+pcb_loc_x,loc_y+pcb_loc_y,loc_z+case_offset_bz,
face,rotation,size_x,size_y,size_z,data_1,data_2,data_3,data_4);
}
}
}

46
mod/place.scad Normal file
View File

@@ -0,0 +1,46 @@
/*
place(x,y,z,size_x,size_y,rotation,side)
*/
/* placement module *must be first* for children() */
module place(x,y,z,size_x,size_y,rotation,side) {
if (side == "top") {
if (rotation == 0 || rotation == 90 || rotation == 180 || rotation == 270) {
if ((rotation >= 0 && rotation < 90) || (rotation < -270 && rotation > -360))
translate([x,y,z]) rotate([0,0,-rotation]) children();
if ((rotation >= 90 && rotation < 180) || (rotation < -180 && rotation >= -270))
translate([x,y+size_x,z]) rotate([0,0,-rotation]) children();
if ((rotation >= 180 && rotation < 270) || (rotation < -90 && rotation >= -180))
translate([x+size_x,y+size_y,z]) rotate([0,0,-rotation]) children(0);
if ((rotation >= 270 && rotation < 360) || (rotation < 0 && rotation >= -90))
translate([x+size_y,y,z]) rotate([0,0,-rotation]) children(); }
else {
translate([x,y,z]) rotate([0,0,-rotation]) children();
}
}
if (side == "bottom") {
if (rotation == 0 || rotation == 90 || rotation == 180 || rotation == 270) {
if ((rotation >= 0 && rotation < 90) || (rotation < -270 && rotation > -360))
translate([x+size_x,y,z]) rotate([0,180,rotation]) children();
if ((rotation >= 90 && rotation < 180) || (rotation < -180 && rotation >= -270))
translate([x+size_y,y+size_x,z]) rotate([0,180,rotation]) children();
if ((rotation >= 180 && rotation < 270) || (rotation < -90 && rotation >= -180))
translate([x,y+size_y,z]) rotate([0,180,rotation]) children();
if ((rotation >= 270 && rotation < 360) || (rotation < 0 && rotation >= -90))
translate([x,y,z]) rotate([0,180,rotation]) children(); }
else {
translate([x,y,z]) rotate([0,180,rotation]) children();
}
}
children([1:1:$children-1]);
}

70
mod/sub.scad Normal file
View File

@@ -0,0 +1,70 @@
/*
sub(type,loc_x,loc_y,loc_z,size_x,size_y,size_z,rotation,face,side,case_z,data_1,data_2,data_3,data_4)
*/
/* subtractive module */
module sub(type,loc_x,loc_y,loc_z,face,rotation,size_x,size_y,size_z,data_1,data_2,data_3,data_4) {
if(type == "rectangle") {
translate([loc_x,loc_y,loc_z]) rotate(rotation) slab_r([size_x,size_y,size_z],data_4);
}
if(type == "round") {
translate([loc_x,loc_y,loc_z]) rotate(rotation) cylinder(d=size_x,h=size_z);
}
if(type == "slot") {
translate([loc_x,loc_y,loc_z]) rotate(rotation) slot(size_x,size_y,size_z);
}
if(type == "text") {
translate([loc_x,loc_y,loc_z]) rotate(rotation) linear_extrude(height = size_z) text(data_3, size=data_1);
}
if(type == "art") {
translate([loc_x,loc_y,loc_z]) rotate(rotation) art(data_1,data_2,data_3);
}
if(type == "button") {
translate([loc_x,loc_y,loc_z]) rotate(rotation) button(data_3,[size_x,size_y,size_z],data_4,data_1);
}
if(type == "hd_holes") {
translate([loc_x,loc_y,loc_z]) rotate(rotation) hd_bottom_holes(data_1,data_3,"none","none",data_2);
}
if(type == "hd_vertleft_holes") {
translate([loc_x,loc_y,loc_z]) rotate(rotation) hd_bottom_holes(data_1,data_3,"vertical","left",data_2);
}
if(type == "hd_vertright_holes") {
translate([loc_x,loc_y,loc_z]) rotate(rotation) hd_bottom_holes(data_1,data_3,"vertical","right",data_2);
}
if(type == "hk_fan_top") {
translate([loc_x,loc_y,loc_z]) rotate(rotation) hk_fan_top();
}
if(type == "punchout") {
translate([loc_x,loc_y,loc_z]) rotate(rotation) punchout(size_x,size_y,data_1,size_z,data_2,data_3);
}
if(type == "fan") {
translate([loc_x,loc_y,loc_z]) rotate(rotation) fan_mask(size_x, size_z, data_1);
}
if(type == "vent") {
translate([loc_x,loc_y,loc_z]) rotate(rotation) vent(size_x,size_y,size_z,data_4,data_1,data_2,data_3);
}
if(type == "vent_hex") {
translate([loc_x,loc_y,loc_z]) rotate(rotation) vent_hex(size_x,size_y,size_z,data_1,data_2,data_3);
}
if(type == "microusb") {
translate([loc_x,loc_y,loc_z]) rotate(rotation) microusb_open();
}
if(type == "sphere") {
translate([loc_x,loc_y,loc_z]) rotate(rotation) sphere(d=size_x);
}
if(type == "keyhole") {
translate([loc_x,loc_y,loc_z]) rotate(rotation) keyhole(data_4, true);
}
if(type == "h3_port_extender") {
translate([loc_x,loc_y,loc_z]) rotate(rotation) h3_port_extender(data_3, true);
}
if(type == "hk_pwr_button") {
translate([loc_x,loc_y,loc_z]) rotate(rotation) hk_pwr_button(true);
}
if(type == "dsub") {
translate([loc_x,loc_y,loc_z]) rotate(rotation) dsub(data_4, true);
}
}