fixed indent for cases with more code standardization and cleanup

This commit is contained in:
Edward Kisiel
2024-01-31 22:36:53 -05:00
parent e5b9e8263c
commit ebcafd0f05
12 changed files with 117 additions and 81 deletions

View File

@@ -40,7 +40,7 @@ module button(style, size, radius, pad) {
diameter = size[0]; diameter = size[0];
height = size[2]; height = size[2];
gap = 1.5; gap = 1.5;
adjust = .01; adj = .01;
$fn = 90; $fn = 90;
if(style == "recess") { if(style == "recess") {
@@ -61,17 +61,17 @@ module button(style, size, radius, pad) {
} }
if(style == "cutout") { if(style == "cutout") {
difference() { difference() {
translate([-size[0]+2,-3-size[1]/2,0]) slab_r([size[0]+2,size[1]+6,size[2]-2*adjust], [.1,.1,.1,.1]); translate([-size[0]+2,-3-size[1]/2,0]) slab_r([size[0]+2,size[1]+6,size[2]-2*adj], [.1,.1,.1,.1]);
difference() { difference() {
translate([-size[0]+3,-size[1]/2,-adjust]) translate([-size[0]+3,-size[1]/2,-adj])
slab_r([size[0],size[1],size[2]], [radius[0],radius[1],radius[2],radius[3]]); slab_r([size[0],size[1],size[2]], [radius[0],radius[1],radius[2],radius[3]]);
translate([-size[0]+3+(gap/2),-size[1]/2+(gap/2),-1]) slab_r([size[0]-gap,size[1]-gap,1+size[2]+2*adjust], translate([-size[0]+3+(gap/2),-size[1]/2+(gap/2),-1]) slab_r([size[0]-gap,size[1]-gap,1+size[2]+2*adj],
[radius[0],radius[1],radius[2]-gap/2,radius[3]-gap/2]); [radius[0],radius[1],radius[2]-gap/2,radius[3]-gap/2]);
translate([-size[0]+3-gap,-1,-1]) cube([gap*2,2,1+height+2*adjust]); translate([-size[0]+3-gap,-1,-1]) cube([gap*2,2,1+height+2*adj]);
} }
translate([0,0,2]) sphere(d=3); translate([0,0,2]) sphere(d=3);
} }
translate([0,0,-pad+adjust]) cylinder(d=3, h=pad); translate([0,0,-pad+adj]) cylinder(d=3, h=pad);
} }
} }
@@ -90,7 +90,7 @@ module button(style, size, radius, pad) {
module button_assembly(style, diameter, height) { module button_assembly(style, diameter, height) {
adjust = .01; adj = .01;
$fn = 90; $fn = 90;
if(style == "recess") { if(style == "recess") {
@@ -115,16 +115,16 @@ $fn = 90;
module button_plunger(style, diameter, height) { module button_plunger(style, diameter, height) {
adjust = .01; adj = .01;
$fn = 90; $fn = 90;
if(style == "recess") { if(style == "recess") {
difference() { difference() {
translate([-1.5,-1,-(height)-2]) cube([3,2,height+1]); translate([-1.5,-1,-(height)-2]) cube([3,2,height+1]);
translate([-1.5-adjust,-1.5,-height]) cube([.5,3,1]); translate([-1.5-adj,-1.5,-height]) cube([.5,3,1]);
translate([1+adjust,-1.5,-height]) cube([.5,3,1]); translate([1+adj,-1.5,-height]) cube([.5,3,1]);
translate([-1.5-adjust,-1.5,-4]) cube([.5,3,4]); translate([-1.5-adj,-1.5,-4]) cube([.5,3,4]);
translate([1+adjust,-1.5,-4]) cube([.5,3,4]); translate([1+adj,-1.5,-4]) cube([.5,3,4]);
} }
} }
} }
@@ -144,13 +144,13 @@ $fn = 90;
module button_top(style, diameter, height) { module button_top(style, diameter, height) {
adjust = .01; adj = .01;
$fn = 90; $fn = 90;
if(style == "recess") { if(style == "recess") {
difference() { difference() {
translate([0,0,-3]) cylinder(d=5, h=2.75); translate([0,0,-3]) cylinder(d=5, h=2.75);
translate([-1.25,-1.25,-3-adjust]) cube([2.5,2.5,2]); translate([-1.25,-1.25,-3-adj]) cube([2.5,2.5,2]);
} }
} }
} }
@@ -168,14 +168,14 @@ $fn = 90;
module button_clip(style) { module button_clip(style) {
adjust = .01; adj = .01;
$fn = 90; $fn = 90;
if(style == "recess") { if(style == "recess") {
difference() { difference() {
cylinder(d=8.5, h=.8); cylinder(d=8.5, h=.8);
translate([-1.5,-1.75,-adjust]) cube([2.75,3.5,1]); translate([-1.5,-1.75,-adj]) cube([2.75,3.5,1]);
translate([-.75,-.75,-adjust]) cube([5,1.25,1.25]); translate([-.75,-.75,-adj]) cube([5,1.25,1.25]);
} }
} }
} }

View File

@@ -77,14 +77,14 @@ module hdmi_a() {
// single row female headers // single row female headers
module header_f(pins, height) { module header_f(pins, height) {
adjust = .01; adj = .01;
$fn = 90; $fn = 90;
size_x = 2.5; size_x = 2.5;
size_y = 2.5 * pins; size_y = 2.5 * pins;
union() { union() {
color("black") cube([size_x, size_y, height]); color("black") cube([size_x, size_y, height]);
for (i=[1:2.5:size_y]) { for (i=[1:2.5:size_y]) {
color("dimgray") translate ([1,i,height-5+adjust]) cube([.64,.64,5]); color("dimgray") translate ([1,i,height-5+adj]) cube([.64,.64,5]);
} }
} }
} }
@@ -171,15 +171,15 @@ module rj45(x,y,rotation,side,pcbsize_z) {
// momentary_4.5x4.5x1.5 button // momentary_4.5x4.5x1.5 button
module momentary45x15() { module momentary45x15() {
adjust = .01; adj = .01;
$fn = 90; $fn = 90;
size_x = 4.5; size_x = 4.5;
size_y = 4.5; size_y = 4.5;
size_z = 3.1; size_z = 3.1;
union() { union() {
color("black") translate([0,0,0]) cube([size_x,size_y,3]); color("black") translate([0,0,0]) cube([size_x,size_y,3]);
color("silver") translate([0,0,3-adjust]) cube([size_x,size_y,.1]); color("silver") translate([0,0,3-adj]) cube([size_x,size_y,.1]);
color("black") translate([2.25,2.25,3.1-adjust]) cylinder(d=2.35,h=1.50); color("black") translate([2.25,2.25,3.1-adj]) cylinder(d=2.35,h=1.50);
color("black") translate([.75,.75,3]) sphere(d=.75); color("black") translate([.75,.75,3]) sphere(d=.75);
color("black") translate([.75,3.75,3]) sphere(d=.75); color("black") translate([.75,3.75,3]) sphere(d=.75);
color("black") translate([3.75,.75,3]) sphere(d=.75); color("black") translate([3.75,.75,3]) sphere(d=.75);
@@ -191,7 +191,7 @@ module momentary45x15() {
// single row headers // single row headers
module header(pins) { module header(pins) {
adjust = .01; adj = .01;
$fn = 90; $fn = 90;
size_x = 2.54; size_x = 2.54;
size_y = 2.54 * pins; size_y = 2.54 * pins;
@@ -242,7 +242,7 @@ module micro2pin() {
// 3.5mm audio plug // 3.5mm audio plug
module audio_jack35() { module audio_jack35() {
adjust = .01; adj = .01;
$fn = 90; $fn = 90;
size_x = 6.5; size_x = 6.5;
size_y = 13.5; size_y = 13.5;
@@ -252,14 +252,14 @@ module audio_jack35() {
color("dimgray") cube([size_x,5.6,4]); color("dimgray") cube([size_x,5.6,4]);
color("dimgray") translate([size_x/2,0,2.25]) rotate([-90,0,0]) cylinder(d=6, h=size_y); color("dimgray") translate([size_x/2,0,2.25]) rotate([-90,0,0]) cylinder(d=6, h=size_y);
} }
color("gray") translate([size_x/2,0,2.25]) rotate([-90,0,0]) cylinder(d=3, h=size_y+adjust); color("gray") translate([size_x/2,0,2.25]) rotate([-90,0,0]) cylinder(d=3, h=size_y+adj);
} }
} }
// can capacitor // can capacitor
module capacitor(diameter, height) { module capacitor(diameter, height) {
adjust = .01; adj = .01;
$fn = 90; $fn = 90;
color("dimgray") rotate([0,0,0]) cylinder(d=diameter+.5, h=.5); color("dimgray") rotate([0,0,0]) cylinder(d=diameter+.5, h=.5);
color("silver") translate([0,0,.5]) cylinder(d=diameter+.5, h=.5); color("silver") translate([0,0,.5]) cylinder(d=diameter+.5, h=.5);
@@ -276,7 +276,7 @@ module ic(size) {
// d-sub connector // d-sub connector
module dsub(dsubsize, mask = false) { module dsub(dsubsize, mask = false) {
adjust=.01; adj=.01;
$fn = 90; $fn = 90;
if(mask == true) { if(mask == true) {

View File

@@ -33,7 +33,7 @@
module h3_port_extender(style, mask = false) { module h3_port_extender(style, mask = false) {
adjust=.01; adj=.01;
$fn = 90; $fn = 90;
if(style == "header") { if(style == "header") {
@@ -86,22 +86,22 @@ module h3_port_extender(style, mask = false) {
module h3_port_extender_holder(part,offset=2) { module h3_port_extender_holder(part,offset=2) {
size = [16-offset,40,5.5]; size = [16-offset,40,5.5];
adjust = .01; adj = .01;
if(part == "bottom" || part == "both") { if(part == "bottom" || part == "both") {
difference() { difference() {
translate([-10+offset,-3.5,2]) cube(size); translate([-10+offset,-3.5,2]) cube(size);
translate([-.25,-.25,-adjust]) cube([2.5, 33.25, 12]); translate([-.25,-.25,-adj]) cube([2.5, 33.25, 12]);
translate([2, 2, -adjust]) cube([10, 28, 12]); translate([2, 2, -adj]) cube([10, 28, 12]);
translate([-12,(33.25/2)+.25,4.5]) rotate([0,90,0]) cylinder(d=2.7, h=20, $fn=60); translate([-12,(33.25/2)+.25,4.5]) rotate([0,90,0]) cylinder(d=2.7, h=20, $fn=60);
// translate([-7,-1.,-adjust]) cylinder(d=4.25, h=20); // translate([-7,-1.,-adj]) cylinder(d=4.25, h=20);
} }
} }
if(part == "top" || part == "both") { if(part == "top" || part == "both") {
difference() { difference() {
translate([-10+offset,-3.5,29.5]) cube(size); translate([-10+offset,-3.5,29.5]) cube(size);
translate([-.25,-.25,28]) cube([2.5, 33.25, 12]); translate([-.25,-.25,28]) cube([2.5, 33.25, 12]);
translate([1.5, 2, 27.5-adjust]) cube([10, 28.5, 12]); translate([1.5, 2, 27.5-adj]) cube([10, 28.5, 12]);
translate([-12, -4, 28]) cube([20, 13, 10]); translate([-12, -4, 28]) cube([20, 13, 10]);
translate([1.35, 20, 25.5]) cube([10, 13, 5]); translate([1.35, 20, 25.5]) cube([10, 13, 5]);
translate([-12,(33.25/2)+.25,32]) rotate([0,90,0]) cylinder(d=2.7, h=20, $fn=60); translate([-12,(33.25/2)+.25,32]) rotate([0,90,0]) cylinder(d=2.7, h=20, $fn=60);

View File

@@ -34,7 +34,7 @@
module pcb_holder(size, wallthick) { module pcb_holder(size, wallthick) {
adjust=.01; adj=.01;
$fn = 90; $fn = 90;
difference() { difference() {
union() { union() {
@@ -55,7 +55,7 @@ module pcb_holder(size, wallthick) {
[-wallthick/2,2]]); [-wallthick/2,2]]);
} }
translate([-.5,0,2]) cube([size[0]+1,size[2],5]); translate([-.5,0,2]) cube([size[0]+1,size[2],5]);
translate([6,-adjust-5-1.75,-adjust]) cube([size[0]-12,14,8]); translate([6,-adj-5-1.75,-adj]) cube([size[0]-12,14,8]);
} }
} }

View File

@@ -30,44 +30,44 @@
module keyhole(keysize, mask = false) { module keyhole(keysize, mask = false) {
adjust=.01; adj=.01;
$fn = 90; $fn = 90;
if(mask == true) { if(mask == true) {
union() { union() {
translate([0, 0, -adjust]) cylinder(h=keysize[3]+2*adjust, d=keysize[0]); translate([0, 0, -adj]) cylinder(h=keysize[3]+2*adj, d=keysize[0]);
translate([-keysize[1]/2, 0, -adjust]) cube([keysize[1], keysize[2]+keysize[0]/2, keysize[3]+2*adjust]); translate([-keysize[1]/2, 0, -adj]) cube([keysize[1], keysize[2]+keysize[0]/2, keysize[3]+2*adj]);
translate([0, -keysize[1]/2, -adjust]) cube([keysize[2]+keysize[0]/2, keysize[1], keysize[3]+2*adjust]); translate([0, -keysize[1]/2, -adj]) cube([keysize[2]+keysize[0]/2, keysize[1], keysize[3]+2*adj]);
} }
} }
else { else {
difference() { difference() {
union() { union() {
translate([0, 0, -adjust]) translate([0, 0, -adj])
difference() { difference() {
difference() { difference() {
translate([-keysize[2], -keysize[2], keysize[3]]) cube([keysize[2]*3, keysize[2]*3, 4.5]); translate([-keysize[2], -keysize[2], keysize[3]]) cube([keysize[2]*3, keysize[2]*3, 4.5]);
translate([0, -10, 0]) rotate([0, 0, 135]) cube([20, 10, 10]); translate([0, -10, 0]) rotate([0, 0, 135]) cube([20, 10, 10]);
translate([keysize[2], keysize[2], -adjust]) cube([keysize[2]*3, keysize[2]*3, keysize[3]+5]); translate([keysize[2], keysize[2], -adj]) cube([keysize[2]*3, keysize[2]*3, keysize[3]+5]);
} }
difference() { difference() {
translate([-keysize[2]+2, -keysize[2]+2, keysize[3]-adjust]) translate([-keysize[2]+2, -keysize[2]+2, keysize[3]-adj])
cube([-4+keysize[2]*3, -4+keysize[2]*3, 3.5]); cube([-4+keysize[2]*3, -4+keysize[2]*3, 3.5]);
translate([2, -10, 0]) rotate([0, 0, 135]) cube([20, 10, 10]); translate([2, -10, 0]) rotate([0, 0, 135]) cube([20, 10, 10]);
translate([+keysize[2]-2, keysize[2]-2, -adjust]) translate([+keysize[2]-2, keysize[2]-2, -adj])
cube([keysize[2]*3, keysize[2]*3, keysize[3]+5]); cube([keysize[2]*3, keysize[2]*3, keysize[3]+5]);
} }
} }
difference() { difference() {
translate([-keysize[2], -keysize[2], 0]) cube([keysize[2]*3, keysize[2]*3, keysize[3]]); translate([-keysize[2], -keysize[2], 0]) cube([keysize[2]*3, keysize[2]*3, keysize[3]]);
translate([0, -10, -adjust]) rotate([0, 0, 135]) cube([20, 10, 10]); translate([0, -10, -adj]) rotate([0, 0, 135]) cube([20, 10, 10]);
} }
} }
translate([keysize[2], keysize[2], -adjust]) cube([keysize[2]*3, keysize[2]*3, keysize[3]+2*adjust]); translate([keysize[2], keysize[2], -adj]) cube([keysize[2]*3, keysize[2]*3, keysize[3]+2*adj]);
union() { union() {
translate([0, 0, -adjust]) cylinder(h=keysize[3]+2*adjust, d=keysize[0]); translate([0, 0, -adj]) cylinder(h=keysize[3]+2*adj, d=keysize[0]);
translate([-keysize[1]/2, 0, -adjust]) cube([keysize[1], keysize[2]+keysize[0]/2, keysize[3]+2*adjust]); translate([-keysize[1]/2, 0, -adj]) cube([keysize[1], keysize[2]+keysize[0]/2, keysize[3]+2*adj]);
translate([0, -keysize[1]/2, -adjust]) cube([keysize[2]+keysize[0]/2, keysize[1], keysize[3]+2*adjust]); translate([0, -keysize[1]/2, -adj]) cube([keysize[2]+keysize[0]/2, keysize[1], keysize[3]+2*adj]);
} }
} }
} }

View File

@@ -28,7 +28,7 @@
module pcb_pad(pads = 1, style = "round") { module pcb_pad(pads = 1, style = "round") {
adjust = .01; adj = .01;
$fn = 90; $fn = 90;
pad_size = 1.25; pad_size = 1.25;
size_y = 2.54; size_y = 2.54;
@@ -38,13 +38,13 @@ module pcb_pad(pads = 1, style = "round") {
if(style == "round") { if(style == "round") {
difference() { difference() {
color("#fee5a6") translate ([i,0,0]) cylinder(d=pad_size, h=.125); color("#fee5a6") translate ([i,0,0]) cylinder(d=pad_size, h=.125);
color("dimgray") translate([i,0,-adjust]) cylinder(d=.625, h=.125+2*adjust); color("dimgray") translate([i,0,-adj]) cylinder(d=.625, h=.125+2*adj);
} }
} }
if(style == "square") { if(style == "square") {
difference() { difference() {
color("#fee5a6") translate ([i-pad_size/2,-pad_size/2,0]) cube([pad_size, pad_size, .125]); color("#fee5a6") translate ([i-pad_size/2,-pad_size/2,0]) cube([pad_size, pad_size, .125]);
color("dimgray") translate([i,0,-adjust]) cylinder(d=.625, h=.125+2*adjust); color("dimgray") translate([i,0,-adj]) cylinder(d=.625, h=.125+2*adj);
} }
} }
} }

View File

@@ -55,7 +55,7 @@ module standoff(stand_off){
i_dia = stand_off[9]; i_dia = stand_off[9];
i_depth = stand_off[10]; i_depth = stand_off[10];
adjust = 0.1; adj = 0.1;
difference (){ difference (){
union () { union () {
@@ -80,44 +80,44 @@ module standoff(stand_off){
} }
// hole // hole
if(sink <= 3 && reverse == 0) { if(sink <= 3 && reverse == 0) {
translate([0,0,-adjust]) cylinder(d=holesize, h=height+(adjust*2),$fn=90); translate([0,0,-adj]) cylinder(d=holesize, h=height+(adj*2),$fn=90);
} }
if(sink <= 3 && reverse == 1) { if(sink <= 3 && reverse == 1) {
translate([0,0,-adjust-height]) cylinder(d=holesize, h=height+(adjust*2),$fn=90); translate([0,0,-adj-height]) cylinder(d=holesize, h=height+(adj*2),$fn=90);
} }
// countersink hole // countersink hole
if(sink == 1 && reverse == 0) { if(sink == 1 && reverse == 0) {
translate([0,0,-adjust]) cylinder(d1=6.5, d2=(holesize), h=3); translate([0,0,-adj]) cylinder(d1=6.5, d2=(holesize), h=3);
} }
if(sink == 1 && reverse == 1) { if(sink == 1 && reverse == 1) {
translate([0,0,+adjust-2.5]) cylinder(d1=(holesize), d2=6.5, h=3); translate([0,0,+adj-2.5]) cylinder(d1=(holesize), d2=6.5, h=3);
} }
// recessed hole // recessed hole
if(sink == 2 && reverse == 0) { if(sink == 2 && reverse == 0) {
translate([0,0,-adjust]) cylinder(d=6.5, h=3); translate([0,0,-adj]) cylinder(d=6.5, h=3);
} }
if(sink == 2 && reverse == 1) { if(sink == 2 && reverse == 1) {
translate([0,0,+adjust-3]) cylinder(d=6.5, h=3); translate([0,0,+adj-3]) cylinder(d=6.5, h=3);
} }
// nut holder // nut holder
if(sink == 3 && reverse == 0) { if(sink == 3 && reverse == 0) {
translate([0,0,-adjust]) cylinder(r=3.3,h=3,$fn=6); translate([0,0,-adj]) cylinder(r=3.3,h=3,$fn=6);
} }
if(sink == 3 && reverse == 1) { if(sink == 3 && reverse == 1) {
translate([0,0,+adjust-3]) cylinder(r=3.3,h=3,$fn=6); translate([0,0,+adj-3]) cylinder(r=3.3,h=3,$fn=6);
} }
// blind hole // blind hole
if(sink == 4 && reverse == 0) { if(sink == 4 && reverse == 0) {
translate([0,0,2]) cylinder(d=holesize, h=height,$fn=90); translate([0,0,2]) cylinder(d=holesize, h=height,$fn=90);
} }
if(sink == 4 && reverse == 1) { if(sink == 4 && reverse == 1) {
translate([0,0,-height-2-adjust]) cylinder(d=holesize, h=height,$fn=90); translate([0,0,-height-2-adj]) cylinder(d=holesize, h=height,$fn=90);
} }
if(insert_e > 0 && reverse == 0) { if(insert_e > 0 && reverse == 0) {
translate([0,0,height-i_depth]) cylinder(d=i_dia, h=i_depth+adjust,$fn=90); translate([0,0,height-i_depth]) cylinder(d=i_dia, h=i_depth+adj,$fn=90);
} }
if(insert_e > 0 && reverse == 1) { if(insert_e > 0 && reverse == 1) {
translate([0,0,-height-adjust]) cylinder(d=i_dia, h=i_depth+adjust,$fn=90); translate([0,0,-height-adj]) cylinder(d=i_dia, h=i_depth+adj,$fn=90);
} }
} }
} }

View File

@@ -40,7 +40,7 @@
module vent(width, length, height, gap, rows, columns, orientation) { module vent(width, length, height, gap, rows, columns, orientation) {
fillet = width/2; fillet = width/2;
adjust = .01; adj = .01;
$fn=90; $fn=90;
// vertical orientation // vertical orientation

View File

@@ -385,7 +385,7 @@ module case_bottom(case_design) {
pcbhole_size = sbc_data[s[0]][i+9][0]; pcbhole_size = sbc_data[s[0]][i+9][0];
pcbhole_pos = sbc_data[s[0]][i+10][4]; pcbhole_pos = sbc_data[s[0]][i+10][4];
if(class == "pcbhole" && (pcbhole_pos == "left_rear" || pcbhole_pos == "left_front" || if(class == "pcbhole" && id == pcb_id && (pcbhole_pos == "left_rear" || pcbhole_pos == "left_front" ||
pcbhole_pos == "right_rear" || pcbhole_pos == "right_front")) { pcbhole_pos == "right_rear" || pcbhole_pos == "right_front")) {
if (pcbhole_pos == "left_rear") { if (pcbhole_pos == "left_rear") {
normal_standoff = [bottom_standoff[0], normal_standoff = [bottom_standoff[0],
@@ -482,7 +482,7 @@ module case_bottom(case_design) {
pcbhole_pos = sbc_data[s[0]][i+10][4]; pcbhole_pos = sbc_data[s[0]][i+10][4];
ex_stand = 0; ex_stand = 0;
if (class == "pcbhole" && (pcbhole_pos == "left_rear" || pcbhole_pos == "left_front" || if (class == "pcbhole" && id == pcb_id && (pcbhole_pos == "left_rear" || pcbhole_pos == "left_front" ||
pcbhole_pos == "right_rear" || pcbhole_pos == "right_front")) { pcbhole_pos == "right_rear" || pcbhole_pos == "right_front")) {
ex_stand = pcbhole_pos == "left_rear" ? bottom_rear_left : ex_stand = pcbhole_pos == "left_rear" ? bottom_rear_left :
pcbhole_pos == "left_front" ? bottom_front_left : pcbhole_pos == "left_front" ? bottom_front_left :
@@ -647,6 +647,22 @@ module case_bottom(case_design) {
else { else {
translate([pcb_loc_x ,pcb_loc_y,bottom_height-pcb_z+pcb_loc_z-adj]) sbc(sbc_model, cooling, fan_size, gpio_opening, uart_opening, true); translate([pcb_loc_x ,pcb_loc_y,bottom_height-pcb_z+pcb_loc_z-adj]) sbc(sbc_model, cooling, fan_size, gpio_opening, uart_opening, true);
} }
// indents
if(indents == 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];
loc_x = sbc_data[s[0]][i+4]+pcb_loc_x;
loc_y = sbc_data[s[0]][i+5]+pcb_loc_y;
loc_z = sbc_data[s[0]][i+6]+pcb_loc_z;
side = sbc_data[s[0]][i+7];
rotation = sbc_data[s[0]][i+8];
indent(loc_x, loc_y, bottom_height+pcb_loc_z-adj, rotation[2], side, class, type, wallthick, gap, floorthick, pcb_z);
}
}
// clean fillets // clean fillets
if(case_design == "shell") { if(case_design == "shell") {
translate([(width/2)-wallthick-gap,(depth/2)-wallthick-gap,bottom_height/2]) translate([(width/2)-wallthick-gap,(depth/2)-wallthick-gap,bottom_height/2])

View File

@@ -317,6 +317,22 @@ module case_side(case_design, case_style, side) {
else { else {
translate([pcb_loc_x ,pcb_loc_y,bottom_height-pcb_z+pcb_loc_z-adj]) sbc(sbc_model, cooling, fan_size, gpio_opening, uart_opening, true); translate([pcb_loc_x ,pcb_loc_y,bottom_height-pcb_z+pcb_loc_z-adj]) sbc(sbc_model, cooling, fan_size, gpio_opening, uart_opening, true);
} }
// indents
if(indents == 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];
loc_x = sbc_data[s[0]][i+4]+pcb_loc_x;
loc_y = sbc_data[s[0]][i+5]+pcb_loc_y;
loc_z = sbc_data[s[0]][i+6]+pcb_loc_z;
side = sbc_data[s[0]][i+7];
rotation = sbc_data[s[0]][i+8];
indent(loc_x, loc_y, bottom_height+pcb_loc_z-adj, rotation[2], side, class, type, wallthick, gap, floorthick, pcb_z);
}
}
} }
if(accessory_name != "none") { if(accessory_name != "none") {
for (i=[1:15:len(accessory_data[a[0]])-1]) { for (i=[1:15:len(accessory_data[a[0]])-1]) {

View File

@@ -423,7 +423,7 @@ module case_top(case_design) {
pcbhole_pos = sbc_data[s[0]][i+10][4]; pcbhole_pos = sbc_data[s[0]][i+10][4];
ex_stand = 0; ex_stand = 0;
if (class == "pcbhole" && (pcbhole_pos == "left_rear" || pcbhole_pos == "left_front" || if (class == "pcbhole" && id == pcb_id && (pcbhole_pos == "left_rear" || pcbhole_pos == "left_front" ||
pcbhole_pos == "right_rear" || pcbhole_pos == "right_front")) { pcbhole_pos == "right_rear" || pcbhole_pos == "right_front")) {
ex_stand = pcbhole_pos == "left_rear" ? top_rear_left : ex_stand = pcbhole_pos == "left_rear" ? top_rear_left :
pcbhole_pos == "left_front" ? top_front_left : pcbhole_pos == "left_front" ? top_front_left :
@@ -549,6 +549,22 @@ module case_top(case_design) {
else { else {
translate([pcb_loc_x ,pcb_loc_y,bottom_height-pcb_z+pcb_loc_z-adj]) sbc(sbc_model, cooling, fan_size, gpio_opening, uart_opening, true); translate([pcb_loc_x ,pcb_loc_y,bottom_height-pcb_z+pcb_loc_z-adj]) sbc(sbc_model, cooling, fan_size, gpio_opening, uart_opening, true);
} }
// indents
if(indents == 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];
loc_x = sbc_data[s[0]][i+4]+pcb_loc_x;
loc_y = sbc_data[s[0]][i+5]+pcb_loc_y;
loc_z = sbc_data[s[0]][i+6]+pcb_loc_z;
side = sbc_data[s[0]][i+7];
rotation = sbc_data[s[0]][i+8];
indent(loc_x, loc_y, bottom_height+pcb_loc_z-adj, rotation[2], side, class, type, wallthick, gap, floorthick, pcb_z);
}
}
// clean fillets // clean fillets
if(case_design == "shell") { if(case_design == "shell") {
translate(([(width/2)-wallthick-gap,(depth/2)-wallthick-gap, translate(([(width/2)-wallthick-gap,(depth/2)-wallthick-gap,

View File

@@ -20,23 +20,11 @@
DESCRIPTION: creates case IO indents DESCRIPTION: creates case IO indents
TODO: none TODO: none
USAGE: indent(type, loc_x, loc_y, loc_z, face, rotation, size_x, size_y, size_z, data_1, data_2, data_3, data_4) USAGE: indent(loc_x, loc_y, loc_z, rotation, side, class, type, wallthick, gap, floorthick, pcb_z)
type =
loc_x =
loc_y =
loc_z =
face =
rotation =
size[0] = size_x
size[1] = size_y
size[2] = size_z
data[0] =
data[1] =
data[2] =
*/ */
module indent(loc_x,loc_y,loc_z,rotation,side,class,type,wallthick,gap,floorthick,pcb_z) { module indent(loc_x, loc_y, loc_z, rotation, side, class, type, wallthick, gap, floorthick, pcb_z) {
adj = .01; adj = .01;
$fn=90; $fn=90;