standoff variable seperation for gui, initial work for top and bottom standoffs

This commit is contained in:
Edward Kisiel
2024-02-10 17:57:57 -05:00
parent 6262684252
commit a288a924d5
6 changed files with 107 additions and 85 deletions

View File

@@ -21,24 +21,19 @@
USAGE: standoff(stand_off) USAGE: standoff(stand_off)
stand_off[radius, stand_off[radius, height, supportsize, supportheight, sink, style, reverse, insert_e, i_dia, i_depth])
height, radius = pillar radius
holesize, height = total height
supportsize, holesize = hole diameter
supportheight, supportsize = support size for sink
sink, supportheight = height of support
0 = none sink = none, countersunk, recessed, nut holder, blind
1 = countersink style = hex, round style of pillar
2 = recessed hole reverse = true or false
3 = nut holder insert_e = true or false
4 = blind hole i_dia = insert diameter
style, i_depth = insert hole depth
0 = hex shape
1 = cylinder
reverse,
insert_e,
i_dia,
i_depth]
*/ */
module standoff(stand_off){ module standoff(stand_off){
@@ -59,19 +54,19 @@ module standoff(stand_off){
difference (){ difference (){
union () { union () {
if(style == 0 && reverse == 0) { if(style != "none" && reverse == false) {
rotate([0,0,30]) cylinder(d=radius*2/sqrt(3),h=height,$fn=6); rotate([0,0,30]) cylinder(d=radius*2/sqrt(3),h=height,$fn=6);
} }
if(style == 0 && reverse == 1) { if(style != "none" && reverse == true) {
translate([0,0,-height]) rotate([0,0,30]) cylinder(d=radius*2/sqrt(3),h=height,$fn=6); translate([0,0,-height]) rotate([0,0,30]) cylinder(d=radius*2/sqrt(3),h=height,$fn=6);
} }
if(style == 1 && reverse == 0) { if(style == "countersunk" && reverse == false) {
cylinder(d=radius,h=height,$fn=90); cylinder(d=radius,h=height,$fn=90);
} }
if(style == 1 && reverse == 1) { if(style == "countersunk" && reverse == true) {
translate([0,0,-height]) cylinder(d=radius,h=height,$fn=90); translate([0,0,-height]) cylinder(d=radius,h=height,$fn=90);
} }
if(reverse == 1) { if(reverse == true) {
translate([0,0,-supportheight]) cylinder(d=(supportsize),h=supportheight,$fn=60); translate([0,0,-supportheight]) cylinder(d=(supportsize),h=supportheight,$fn=60);
} }
else { else {
@@ -79,44 +74,44 @@ module standoff(stand_off){
} }
} }
// hole // hole
if(sink <= 3 && reverse == 0) { if(sink != "blind" && reverse == false) {
translate([0,0,-adj]) cylinder(d=holesize, h=height+(adj*2),$fn=90); translate([0,0,-adj]) cylinder(d=holesize, h=height+(adj*2),$fn=90);
} }
if(sink <= 3 && reverse == 1) { if(sink != "blind" && reverse == true) {
translate([0,0,-adj-height]) cylinder(d=holesize, h=height+(adj*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 == "countersunk" && reverse == false) {
translate([0,0,-adj]) 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 == "countersunk" && reverse == true) {
translate([0,0,+adj-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 == "recessed" && reverse == false) {
translate([0,0,-adj]) cylinder(d=6.5, h=3); translate([0,0,-adj]) cylinder(d=6.5, h=3);
} }
if(sink == 2 && reverse == 1) { if(sink == "recessed" && reverse == true) {
translate([0,0,+adj-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 == "nut holder" && reverse == false) {
translate([0,0,-adj]) 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 == "nut holder" && reverse == true) {
translate([0,0,+adj-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 == "blind" && reverse == false) {
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 == "blind" && reverse == true) {
translate([0,0,-height-2-adj]) 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 == true && reverse == false) {
translate([0,0,height-i_depth]) cylinder(d=i_dia, h=i_depth+adj,$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 == true && reverse == true) {
translate([0,0,-height-adj]) cylinder(d=i_dia, h=i_depth+adj,$fn=90); translate([0,0,-height-adj]) cylinder(d=i_dia, h=i_depth+adj,$fn=90);
} }
} }

View File

@@ -469,7 +469,7 @@ module case_bottom(case_design) {
} }
} }
// standoff sidewall support // standoff sidewall support
if(sidewall_support == true && sbc_top_standoffs == true) { if(bottom_sidewall_support == true && sbc_top_standoffs == true) {
for (i=[1:11:len(sbc_data[s[0]])-2]) { for (i=[1:11:len(sbc_data[s[0]])-2]) {
class = sbc_data[s[0]][i+1]; class = sbc_data[s[0]][i+1];
type = sbc_data[s[0]][i+2]; type = sbc_data[s[0]][i+2];
@@ -509,7 +509,7 @@ module case_bottom(case_design) {
} }
} }
// extended standoff sidewall support // extended standoff sidewall support
if(case_ext_standoffs == true && sidewall_support == true) { if(case_ext_standoffs == true && bottom_sidewall_support == true) {
// right-rear standoff // right-rear standoff
if(width-pcb_loc_x-pcb_width >= 10 || pcb_loc_y >= 10) { 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, translate([width-(2*(wallthick+gap))-(c_fillet/2)+(bottom_ext_standoff[0]/2)-.5,

View File

@@ -410,7 +410,7 @@ module case_top(case_design) {
} }
} }
// standoff sidewall support // standoff sidewall support
if(sidewall_support == true && sbc_top_standoffs == true) { if(top_sidewall_support == true && sbc_top_standoffs == true) {
for (i=[1:11:len(sbc_data[s[0]])-2]) { for (i=[1:11:len(sbc_data[s[0]])-2]) {
class = sbc_data[s[0]][i+1]; class = sbc_data[s[0]][i+1];
type = sbc_data[s[0]][i+2]; type = sbc_data[s[0]][i+2];
@@ -449,7 +449,7 @@ module case_top(case_design) {
} }
} }
// extended standoff sidewall support // extended standoff sidewall support
if(case_ext_standoffs == true && sidewall_support == true) { if(case_ext_standoffs == true && top_sidewall_support == true) {
// right-rear standoff // right-rear standoff
if(width-pcb_loc_x-pcb_width >= 10 || pcb_loc_y >= 10) { 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, translate([width-(2*(wallthick+gap))-(c_fillet/2)+(top_ext_standoff[0]/2)-.6,

View File

@@ -5,12 +5,12 @@
"accessory_highlight": "false", "accessory_highlight": "false",
"accessory_name": "none", "accessory_name": "none",
"adjust": "0.01", "adjust": "0.01",
"bottom_ext_standoff": "[6.25, 5, 3.6, 10, 4, 1, 0, 0, 0, 4.5, 5.1]", "bottom_ext_standoff": "[6.25, 5, 3.6, 10, 4, countersunk, hex, false, false, 4.5, 5.1]",
"bottom_front_left": "0", "bottom_front_left": "0",
"bottom_front_right": "0", "bottom_front_right": "0",
"bottom_rear_left": "0", "bottom_rear_left": "0",
"bottom_rear_right": "0", "bottom_rear_right": "0",
"bottom_standoff": "[6.25, 8, 3.6, 10, 4, 1, 0, 0, 0, 4.5, 5.1]", "bottom_standoff": "[6.25, 8, 3.6, 10, 4, countersunk, hex, false, false, 4.5, 5.1]",
"c_fillet": "3", "c_fillet": "3",
"case_design": "shell", "case_design": "shell",
"case_ext_standoffs": "false", "case_ext_standoffs": "false",
@@ -47,12 +47,12 @@
"sidethick": "2", "sidethick": "2",
"sidewall_support": "true", "sidewall_support": "true",
"tol": "0.25", "tol": "0.25",
"top_ext_standoff": "[6.25, 18, 2.5, 10, 4, 4, 0, 1, 0, 4.5, 5.1]", "top_ext_standoff": "[6.25, 18, 2.5, 10, 4, blind, hex, true, false, 4.5, 5.1]",
"top_front_left": "0", "top_front_left": "0",
"top_front_right": "0", "top_front_right": "0",
"top_rear_left": "0", "top_rear_left": "0",
"top_rear_right": "0", "top_rear_right": "0",
"top_standoff": "[6.25, 18, 2.5, 10, 4, 4, 0, 1, 0, 4.5, 5.1]", "top_standoff": "[6.25, 18, 2.5, 10, 4, blind, hex, true, false, 4.5, 5.1]",
"view": "model", "view": "model",
"vu_rotation": "[15, 0, 0]", "vu_rotation": "[15, 0, 0]",
"wallthick": "2" "wallthick": "2"

View File

@@ -57,27 +57,27 @@ move_rear = 0; // [-1:100]
/* [3D Case Adjustments] */ /* [3D Case Adjustments] */
// sbc location x axis // sbc location x axis
pcb_loc_x = 0; //[0:.5:300] pcb_loc_x = 0; //[0:.01:300]
// sbc location y axis // sbc location y axis
pcb_loc_y = 0; //[0:.5:300] pcb_loc_y = 0; //[0:.01:300]
// sbc location z axis // sbc location z axis
pcb_loc_z = 0; //[0:.25:100] pcb_loc_z = 0; //[0:.01:100]
// additional x axis case size // additional x axis case size
case_offset_x = 0; //[0:.5:300] case_offset_x = 0; //[0:.01:300]
// additional y axis case size // additional y axis case size
case_offset_y = 0; //[0:.5:300] case_offset_y = 0; //[0:.01:300]
// additional z axis case top size // additional z axis case top size
case_offset_tz = 0; //[0:.5:100] case_offset_tz = 0; //[0:.01:100]
// additional z axis case bottom size // additional z axis case bottom size
case_offset_bz = 0; //[0:.5:100] case_offset_bz = 0; //[0:.01:100]
// case wall thickness // case wall thickness
wallthick = 2; //[1:.5:5] wallthick = 2; //[1:.01:5]
// case floor thickness // case floor thickness
floorthick = 2; //[1:.25:5] floorthick = 2; //[1:.01:5]
// case side thickness // side wall thickness for tray_side cases only
sidethick = 2; //[1:.5:5] sidethick = 2; //[1:.01:5]
// distance between pcb and case // distance between pcb and case
gap = 1; //[.5:.25:5] gap = 1; //[.5:.01:5]
// corner fillets // corner fillets
c_fillet = 3; //[0:.5:9] c_fillet = 3; //[0:.5:9]
// edge fillets // edge fillets
@@ -85,38 +85,59 @@ fillet = 0; //[0:.5:6]
// tolerance for fitted surfaces // tolerance for fitted surfaces
tol = .25; //[-.5:.0625:.5] tol = .25; //[-.5:.0625:.5]
/* [Standoffs] */ /* [Top Standoffs] */
// enable case top standoffs // enable case top standoffs
sbc_top_standoffs = true; sbc_top_standoffs = true;
top_standoff_diameter = 5.75; //[0:.01:10]
top_standoff_hole_size = 2.5; //[0:.01:5]
top_standoff_support_size = 10; //[0:.01:15]
top_standoff_support_height = 4; //[0:.01:50]
top_standoff_type = "blind"; //[none, countersunk, recessed, nut holder, blind]
top_standoff_pillar = "hex"; //[hex, round]
top_standoff_insert = false;
top_standoff_insert_dia = 4.5; //[0:.01:6]
top_standoff_insert_height = 5; //[0:.01:10]
top_standoff_reverse = true;
// enable wall support for standoffs
top_sidewall_support = true;
// case top - lower left standoff
top_rear_left = 0; //[-20:.01:20]
// case top - upper left standoff
top_front_left = 0; //[-20:.01:20]
// case top - lower right standoff
top_rear_right = 0; //[-20:.01:20]
// case top - upper right standoff
top_front_right = 0; //[-20:.01:20]
/* [Bottom Standoffs] */
// enable case bottom standoffs // enable case bottom standoffs
sbc_bottom_standoffs = true; sbc_bottom_standoffs = true;
bottom_standoff_diameter = 5.75; //[2:.01:10]
bottom_standoff_hole_size = 2.5; //[0:.01:5]
bottom_standoff_support_size = 10; //[1:.01:15]
bottom_standoff_support_height = 4; //[0:.01:50]
bottom_standoff_type = "countersunk"; //[none, countersunk, recessed, nut holder, blind]
bottom_standoff_pillar = "hex"; //[hex, round]
bottom_standoff_insert = false;
bottom_standoff_insert_dia = 4.5; //[0:.01:6]
bottom_standoff_insert_height = 5; //[0:.01:10]
bottom_standoff_reverse = false;
// enable wall support for standoffs
bottom_sidewall_support = true;
// case bottom - rear left standoff
bottom_rear_left = 0; //[-20:.01:20]
// case bottom - upper left standoff
bottom_front_left = 0; //[-20:.01:20]
// case bottom - lower right standoff
bottom_rear_right = 0; //[-20:.01:20]
// case bottom - upper right standoff
bottom_front_right = 0; //[-20:.01:20]
/* [Extended Standoffs] */
// enable case extended standoffs // enable case extended standoffs
case_ext_standoffs = false; case_ext_standoffs = false;
// enable wall support for standoffs
sidewall_support = true;
// top case standoff - [diameter,height(not used),holesize,supportsize,supportheight,type(0=none, 1=countersink, 2=recessed, 3=nut holder, 4=blind),style(0=hex, 1=cylinder),reverse,insert,insert hole dia.,insert depth]
top_standoff = [5.75,18,2.5,10,4,4,0,1,0,4.5,5.1];
// case top - lower left standoff
top_rear_left = 0; //[-20:.25:20]
// case top - upper left standoff
top_front_left = 0; //[-20:.25:20]
// case top - lower right standoff
top_rear_right = 0; //[-20:.25:20]
// case top - upper right standoff
top_front_right = 0; //[-20:.25:20]
// bottom case standoff - [diameter,height(not used),holesize,supportsize,supportheight,type(0=none, 1=countersink, 2=recessed, 3=nut holder, 4=blind),style(0=hex, 1=cylinder),reverse,insert,insert hole dia.,insert depth]
bottom_standoff = [5.75,7,3.6,10,4,1,0,0,0,4.5,5.1];
// case bottom - rear left standoff
bottom_rear_left = 0; //[-20:.25:20]
// case bottom - upper left standoff
bottom_front_left = 0; //[-20:.25:20]
// case bottom - lower right standoff
bottom_rear_right = 0; //[-20:.25:20]
// case bottom - upper right standoff
bottom_front_right = 0; //[-20:.25:20]
// top case extened standoff - [diameter,height(not used),holesize,supportsize,supportheight,type(0=none, 1=countersink, 2=recessed, 3=nut holder, 4=blind),style(0=hex, 1=cylinder),reverse,insert,insert hole dia.,insert depth] // top case extened standoff - [diameter,height(not used),holesize,supportsize,supportheight,type(0=none, 1=countersink, 2=recessed, 3=nut holder, 4=blind),style(0=hex, 1=cylinder),reverse,insert,insert hole dia.,insert depth]
top_ext_standoff = [5.75,18,2.5,10,4,4,0,1,0,4.5,5.1]; top_ext_standoff = [5.75,18,2.5,10,4,4,0,1,0,4.5,5.1];
@@ -178,6 +199,12 @@ case_fn = 360; // circle segments for round cas
case_ffn = 90; // circle segments for fillet of round cases case_ffn = 90; // circle segments for fillet of round cases
lip = 5; lip = 5;
vu_rotation = [15,0,0]; vu_rotation = [15,0,0];
// top case standoff - [diameter,height(not used),holesize,supportsize,supportheight,type(0=none, 1=countersink, 2=recessed, 3=nut holder, 4=blind),style(0=hex, 1=cylinder),reverse,insert,insert hole dia.,insert depth]
top_standoff = [top_standoff_diameter,18, top_standoff_hole_size, top_standoff_support_size, top_standoff_support_height, top_standoff_type,
top_standoff_pillar, top_standoff_reverse, top_standoff_insert, top_standoff_insert_dia, top_standoff_insert_height];
bottom_standoff = [bottom_standoff_diameter, 6, bottom_standoff_hole_size, bottom_standoff_support_size, bottom_standoff_support_height,
bottom_standoff_type, bottom_standoff_pillar, bottom_standoff_reverse, bottom_standoff_insert, bottom_standoff_insert_dia,
bottom_standoff_insert_height];
// platter view // platter view
if (view == "platter") { if (view == "platter") {

View File

@@ -524,10 +524,10 @@ accessory_data = [
"sub","vent_hex",0,5,17,"top",[0,0,0],["case",false,false,true],9,21,8,5,1.5,"horizontal",1, // vent opening "sub","vent_hex",0,5,17,"top",[0,0,0],["case",false,false,true],9,21,8,5,1.5,"horizontal",1, // vent opening
"model","hk_m1s_ups",-1,122.5,5,"bottom",[0,0,270],["sbc",false,false,false],0,0,0,0,0,"",0, // hk m1s ups "model","hk_m1s_ups",-1,122.5,5,"bottom",[0,0,270],["sbc",false,false,false],0,0,0,0,0,"",0, // hk m1s ups
"sub","slot",-45,17.5,8.5,"bottom",[90,0,90],["sbc",true,true,true],4.25,6.125,12,0,0,"",[.25,.25,.25,.25], // usb-c opening "sub","slot",-45,17.5,8.5,"bottom",[90,0,90],["sbc",true,true,true],4.25,6.125,12,0,0,"",[.25,.25,.25,.25], // usb-c opening
"add2","standoff",2.5,11,0,"bottom",[0,0,0],["sbc",false,false,false],0,0,0,0,0,0,[5.75,5,3.6,10,4,1,0,0,0,4.5,5.1], // standoff "add2","standoff",2.5,11,0,"bottom",[0,0,0],["sbc",false,false,false],0,0,0,0,0,0,[5.75,5,3.6,10,4,"countersunk","hex",false,false,4.5,5.1], // standoff
"add2","standoff",27.5,11,0,"bottom",[0,0,0],["sbc",false,false,false],0,0,0,0,0,0,[5.75,5,3.6,10,4,1,0,0,0,4.5,5.1], // standoff "add2","standoff",27.5,11,0,"bottom",[0,0,0],["sbc",false,false,false],0,0,0,0,0,0,[5.75,5,3.6,10,4,"countersunk","hex",false,false,4.5,5.1], // standoff
"add2","standoff",2.5,119,0,"bottom",[0,0,0],["sbc",false,false,false],0,0,0,0,0,0,[5.75,5,3.6,10,4,1,0,0,0,4.5,5.1], // standoff "add2","standoff",2.5,119,0,"bottom",[0,0,0],["sbc",false,false,false],0,0,0,0,0,0,[5.75,5,3.6,10,4,"countersunk","hex",false,false,4.5,5.1], // standoff
"add2","standoff",27.5,119,0,"bottom",[0,0,0],["sbc",false,false,false],0,0,0,0,0,0,[5.75,5,3.6,10,4,1,0,0,0,4.5,5.1], // standoff "add2","standoff",27.5,119,0,"bottom",[0,0,0],["sbc",false,false,false],0,0,0,0,0,0,[5.75,5,3.6,10,4,"countersunk","hex",false,false,4.5,5.1], // standoff
"add1","access_port",-5.5,28,-0.01,"bottom",[0,0,0],["sbc",true,true,false],105,30,2,0,0,"landscape",0, // access port "add1","access_port",-5.5,28,-0.01,"bottom",[0,0,0],["sbc",true,true,false],105,30,2,0,0,"landscape",0, // access port
"model","access_cover",-5.5,28,-0.01,"bottom",[0,0,0],["sbc",true,true,false],105,30,2,0,0,"landscape",0, // access port cover "model","access_cover",-5.5,28,-0.01,"bottom",[0,0,0],["sbc",true,true,false],105,30,2,0,0,"landscape",0, // access port cover
"platter","access_cover",-10,16.25,0,"bottom",[0,0,90],["case",false,false,false],105,30,2,0,0,"landscape",0, // access port cover "platter","access_cover",-10,16.25,0,"bottom",[0,0,90],["case",false,false,false],105,30,2,0,0,"landscape",0, // access port cover