diff --git a/lib/access_panel.scad b/lib/access_panel.scad new file mode 100644 index 0000000..57cd1f1 --- /dev/null +++ b/lib/access_panel.scad @@ -0,0 +1,104 @@ +/* + access_port(size[],orientation) + access_cover(size[],orientation) + +*/ + +/* access port and support */ +module access_port(size,orientation) { + + floorthick = size[2]; + adjust = .01; + $fn = 90; + if(orientation == "portrait") { + difference() { + union() { + translate([0,0,0]) cube([size[0],size[1],size[2]]); + // access panel support + translate([(size[0]/2)+.25,size[1]-6.5,0]) cylinder(d=9,h=floorthick+(adjust*2)+5); + translate([(size[0]/2)-10,size[1]-11,floorthick-adjust]) cube([20,9.5,floorthick]); + translate([1,0,floorthick-adjust]) cube([size[0]-2,5,4.5]); + } + // access opening + translate([.5,6,-adjust]) cube([size[0]-1.15,size[1]-17,floorthick+(adjust*2)]); + translate([(size[0]/2)-5,size[1]-12,-adjust]) slab([10.5,5.5,floorthick],5.5); + translate([(size[0]/2)+.25,size[1]-6.5,floorthick+2]) + cylinder(r=3.2,h=floorthick+(adjust*2)+5,$fn=6); + translate([(size[0]/2)+.25,size[1]-6.5,-adjust]) + cylinder(d=3.2,h=floorthick+(adjust*2)+5); + translate([4,2+adjust,floorthick]) cube([7.75,3,2.75]); + translate([size[0]-13,2+adjust,floorthick]) cube([7.75,3,2.75]); + if(size[0] > 100) { + translate([(size[0]/2),2+adjust,floorthick]) cube([7.75,3,2.75]); + } + } + } + if(orientation == "landscape") { + difference() { + union() { + translate([0,-1,0]) cube([size[0],size[1],size[2]]); + // access panel support + translate([size[0]-6.5,(size[1]/2)-.5,0]) cylinder(d=9,h=floorthick+(adjust*2)+5); + translate([size[0]-11,(size[1]/2)-10.5,floorthick-adjust]) cube([9.5,20,floorthick]); + translate([0,0,floorthick-adjust]) cube([5,size[1]-2,4.5]); + } + // access opening + translate([6,-.5,-adjust]) cube([size[0]-17,size[1]-1.15,floorthick+(adjust*3)]); + translate([size[0]-12,(size[1]/2)-6,-adjust]) slab([5.5,10.5,floorthick],5.5); + translate([size[0]-6.5,(size[1]/2)-.5,floorthick+2]) rotate([0,0,30]) + cylinder(r=3.2,h=floorthick+(adjust*2)+5,$fn=6); + translate([size[0]-6.5,(size[1]/2)-.5,-adjust]) + cylinder(d=3.2,h=floorthick+(adjust*2)+5); + translate([2+adjust,3,floorthick]) cube([3,8.25,2.75]); + translate([2+adjust,size[1]-13,floorthick]) cube([3,8.25,2.75]); + if(size[1] > 100) { + translate([2+adjust,(size[1]/2)-(7.75/2)-1.25,floorthick]) cube([3,7.75,2.5]); + } + } + } +} + + +/* access cover and support */ +module access_cover(size,orientation) { + + floorthick = size[2]; + adjust = .01; + $fn = 90; + if(orientation == "portrait") { + difference() { + union() { + translate([1,6.25,0]) cube([size[0]-2.15,size[1]-17.5,floorthick]); + translate([(size[0]/2)-4.75,size[1]-12.25,0]) slab([10,5,floorthick], 5); + translate([1,6.25,floorthick-adjust]) cube([size[0]-2.15,6,floorthick]); + translate([4.25,3,floorthick]) cube([7.25,4,2]); + translate([size[0]-12.75,3,floorthick]) cube([7.25,4,2]); + if(size[0] > 100) { + translate([(size[0]/2)+.25,3,floorthick]) cube([7.25,4,2]); + } + } + translate([(size[0]/2)+.25,size[1]-6.5,-floorthick-adjust]) + cylinder(d=3.2,h=(floorthick*2)+(adjust*2)); + translate([(size[0]/2)+.25,size[1]-6.5,-floorthick-adjust+floorthick]) + cylinder(d1=6, d2=3.2, h=floorthick); + } + } + if(orientation == "landscape") { + difference() { + union() { + translate([6.25,0,0]) cube([size[0]-17.75,size[1]-2,floorthick]); + translate([size[0]-12.25,(size[1]/2)-5.75,0]) slab([5,10,floorthick], 5); + translate([6.25,0,floorthick-adjust]) cube([6,size[1]-2.15,floorthick]); + translate([3.5+adjust,3.25,floorthick]) cube([4,7.25,2]); + translate([3.5+adjust,size[1]-12.75,floorthick]) cube([4,7.25,2]); + if(size[1] > 100) { + translate([3.5+adjust,(size[1]/2)-(7.75/2)-1,floorthick]) cube([4,7.25,2]); + } + } + translate([size[0]-6.5,(size[1]/2)-.75,-floorthick-adjust]) + cylinder(d=3.2,h=(floorthick*2)+(adjust*2)); + translate([size[0]-6.5,(size[1]/2)-.75,-floorthick-adjust+floorthick]) + cylinder(d1=6, d2=3.2, h=floorthick); + } + } +} diff --git a/lib/art.scad b/lib/art.scad new file mode 100644 index 0000000..0f5b37a --- /dev/null +++ b/lib/art.scad @@ -0,0 +1,12 @@ +/* + + art(scale_d1,type,size_z) + +*/ + +/* art work module */ +module art(scale_d1,size_z,type) { + + linear_extrude(height = size_z) import(file = type, scale=scale_d1); + +} diff --git a/lib/battery.scad b/lib/battery.scad new file mode 100644 index 0000000..3ed8555 --- /dev/null +++ b/lib/battery.scad @@ -0,0 +1,86 @@ +/* + + battery(type) + battery_clip(bat_dia = 18.4) + batt_holder(tolerance) + +*/ + +module battery(type) { + + adj = .01; + if(type == "18650") { + difference() { + cylinder(d=18.4, h=65); + translate([0,0,65-4]) difference() { + cylinder(d=18.5, h=2); + cylinder(d=17.5, h=3); + } + } + } + if(type == "18650_convex") { + difference() { + cylinder(d=18.4, h=68); + translate([0,0,65-4]) difference() { + cylinder(d=18.5, h=2); + cylinder(d=17.5, h=3); + } + translate([0,0,65-adj]) difference() { + cylinder(d=18.5, h=3+2*adj); + cylinder(d=14.4, h=3+2*adj); + } + } + } + if(type == "21700") { + difference() { + cylinder(d=21, h=70); + translate([0,0,70-4]) difference() { + cylinder(d=21.1, h=2); + cylinder(d=20.1, h=3); + } + } + } +} + +module battery_clip(bat_dia = 18.4) { + + mat = .38; + width = 9.5; + tab = 8.9; + bat_holder = bat_dia+2*mat; + adj = .1; + + translate([-5.5,0,10.5]) { + difference() { + translate([0,width,0]) rotate([90,0,0]) cylinder(d=bat_holder, h=9.5); + translate([0,width+adj,0]) rotate([90,0,0]) cylinder(d=bat_dia, h=10.5); + translate([mat/2-11.1/2,-adj,mat-1.3-bat_dia/2]) cube([11.1-mat,width+2*adj,3]); + translate([0,width+adj,0]) rotate([90,-45,0]) cube([bat_dia,bat_dia,bat_holder]); + } + difference() { + translate([-11.1/2,0,-1.3-bat_dia/2]) cube([11.1,width,3]); + translate([mat-11.1/2,-adj,mat/2-1.3-bat_dia/2]) cube([11.1-2*mat,width+2*adj,3]); + } + difference() { + translate([-(tab/2),-3.5,-1-bat_dia/2]) rotate([-5,0,0]) cube([tab,3.5,10]); + translate([-(tab/2)-adj,-3.5+mat,mat-1-bat_dia/2]) rotate([-5,0,0]) cube([tab+2*adj,3.5+mat,10]); + } + translate([0,-2.225,0]) rotate([85,0,0]) cylinder(d=tab, h=mat); + difference() { + translate([0,-2.75,0]) sphere(d=3); + translate([-5,-2.75,-5]) rotate([85,0,0]) cube([tab,10,10]); + } + } +} + +module batt_holder(tolerance) { + + $fn = 90; + difference () { + cylinder(d=25.5,h=6); + translate ([0,0,-1]) cylinder(d=20.4+tolerance,h=8); + cube([14,26,13], true); + } + cylinder(r=12.75, h=2); +} + diff --git a/lib/button.scad b/lib/button.scad new file mode 100644 index 0000000..bdfc4e3 --- /dev/null +++ b/lib/button.scad @@ -0,0 +1,112 @@ +/* + button(style, diameter, height) + button_assembly(style, diameter, height + button_plunger(style, diameter, height) + button_top(style, diameter, height) + button_clip(style) + +*/ + +/* buttons */ +module button(style, size, radius, pad) { + + diameter = size[0]; + height = size[2]; + gap = 1.5; + adjust = .01; + $fn = 90; + + if(style == "recess") { + difference() { + union() { + sphere(d=diameter); + translate([0,0,-height+3]) cylinder(d=6, h=height-6); + } + translate([-(diameter/2)-1,-(diameter/2)-1,0]) cube([diameter+2,diameter+2,(diameter/2)+2]); + difference() { + union() { + sphere(d=diameter-2); + } + } + translate([-1.75,-1.25,-height-1]) cube([3.5,2.5,height+2]); + translate([0,0,-(diameter/2)]) cylinder(d=5, h=2); + } + } + if(style == "cutout") { + 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]); + difference() { + translate([-size[0]+3,-size[1]/2,-adjust]) + 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], + [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([0,0,2]) sphere(d=3); + } + translate([0,0,-pad+adjust]) cylinder(d=3, h=pad); + } +} + + +/* button plunger,top,clip */ +module button_assembly(style, diameter, height) { + +adjust = .01; +$fn = 90; + + if(style == "recess") { + button_plunger(style, diameter, height); + button_top(style, diameter, height); + translate([0,0,-height]) button_clip(style); + } +} + + +/* button plunger */ +module button_plunger(style, diameter, height) { + +adjust = .01; +$fn = 90; + + if(style == "recess") { + difference() { + translate([-1.5,-1,-(height)-2]) cube([3,2,height+1]); + translate([-1.5-adjust,-1.5,-height]) cube([.5,3,1]); + translate([1+adjust,-1.5,-height]) cube([.5,3,1]); + translate([-1.5-adjust,-1.5,-4]) cube([.5,3,4]); + translate([1+adjust,-1.5,-4]) cube([.5,3,4]); + } + } +} + + +/* button top */ +module button_top(style, diameter, height) { + +adjust = .01; +$fn = 90; + + if(style == "recess") { + difference() { + translate([0,0,-3]) cylinder(d=5, h=2.75); + translate([-1.25,-1.25,-3-adjust]) cube([2.5,2.5,2]); + } + } +} + + +/* button c-clip */ +module button_clip(style) { + +adjust = .01; +$fn = 90; + + if(style == "recess") { + difference() { + cylinder(d=8.5, h=.8); + translate([-1.5,-1.75,-adjust]) cube([2.75,3.5,1]); + translate([-.75,-.75,-adjust]) cube([5,1.25,1.25]); + } + } +} diff --git a/lib/cable_holder.scad b/lib/cable_holder.scad new file mode 100644 index 0000000..ed1fbc5 --- /dev/null +++ b/lib/cable_holder.scad @@ -0,0 +1,19 @@ +/* + + cableholder_spacer() + +*/ + +module cableholder_spacer() { + + size = [9.4,16,6]; + $fn = 90; + translate([0,size[2]/2,-5]) rotate([90,0,0]) + difference() { + translate([size[0]/2,size[0]/2,0]) rotate([0,0,90]) slot(size[0],size[1],size[2]); + translate([-1,5,3]) rotate([0,90,0]) cylinder(d=3.2, h=12); + translate([-1,7.5,-1]) cube([2,20,9]); + translate([5,9.5,-1]) rotate([0,0,90]) slot(4.5,11,9); + translate([3,20,-1]) rotate([0,0,45]) cube([2,6,9]); + } +} diff --git a/lib/component.scad b/lib/component.scad new file mode 100644 index 0000000..6aa04ed --- /dev/null +++ b/lib/component.scad @@ -0,0 +1,313 @@ +/* + + dsub(dsubsize, mask = false) + hdmi_a() + header_f(pins, height) + usb_micro() + uart_micro() + rj45() + header(pins) + encl_header_12() + micro2pin() + audio_jack35() + capacitor(diameter, height) + ic(size) + led(ledcolor = "red") + usbc() + +*/ + +// hdmi a female +module hdmi_a() { + size_x = 14.5; + size_y = 11.5; + + translate([0,0,.75]) + union() { + difference() { + color("silver") translate([0,0,0]) cube([size_x, size_y, 5.5]); + color("dimgray") translate([.5,-.1,.5]) cube([13.5, 11, 4.5]); + color("silver") translate([0,-.1,0]) rotate ([-90,0,0]) + cylinder(d=4, h=13.5,$fn=30); + color("silver") translate([14.5,-.1,0]) rotate ([-90,0,0]) + cylinder(d=4, h=13.5,$fn=30); + } + difference() { + union() { + color("silver") translate([0,-.1,0]) rotate ([-90,0,0]) + cylinder(d=4, h=11.5,$fn=30); + color("silver") translate([14.5,-.1,0]) rotate ([-90,0,0]) + cylinder(d=4, h=11.5,$fn=30); + } + color("silver") translate([0,-.2,0]) rotate ([-90,0,0]) + cylinder(d=3, h=13.5,$fn=30); + color("silver") translate([14.5,-.2,0]) rotate ([-90,0,0]) + cylinder(d=3, h=13.5,$fn=30); + color("silver") translate([-3,-1,-3]) cube([3,13.5,7.5]); + color("silver") translate([14.5,-1,-3]) cube([3,13.5,7.5]); + color("silver") translate([-1,-1,-3]) cube([16.5,13.5,3]); + } + color("black") translate([2.5,.5,2.25]) cube([9.25,10.5,1.5]); + } +} + + +// single row female headers +module header_f(pins, height) { + + adjust = .01; + $fn = 90; + size_x = 2.5; + size_y = 2.5 * pins; + union() { + color("black") cube([size_x, size_y, height]); + for (i=[1:2.5:size_y]) { + color("dimgray") translate ([1,i,height-5+adjust]) cube([.64,.64,5]); + } + } +} + + +// uart micro connector type +module uart_micro() { + size_x = 12.5; + size_y = 5; + union() { + difference() { + union() { + + difference () { + color("white") translate([0,0,0]) cube([size_x,size_y,6]); + color("darkgray") translate([.5,.5,2]) cube([11.5,4,6]); + } + } + color("white") translate([12.5,0,-.5]) cube([2,6,7]); + color("white") translate([-1,0,-.5]) cube([1,6,7]); + color("white") translate([-1,5,-.5]) cube([14,2,7]); + color("darkgray") translate([-1,1.5,2]) cube([14,1,7]); + } + for (i=[2.5:2.5:10]) { + color("silver") translate ([i,3,.5]) cube([.6,.6,5]); + } + } +} + + +// usb2 micro otg +module usb_micro() { + size_x = 7; + size_y = 4.5; + union() { + difference () { + color("silver") translate([0,0,0]) cube([size_x, size_y, 3.5]); + color("dimgray") translate([.5,-.1,.5]) cube([6, 3.5, 2.5]); + color("silver") translate([0,-.1,0]) rotate ([-90,0,0]) + cylinder(d=2.5, h=6.5,$fn=30); + color("silver") translate([7,-.1,0]) rotate ([-90,0,0]) + cylinder(d=2.5, h=6.5,$fn=30); + + } + difference() { + union() { + color("silver") translate([0,-.1,0]) rotate ([-90,0,0]) + cylinder(d=2.5, h=4.5,$fn=30); + color("silver") translate([7,-.1,0]) rotate ([-90,0,0]) + cylinder(d=2.5, h=4.5,$fn=30); + } + color("silver") translate([0,-.2,0]) rotate ([-90,0,0]) + cylinder(d=1.25, h=6.5,$fn=30); + color("silver") translate([7,-.2,0]) rotate ([-90,0,0]) + cylinder(d=1.25, h=6.5,$fn=30); + + color("silver") translate([-3,-1,-3]) cube([3,6.5,7.5]); + color("silver") translate([7,-1,-3]) cube([3,6.5,7.5]); + color("silver") translate([0,-1,-3]) cube([9,6.5,3]); + color("silver") translate([-1,-1,-3]) cube([9,6.5,3]); + } + color("black") translate([1.5,.5,1.25]) cube([4,3.5,1]); + } + } + + +// rj45 single socket +module rj45(x,y,rotation,side,pcbsize_z) { + size_x = 15.9; + size_y = 21.3; + place(x,y,0,size_x,size_y,rotation,side) + union() { + difference () { + color("lightgray") translate([0,0,0]) cube([size_x, size_y, 13.5]); + color("darkgray") translate([1.5,-1,1.5]) cube([13, 19.5, 8]); + color("darkgray") translate([5.5,-2,7]) cube([5, 19.5, 5]); + } + color("green") translate([2,-.1,10]) cube([3, 2, 2]); + color("orange") translate([11,-.1,10]) cube([3, 2, 2]); + } +} + + +// momentary_4.5x4.5x1.5 button +module momentary45x15() { + + adjust = .01; + $fn = 90; + size_x = 4.5; + size_y = 4.5; + size_z = 3.1; + union() { + 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("black") translate([2.25,2.25,3.1-adjust]) cylinder(d=2.35,h=1.50); + color("black") translate([.75,.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,3.75,3]) sphere(d=.75); + } +} + + +// single row headers +module header(pins) { + + adjust = .01; + $fn = 90; + size_x = 2.54; + size_y = 2.54 * pins; + union() { + color("black") translate([0,0,0]) cube([size_x, size_y, 2.5]); + for (i=[1:2.54:size_y]) { + color("silver") translate ([1,i,2.5]) cube([.64,.64,5]); + } + } +} + + +// gpio 12 enclosed header +module encl_header_12() { + size_x = 19.5; + size_y = 5.5; + union() { + difference () { + color("black") translate([0,0,0]) cube([size_x,size_y,6.25]); + color ("dimgray") translate ([.5,.5,.6]) cube([18.5,4.5,5.75]); + } + for (i=[4.5:2:16]) { + color("silver") translate ([i,1.5,1]) cube([.5,.5,5]); + color("silver") translate ([i,3.5,1]) cube([.5,.5,5]); + } + } +} + + +// micro connector type +module micro2pin() { + size_x = 7.5; + size_y = 3.75; + union() { + difference () { + color("white") translate([0,0,0]) cube([size_x,size_y,4.75]); + color("darkgray") translate([1.5,.5,1]) cube([4.5,2.75,6]); + color("white") translate([-.5,.75,-.5]) cube([1,2.5,6]); + color("white") translate([7,.75,-.5]) cube([1,2.5,6]); + color("darkgray") translate([2.25,-.5,1]) cube([3,2,6]); + } + color("silver") translate ([2.75,2,.5]) cube([.6,.6,4]); + color("silver") translate ([4.5,2,.5]) cube([.6,.6,4]); + } +} + + +// 3.5mm audio plug +module audio_jack35() { + + adjust = .01; + $fn = 90; + size_x = 6.5; + size_y = 13.5; + difference () { + union() { + color("dimgray") cube([size_x,size_y,3]); + 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("gray") translate([size_x/2,0,2.25]) rotate([-90,0,0]) cylinder(d=3, h=size_y+adjust); + } +} + + +// can capacitor +module capacitor(diameter, height) { + adjust = .01; + $fn = 90; + 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,1]) cylinder(d=diameter, h=height-1); +} + + +// ic +module ic(size) { + color("dimgray") cube(size); +} + + +// d-sub connector +module dsub(dsubsize, mask = false) { + + adjust=.01; + $fn = 90; + + if(mask == true) { + union() { + translate([-1, 1, -.75]) rotate([90,0,0]) slab_r([19,10.5,10], [4,4,4,4]); + translate([-4, 1, 4.5]) rotate([90,0,0]) cylinder(h=10, d=3); + translate([21, 1, 4.5]) rotate([90,0,0]) cylinder(h=10, d=3); + } + } + else { + if(dsubsize[0] == 9 && dsubsize[1] == "female") { + translate([8.5,0.4,4.5]) rotate([90,0,0]) import("./stl/db9_f.stl"); + } + if(dsubsize[0] == 9 && dsubsize[1] == "male") { + translate([8.5,0.4,4.5]) rotate([90,0,0]) import("./stl/db9_m.stl"); + } + } +} + + +module led(ledcolor = "red") { + + color(ledcolor) cube([3,1.5,.4]); + color("silver") cube([.5,1.5,.5]); + color("silver") translate([2.5,0,0]) cube([.5,1.5,.5]); +} + + +module usbc() { + + $fn=90; + adj = .01; + + // usbc horizontal type + + size_x = 9; + size_y = 7; + dia = 3.5; + diam = 3.75; + + rotate([90, 0, 0]) translate([dia/2, dia/2, -size_y]) union() { + difference () { + color("silver") + hull() { + translate([0,0,0]) cylinder(d=dia,h=size_y); + translate([size_x-dia,0,0]) cylinder(d=dia,h=size_y); + } + color("silver") translate([0,0,1]) + hull() { + translate([0,0,0]) cylinder(d=3,h=size_y+.2); + translate([size_x-dia,0,0]) cylinder(d=3,h=size_y+.2); + } + } + color("black") translate([0,-1.2/2,.1]) cube([5.5,1.2,6]); + } + } diff --git a/lib/custom.scad b/lib/custom.scad new file mode 100644 index 0000000..d59c334 --- /dev/null +++ b/lib/custom.scad @@ -0,0 +1,80 @@ +/* + + h3_port_extender(style, mask = false) + h3_port_extender_holder(part,offset) + +*/ + +// @mctom's odroid-h3 gpio port extender +module h3_port_extender(style, mask = false) { + + adjust=.01; + $fn = 90; + + if(style == "header") { + if(mask == true) { + translate([-20, 6.25, 15]) cube([12, 7.5, 14.75]); + translate([-20, 15.875, 15]) cube([12, 7.5, 14.75]); + translate([-20, 25.375, 15]) cube([12, 7.5, 14.75]); + translate([-20, 17, 32.2]) rotate([0, 90, 0]) cylinder(d=3.5, h=12); + } + else { + // gpio 24 pin front position + color("silver") translate([1.6, 188.5, 84]) rotate([90, 0, 270]) import("stl/h3_port_extender.stl"); +// color("dimgrey") translate([-3, 15.75, 0.25]) rotate([90, 180, 180]) import("stl/header_f_2x12_90.stl"); + translate([0, 2, 8.25]) rotate([0, 180, 0]) header_f(12,8); + translate([-2.54, 2, 8.25]) rotate([0, 180, 0]) header_f(12,8); + color("dimgrey") translate([-2.5, 0, 29.5]) rotate([270, 0, 90]) import("stl/header_2x2_90.stl"); + } + } + if(style == "remote") { + if(mask == true) { + translate([-19, 6.25, 15]) cube([12,7.5,14.75]); + translate([-19, 15.875, 15]) cube([12,7.5,14.75]); + translate([-19, 25.375, 15]) cube([12,7.5,14.75]); + translate([-19, 17, 32.2]) rotate([0,90,0]) cylinder(d=2.5, h=12); + translate([-19, 17, 4.6]) rotate([0,90,0]) cylinder(d=2.5, h=12); + } + else { + // gpio 24 pin front position + color("silver") translate([1.6, 188.5, 84]) rotate([90, 0, 270]) import("stl/h3_port_extender.stl"); + color("dimgrey") translate([-2.5, 0, 29.5]) rotate([270, 0, 90]) import("stl/header_2x2_90.stl"); + color("dimgrey")translate([9,-.5,12.75]) rotate([0,270,90]) import("stl/header_encl_2x5_90.stl"); + translate([2, 2, 14.08]) rotate([0, 90, 0]) header(12); + translate([2, 2, 11.54]) rotate([0, 90, 0]) header(12); + } + } +} + + +/* +// h3_port_extender_holder(part, offset) +// part = "both","top","bottom" +// offset = projection from inside wall in mm +// holder for the @mctom's remote h3 port extender +*/ +module h3_port_extender_holder(part,offset=2) { + + adjust = .01; + size = [16-offset,40,5.5]; + if(part == "bottom" || part == "both") { + difference() { + translate([-10+offset,-3.5,2]) cube(size); + translate([-.25,-.25,-adjust]) cube([2.5, 33.25, 12]); + translate([2, 2, -adjust]) 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([-7,-1.,-adjust]) cylinder(d=4.25, h=20); + } + } + if(part == "top" || part == "both") { + difference() { + translate([-10+offset,-3.5,29.5]) cube(size); + translate([-.25,-.25,28]) cube([2.5, 33.25, 12]); + translate([1.5, 2, 27.5-adjust]) cube([10, 28.5, 12]); + translate([-12, -4, 28]) cube([20, 13, 10]); + 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); + } + } +} + diff --git a/lib/fan.scad b/lib/fan.scad new file mode 100644 index 0000000..9af1338 --- /dev/null +++ b/lib/fan.scad @@ -0,0 +1,208 @@ +/* + + fan_cover(size, thick) + fan_mask(size, thick, style) + +*/ + +/* fan cover */ +module fan_cover(size, thick) { + difference() { + color("grey",1) slab([size,size,thick],3); + color("grey",1) fan_mask(size, thick, 2); + } +} + +/* fan mask to create opening */ +module fan_mask(size, thick, style) { + + $fn=90; + + if(style == 1) { + translate ([size/2,size/2,-1]) cylinder(h=thick+2, d=size-2); + if(size == 40) { + // mount holes + translate ([size-4,size-4,-1]) cylinder(h=thick+2, d=3); + translate ([size-4,4,-1]) cylinder(h=thick+2, d=3); + translate ([4,size-4,-1]) cylinder(h=thick+2, d=3); + translate ([4,4,-1]) cylinder(h=thick+2, d=3); + } + if(size == 60) { + // mount holes + translate ([size-5,size-5,-1]) cylinder(h=thick+2, d=3); + translate ([size-5,5,-1]) cylinder(h=thick+2, d=3); + translate ([5,size-5,-1]) cylinder(h=thick+2, d=3); + translate ([5,5,-1]) cylinder(h=thick+2, d=3); + } + if(size >= 80) { + // mount holes + translate ([size-3.75,size-3.75,-1]) cylinder(h=thick+2, d=3); + translate ([size-3.75,3.75,-1]) cylinder(h=thick+2, d=3); + translate ([3.75,size-3.75,-1]) cylinder(h=thick+2, d=3); + translate ([3.75,3.75,-1]) cylinder(h=thick+2, d=3); + } + } + if(style == 2 && size == 40) { + difference() { + union () { + difference() { + translate ([size/2,size/2,-1]) cylinder(h=thick+2, d=size-2); + translate ([size/2,size/2,-2]) cylinder(h=thick+4, d=size-6); + } + difference() { + translate ([size/2,size/2,-1]) cylinder(h=thick+2, d=size-10); + translate ([size/2,size/2,-2]) cylinder(h=thick+4, d=size-14); + } + difference() { + translate ([size/2,size/2,-1]) cylinder(h=thick+2, d=size-18); + translate ([size/2,size/2,-2]) cylinder(h=thick+4, d=size-22); + } + difference() { + translate ([size/2,size/2,-1]) cylinder(h=thick+2, d=size-26); + translate ([size/2,size/2,-2]) cylinder(h=thick+4, d=size-30); + } + difference() { + translate ([size/2,size/2,-1]) cylinder(h=thick+2, d=size-34); + translate ([size/2,size/2,-2]) cylinder(h=thick+4, d=size-38); + } + // mount holes + translate ([size-4,size-4,-1]) cylinder(h=thick+2, d=3); + translate ([size-4,4,-1]) cylinder(h=thick+2, d=3); + translate ([4,size-4,-1]) cylinder(h=thick+2, d=3); + translate ([4,4,-1]) cylinder(h=thick+2, d=3); + } + translate([6.5,5,-2]) rotate([0,0,45]) cube([size,2,thick+4]); + translate([4.5,size-6,-2]) rotate([0,0,-45]) cube([size,2,thick+4]); + } + } + if(style == 2 && size == 60) { + difference() { + union () { + difference() { + translate ([size/2,size/2,-1]) cylinder(h=thick+2, d=size-2); + translate ([size/2,size/2,-2]) cylinder(h=thick+4, d=size-6); + } + difference() { + translate ([size/2,size/2,-1]) cylinder(h=thick+2, d=size-10); + translate ([size/2,size/2,-2]) cylinder(h=thick+4, d=size-14); + } + difference() { + translate ([size/2,size/2,-1]) cylinder(h=thick+2, d=size-18); + translate ([size/2,size/2,-2]) cylinder(h=thick+4, d=size-22); + } + difference() { + translate ([size/2,size/2,-1]) cylinder(h=thick+2, d=size-26); + translate ([size/2,size/2,-2]) cylinder(h=thick+4, d=size-30); + } + difference() { + translate ([size/2,size/2,-1]) cylinder(h=thick+2, d=size-34); + translate ([size/2,size/2,-2]) cylinder(h=thick+4, d=size-38); + } + difference() { + translate ([size/2,size/2,-1]) cylinder(h=thick+2, d=size-42); + translate ([size/2,size/2,-2]) cylinder(h=thick+4, d=size-46); + } + difference() { + translate ([size/2,size/2,-1]) cylinder(h=thick+2, d=size-50); + translate ([size/2,size/2,-2]) cylinder(h=thick+4, d=size-54); + } + // mount holes + translate ([size-5,size-5,-1]) cylinder(h=thick+2, d=3); + translate ([size-5,5,-1]) cylinder(h=thick+2, d=3); + translate ([5,size-5,-1]) cylinder(h=thick+2, d=3); + translate ([5,5,-1]) cylinder(h=thick+2, d=3); + } + translate([9.5,8,-2]) rotate([0,0,45]) cube([size,2,thick+4]); + translate([8.5,size-10,-2]) rotate([0,0,-45]) cube([size,2,thick+4]); + } + } + if(style == 2 && size >= 80) { + difference() { + union () { + difference() { + translate ([size/2,size/2,-1]) cylinder(h=thick+2, d=size-2); + translate ([size/2,size/2,-2]) cylinder(h=thick+4, d=size-8); + } + difference() { + translate ([size/2,size/2,-1]) cylinder(h=thick+2, d=size-14); + translate ([size/2,size/2,-2]) cylinder(h=thick+4, d=size-20); + } + difference() { + translate ([size/2,size/2,-1]) cylinder(h=thick+2, d=size-26); + translate ([size/2,size/2,-2]) cylinder(h=thick+4, d=size-32); + } + difference() { + translate ([size/2,size/2,-1]) cylinder(h=thick+2, d=size-38); + translate ([size/2,size/2,-2]) cylinder(h=thick+4, d=size-44); + } + difference() { + translate ([size/2,size/2,-1]) cylinder(h=thick+2, d=size-50); + translate ([size/2,size/2,-2]) cylinder(h=thick+4, d=size-56); + } + difference() { + translate ([size/2,size/2,-1]) cylinder(h=thick+2, d=size-62); + translate ([size/2,size/2,-2]) cylinder(h=thick+4, d=size-68); + } + difference() { + translate ([size/2,size/2,-1]) cylinder(h=thick+2, d=size-74); + translate ([size/2,size/2,-2]) cylinder(h=thick+4, d=size-79); + } + if(size == 92) { + difference() { + translate ([size/2,size/2,-1]) cylinder(h=thick+2, d=size-86); + translate ([size/2,size/2,-2]) cylinder(h=thick+4, d=size-92); + } + } + // mount holes + translate ([size-3.75,size-3.75,-1]) cylinder(h=thick+2, d=3); + translate ([size-3.75,3.75,-1]) cylinder(h=thick+2, d=3); + translate ([3.75,size-3.75,-1]) cylinder(h=thick+2, d=3); + translate ([3.75,3.75,-1]) cylinder(h=thick+2, d=3); + } + translate([6.5,4.25,-2]) rotate([0,0,45]) cube([size*1.2,3,thick+4]); + translate([4.25,size-6.5,-2]) rotate([0,0,-45]) cube([size*1.2,3,thick+4]); + } + } + if(style == 3) { + inner = size == 30 ? 24 : + size == 40 ? 32 : + size == 50 ? 40 : + size == 60 ? 50 : + size == 70 ? 61.9 : + size == 80 ? 71.5 : + size * 0.8; // Use 80% as default + + rings = size <= 40 ? 4 : 6; + bar_size = size <= 40 ? 2 : 3; + + screw_offset = inner / 2; + center_point = size * 0.5; + base_ring_size = size * 0.95; + rings_spacing = size / rings; + + translate([size/2, size/2, -1]) + union() { + translate([screw_offset, screw_offset, (thick+2)/2]) cylinder(d=3, h=thick+2, center=true); + translate([-screw_offset, screw_offset, (thick+2)/2]) cylinder(d=3, h=thick+2, center=true); + translate([screw_offset, -screw_offset, (thick+2)/2]) cylinder(d=3, h=thick+2, center=true); + translate([-screw_offset, -screw_offset, (thick+2)/2]) cylinder(d=3, h=thick+2, center=true); + + difference() { + union() { + for(i=[inner:-rings_spacing:0]) { + difference() { + cylinder(d=base_ring_size - i, h=thick+2); + translate([0, 0, -1]) cylinder(d=base_ring_size - i - (rings_spacing/2), h=thick+4); + } + } + } + + translate([0, 0, -1]) union() { + cylinder(d=bar_size*2+0.1, thick+6); // Add a circle to prevent any tiny holes around cross bar + rotate([0, 0, 45]) cube([size, bar_size, 12], center=true); + rotate([0, 0, 45]) cube([bar_size, size, 12], center=true); + } + } + } + } +} diff --git a/lib/fastener.scad b/lib/fastener.scad new file mode 100644 index 0000000..529e7eb --- /dev/null +++ b/lib/fastener.scad @@ -0,0 +1,48 @@ +/* + + m_insert(type="M3", icolor = "#ebdc8b") + +*/ + +module m_insert(type="M3", icolor = "#ebdc8b") { //#f4e6c3, #ebdc8b + + odiam = type == "M3" ? 4.2 : 3.5; + idiam = type == "M3" ? 3 : 2.5; + iheight = 4; + + difference() { + color(icolor,.6) cylinder(d=odiam, h=iheight); + color(icolor,.6) translate([0,0,-1]) cylinder(d=idiam, h=iheight+2); + } + for(bearing = [0:10:360]) { + color(icolor) translate([-.25+(odiam/2)*cos(bearing),-.25+(odiam/2)*sin(bearing),iheight-1.5]) + rotate([0,0,0]) cube([.5,.5,1.5]); + } +} + + +// General purpose screw +// screw(screw[d, l, style]) +// d - thread diameter +// l - thread length +// style - screw head style +// +// Styles: +// 0 - Mushroom head, 5mm diameter + +module screw(screw_type) { + d = screw_type[0]; + l = screw_type[1]; + style = screw_type[2]; + + // Head + if(style == 0) { + difference() { + translate([ 0, 0, -0.3]) sphere(2.7); + translate([-10,-10,-10]) cube([20,20,10]); + translate([-10,-10, 2]) cube([20,20,10]); + } + } + // Thread + rotate([180,0,0]) cylinder(d=d, h=l); +} diff --git a/lib/feet.scad b/lib/feet.scad new file mode 100644 index 0000000..e31b40f --- /dev/null +++ b/lib/feet.scad @@ -0,0 +1,15 @@ +/* + + feet (height) + +*/ + +/* case feet */ +module feet (diameter,height) { + + difference (){ + cylinder (d=diameter,h=height); + translate([0,0,-1]) cylinder (d=3, h=height+2,$fn=90); + translate ([0,0,-1]) cylinder(r=3.35,h=height-3,$fn=6); + } +} diff --git a/lib/hd.scad b/lib/hd.scad new file mode 100644 index 0000000..dc08cf3 --- /dev/null +++ b/lib/hd.scad @@ -0,0 +1,592 @@ +/* + + hd_mount(hd,orientation,position,side) + hd25_tab(side) + hd25_vtab(side) + hd35_tab(side) + hd35_vtab(side) + hd_bottom_holes(hd,orientation,position,side,thick) + hd25(height) + hd35() + hdd35_25holder(length) + +*/ + +module hd_mount(hd,orientation,position,side) { + + adjust = .01; + $fn = 90; + if(hd == 2.5) { + if(orientation == "portrait") { + if(position == "vertical") { + if(side == "left") { + translate([0,14,0]) rotate([0,0,0]) hd25_vtab("right"); + translate([0,90.6,0]) rotate([0,0,0]) hd25_vtab("right"); + } + else { // right + translate([0,14,0]) rotate([0,0,0]) hd25_vtab("left"); + translate([0,90.6,0]) rotate([0,0,0]) hd25_vtab("left"); + } + } + else { + translate([-.5,14,0]) hd25_tab("left"); + translate([-.5,90.6,0]) hd25_tab("left"); + translate([70.35,14,0]) hd25_tab("right"); + translate([70.35,90.6,0]) hd25_tab("right"); + } + } + if(orientation == "landscape") { + if(position == "vertical") { + if(side == "left") { + translate([9.4,0,0]) rotate([0,0,90]) hd25_vtab("right"); + translate([86,0,0]) rotate([0,0,90]) hd25_vtab("right"); + } + else { // right + translate([9.4,0,0]) rotate([0,0,90]) hd25_vtab("left"); + translate([86,0,0]) rotate([0,0,90]) hd25_vtab("left"); + } + } + else { + translate([9.4,4.07-4.5,0]) rotate([0,0,90]) hd25_tab("left"); + translate([86,4.07-4.5,0]) rotate([0,0,90]) hd25_tab("left"); + translate([86,65.79+4.5,0]) rotate([0,0,90]) hd25_tab("right"); + translate([9.4,65.79+4.5,0]) rotate([0,0,90]) hd25_tab("right"); + } + } + } + if(hd == 3.5) { + if(orientation == "portrait") { + if(position == "vertical") { + if(side == "left") { + translate([0,41.28,0]) rotate([0,0,0]) hd35_vtab("right"); + translate([0,41.28+44.45,0]) rotate([0,0,0]) hd35_vtab("right"); + translate([0,41.28+76.20,0]) rotate([0,0,0]) hd35_vtab("right"); + } + else { // right + translate([0,41.28,0]) rotate([0,0,0]) hd35_vtab("left"); + translate([0,41.28+44.45,0]) rotate([0,0,0]) hd35_vtab("left"); + translate([0,41.28+76.20,0]) rotate([0,0,0]) hd35_vtab("left"); + } + } + else { + translate([-.5,28.5,0]) hd35_tab("left"); + translate([-.5,69.75,0]) hd35_tab("left"); + translate([-.5,130.1,0]) hd35_tab("left"); + translate([101.6+.5,28.5,0]) hd35_tab("right"); + translate([101.6+.5,69.75,0]) hd35_tab("right"); + translate([101.6+.5,130.1,0]) hd35_tab("right"); + } + } + if(orientation == "landscape") { + if(position == "vertical") { + if(side == "left") { + translate([9.4,0,0]) rotate([0,0,90]) hd35_vtab("right"); + translate([86,0,0]) rotate([0,0,90]) hd35_vtab("right"); + } + else { // right + translate([9.4,0,0]) rotate([0,0,90]) hd35_vtab("left"); + translate([86,0,0]) rotate([0,0,90]) hd35_vtab("left"); + } + } + else { + translate([16.9,-.5,0]) rotate([0,0,90]) hd35_tab("left"); + translate([76.6,-.5,0]) rotate([0,0,90]) hd35_tab("left"); + translate([118.5,-.5,0]) rotate([0,0,90]) hd35_tab("left"); + translate([16.9,101.6-.5,0]) rotate([0,0,90]) hd35_tab("right"); + translate([76.6,101.6-.5,0]) rotate([0,0,90]) hd35_tab("right"); + translate([118.5,101.6-.5,0]) rotate([0,0,90]) hd35_tab("right"); + } + } + } +} + + +module hd25_tab(side) { + + width = 15; + l_width = 26; + depth = 15; + height = 4; + fillet = 2; + hole = 3.6; + length = 3; + + adjust = .01; + $fn = 90; + if(side == "left") { + difference() { + union() { + translate([0,-depth/2,0]) rotate([0,-90,0]) + slab_r([l_width,depth,height], [fillet,fillet,fillet,fillet]); + translate([-height,-depth/2,0]) cube([height,depth,height]); + translate([adjust,-5.5,depth]) + rotate([90,0,0]) + linear_extrude(height = 2) + polygon(points = [ [-height,height], + [-depth+4,-depth], + [-height,-depth]]); + translate([adjust,7.5,depth]) + rotate([90,0,0]) + linear_extrude(height = 2) + polygon(points = [ [-height,height], + [-depth+4,-depth], + [-height,-depth]]); + } + translate([4.07,0,-adjust]) rotate([0,0,0]) cylinder(d=hole, h=3); + translate([-height-adjust,(width/2)-(length/2)-depth/2,3]) rotate([90,0,90]) slot(hole,length,height+(2*adjust)); + translate([-height-adjust,(width/2)-(length/2)-depth/2,21]) rotate([90,0,90]) slot(hole,length,height+(2*adjust)); + } + } + if(side == "right") { + difference() { + union() { + translate([height,-depth/2,0]) rotate([0,-90,0]) + slab_r([l_width,depth,height], [fillet,fillet,fillet,fillet]); + translate([0,-depth/2,0]) cube([height,depth,height]); + translate([adjust,-7.5,depth]) + rotate([90,0,180]) + linear_extrude(height = 2) + polygon(points = [ [-height,height], + [-depth+4,-depth], + [-height,-depth]]); + translate([adjust,5.5,depth]) + rotate([90,0,180]) + linear_extrude(height = 2) + polygon(points = [ [-height,height], + [-depth+4,-depth], + [-height,-depth]]); + } + translate([-4.07,0,-adjust]) rotate([0,0,0]) cylinder(d=hole, h=3); + translate([-adjust,(width/2)-(length/2)-depth/2,3]) rotate([90,0,90]) slot(hole,length,height+(2*adjust)); + translate([-adjust,(width/2)-(length/2)-depth/2,21]) rotate([90,0,90]) slot(hole,length,height+(2*adjust)); + } + } +} + + +module hd25_vtab(side) { + + width = 15; + l_width = 16; + depth = 15; + height = 4; + fillet = 2; + hole = 3.6; + length = 3; + + adjust = .01; + $fn = 90; + if(side == "left") { + difference() { + union() { + translate([0,-depth/2,0]) rotate([0,-90,0]) + slab_r([l_width,depth,height], [fillet,fillet,fillet,fillet]); + translate([-height,-depth/2,0]) cube([height,depth,height]); + translate([adjust,-5.5,depth]) + rotate([90,0,0]) + linear_extrude(height = 2) + polygon(points = [ [-height,height-5], + [-depth+4,-depth], + [-height,-depth]]); + translate([adjust,7.5,depth]) + rotate([90,0,0]) + linear_extrude(height = 2) + polygon(points = [ [-height,height-5], + [-depth+4,-depth], + [-height,-depth]]); + } + translate([3,0,-adjust]) rotate([0,0,0]) cylinder(d=hole, h=3); + translate([-height-adjust,1.5+(width/2)-(length/2)-depth/2,5.57]) rotate([90,90,90]) slot(hole,length,height+(2*adjust)); + } + } + if(side == "right") { + difference() { + union() { + translate([height,-depth/2,0]) rotate([0,-90,0]) + slab_r([l_width,depth,height], [fillet,fillet,fillet,fillet]); + translate([0,-depth/2,0]) cube([height,depth,height]); + translate([adjust,-7.5,depth]) + rotate([90,0,180]) + linear_extrude(height = 2) + polygon(points = [ [-height,height-5], + [-depth+4,-depth], + [-height,-depth]]); + translate([adjust,5.5,depth]) + rotate([90,0,180]) + linear_extrude(height = 2) + polygon(points = [ [-height,height-5], + [-depth+4,-depth], + [-height,-depth]]); + } + translate([-3,0,-adjust]) rotate([0,0,0]) cylinder(d=hole, h=3); + translate([-adjust,1.5+(width/2)-(length/2)-depth/2,5.57]) rotate([90,90,90]) slot(hole,length,height+(2*adjust)); + } + } +} + + +module hd35_tab(side) { + + width = 15; + l_width = 46; + depth = 15; + height = 4; + fillet = 2; + hole = 3.6; + length = 3; + + adjust = .01; + $fn = 90; + if(side == "left") { + difference() { + union() { + translate([0,-depth/2,0]) rotate([0,-90,0]) + slab_r([l_width,depth,height], [fillet,fillet,fillet,fillet]); + translate([-height,-depth/2,0]) cube([height,depth,height]); + + translate([adjust,-5.5,depth]) + rotate([90,0,0]) + linear_extrude(height = 2) + polygon(points = [ [-height,height+20], + [-depth+4,-depth], + [-height,-depth]]); + translate([adjust,7.5,depth]) + rotate([90,0,0]) + linear_extrude(height = 2) + polygon(points = [ [-height,height+20], + [-depth+4,-depth], + [-height,-depth]]); + + } + translate([3.18,0,-adjust]) rotate([0,0,0]) cylinder(d=hole, h=3); + translate([-height-adjust,(width/2)-(length/2)-depth/2,6.35]) rotate([90,0,90]) slot(hole,length,height+(2*adjust)); + translate([-height-adjust,(width/2)-(length/2)-depth/2,38.35]) rotate([90,0,90]) slot(hole,length,height+(2*adjust)); + } + } + if(side == "right") { + difference() { + union() { + translate([height,-depth/2,0]) rotate([0,-90,0]) + slab_r([l_width,depth,height], [fillet,fillet,fillet,fillet]); + translate([0,-depth/2,0]) cube([height,depth,height]); + + translate([adjust,-7.5,depth]) + rotate([90,0,180]) + linear_extrude(height = 2) + polygon(points = [ [-height,height+20], + [-depth+4,-depth], + [-height,-depth]]); + translate([adjust,5.5,depth]) + rotate([90,0,180]) + linear_extrude(height = 2) + polygon(points = [ [-height,height+20], + [-depth+4,-depth], + [-height,-depth]]); + + } + translate([-3.18,0,-adjust]) rotate([0,0,0]) cylinder(d=hole, h=3); + translate([-adjust,(width/2)-(length/2)-depth/2,6.35]) rotate([90,0,90]) slot(hole,length,height+(2*adjust)); + translate([-adjust,(width/2)-(length/2)-depth/2,38.35]) rotate([90,0,90]) slot(hole,length,height+(2*adjust)); + } + } +} + +module hd35_vtab(side) { + + width = 15; + l_width = 16; + depth = 15; + height = 4; + fillet = 2; + hole = 3.6; + length = 3; + + adjust = .01; + $fn = 90; + if(side == "left") { + difference() { + union() { + translate([0,-depth/2,0]) rotate([0,-90,0]) + slab_r([l_width,depth,height], [fillet,fillet,fillet,fillet]); + translate([-height,-depth/2,0]) cube([height,depth,height]); + translate([adjust,-5.5,depth]) + rotate([90,0,0]) + linear_extrude(height = 2) + polygon(points = [ [-height,height-5], + [-depth+4,-depth], + [-height,-depth]]); + translate([adjust,7.5,depth]) + rotate([90,0,0]) + linear_extrude(height = 2) + polygon(points = [ [-height,height-5], + [-depth+4,-depth], + [-height,-depth]]); + } + translate([3,0,-adjust]) rotate([0,0,0]) cylinder(d=hole, h=3); + translate([-height-adjust,1.5+(width/2)-(length/2)-depth/2,5.57]) rotate([90,90,90]) slot(hole,length,height+(2*adjust)); + } + } + if(side == "right") { + difference() { + union() { + translate([height,-depth/2,0]) rotate([0,-90,0]) + slab_r([l_width,depth,height], [fillet,fillet,fillet,fillet]); + translate([0,-depth/2,0]) cube([height,depth,height]); + translate([adjust,-7.5,depth]) + rotate([90,0,180]) + linear_extrude(height = 2) + polygon(points = [ [-height,height-5], + [-depth+4,-depth], + [-height,-depth]]); + translate([adjust,5.5,depth]) + rotate([90,0,180]) + linear_extrude(height = 2) + polygon(points = [ [-height,height-5], + [-depth+4,-depth], + [-height,-depth]]); + } + translate([-3,0,-adjust]) rotate([0,0,0]) cylinder(d=hole, h=3); + translate([-adjust,1.5+(width/2)-(length/2)-depth/2,5.57]) rotate([90,90,90]) slot(hole,length,height+(2*adjust)); + } + } +} + + +module hd_bottom_holes(hd,orientation,position,side,thick) { + + adjust = .01; + $fn = 90; + if(hd == 2.5) { + if(orientation == "portrait") { + if(position == "vertical") { + if(side == "left") { + translate([-3,14,0]) cylinder(d=3.6,h=thick+(adjust*2)); + translate([-3,90.6,0]) cylinder(d=3.6,h=thick+(adjust*2)); + } + else { + // portrait 2.5" bottom screw holes + translate([3,14,0]) cylinder(d=3.6,h=thick+(adjust*2)); + translate([3,90.6,0]) cylinder(d=3.6,h=thick+(adjust*2)); + } + } + else { + // portrait 2.5" bottom screw holes + translate([4.07,14,0]) cylinder(d=3.6,h=thick+(adjust*2)); + translate([4.07,90.6,0]) cylinder(d=3.6,h=thick+(adjust*2)); + translate([65.79,90.6,0]) cylinder(d=3.6,h=thick+(adjust*2)); + translate([65.79,14,0]) cylinder(d=3.6,h=thick+(adjust*2)); + + } + } + if(orientation == "landscape") { + if(position == "vertical") { + if(side == "left") { + translate([9.4,-3,0]) cylinder(d=3.6,h=thick+5); + translate([86,-3,0]) cylinder(d=3.6,h=thick+5); + } + else { + echo(side); + translate([9.4,3,0]) cylinder(d=3.6,h=thick+5); + translate([86,3,0]) cylinder(d=3.6,h=thick+5); + } + } + else { + // landscape 2.5" bottom screw holes + translate([9.4,4.07,0]) cylinder(d=3.6,h=thick+(adjust*2)); + translate([86,4.07,0]) cylinder(d=3.6,h=thick+(adjust*2)); + translate([86,65.79,0]) cylinder(d=3.6,h=thick+(adjust*2)); + translate([9.4,65.79,0]) cylinder(d=3.6,h=thick+(adjust*2)); + } + } + } + if(hd == 3.5) { + if(orientation == "portrait") { + if(position == "vertical") { + if(side == "left") { + translate([-6,28.5,0]) cylinder(d=3.6,h=thick+5); + translate([-6,70.5,0]) cylinder(d=3.6,h=thick+5); + translate([-6,28.5+101.6,0]) cylinder(d=3.6,h=thick+5); + } + else { + // portrait 3.5" bottom screw holes + translate([6,28.5,0]) cylinder(d=3.6,h=thick+5); + translate([6,70.5,0]) cylinder(d=3.6,h=thick+5); + translate([6,28.5+101.6,0]) cylinder(d=3.6,h=thick+5); + } + } + else { + // portrait 3.5" bottom screw holes + translate([3.18,41.28,0]) cylinder(d=3.6,h=thick+(adjust*2)); + translate([3.18,85.73,0]) cylinder(d=3.6,h=thick+(adjust*2)); + translate([3.18,117.48,0]) cylinder(d=3.6,h=thick+(adjust*2)); + translate([98.43,41.28,0]) cylinder(d=3.6,h=thick+(adjust*2)); + translate([98.43,85.73,0]) cylinder(d=3.6,h=thick+(adjust*2)); + translate([98.43,117.48,0]) cylinder(d=3.6,h=thick+(adjust*2)); + } + } + if(orientation == "landscape") { + // landscape 3.5" bottom screw holes + translate([29.52,3.18,0]) cylinder(d=3.6,h=thick+(adjust*2)); + translate([61.27,3.18,0]) cylinder(d=3.6,h=thick+(adjust*2)); + translate([105.72,3.18,0]) cylinder(d=3.6,h=thick+(adjust*2)); + translate([29.52,98.43,0]) cylinder(d=3.6,h=thick+(adjust*2)); + translate([61.27,98.43,0]) cylinder(d=3.6,h=thick+(adjust*2)); + translate([105.72,98.43,0]) cylinder(d=3.6,h=thick+(adjust*2)); + } + } +} + + +/* hard drive 2.5", height=drive height */ +module hd25(height) { + + hd25_x = 100; + hd25_y = 69.85; + hd25_z = height; + + adjust = .01; + $fn=90; + + difference() { + color("LightGrey",.6) cube([hd25_x,hd25_y,hd25_z]); + + // bottom screw holes + color("Black",.6) translate([9.4,4.07,-adjust]) cylinder(d=3,h=3); + color("Black",.6) translate([86,4.07,-adjust]) cylinder(d=3,h=3); + color("Black",.6) translate([86,65.79,-adjust]) cylinder(d=3,h=4); + color("Black",.6) translate([9.4,65.79,-adjust]) cylinder(d=3,h=4); + + // side screw holes + color("Black",.6) translate([9.4,-adjust,3]) rotate([-90,0,0]) cylinder(d=3,h=3); + color("Black",.6) translate([86,-adjust,3]) rotate([-90,0,0]) cylinder(d=3,h=3); + color("Black",.6) translate([86,hd25_y+adjust,3]) rotate([90,0,0]) cylinder(d=3,h=3); + color("Black",.6) translate([9.4,hd25_y+adjust,3]) rotate([90,0,0]) cylinder(d=3,h=3); + + // connector opening + color("LightSlateGray",.6) translate([hd25_x-5,11,-1]) cube([5+adjust,32,5+adjust]); + } +} + + +/* hard drive 3.5" */ +module hd35() { + + hd35_x = 147; + hd35_y = 101.6; + hd35_z = 26.1; + + adjust = .01; + $fn=90; + + difference() { + color("LightGrey",.6) cube([hd35_x,hd35_y,hd35_z]); + + // bottom screw holes + color("Black",.6) translate([29.52,3.18,-adjust]) cylinder(d=3,h=3+adjust); + color("Black",.6) translate([61.27,3.18,-adjust]) cylinder(d=3,h=3+adjust); + color("Black",.6) translate([105.72,3.18,-adjust]) cylinder(d=3,h=3+adjust); + color("Black",.6) translate([29.52,98.43,-adjust]) cylinder(d=3,h=3+adjust); + color("Black",.6) translate([61.27,98.43,-adjust]) cylinder(d=3,h=3+adjust); + color("Black",.6) translate([105.72,98.43,-adjust]) cylinder(d=3,h=3+adjust); + + // side screw holes + color("Black",.6) translate([16.9,-adjust,6.35]) rotate([-90,0,0]) cylinder(d=3,h=3); + color("Black",.6) translate([76.6,-adjust,6.35]) rotate([-90,0,0]) cylinder(d=3,h=3); + color("Black",.6) translate([118.5,-adjust,6.35]) rotate([-90,0,0]) cylinder(d=3,h=3); + color("Black",.6) translate([118.5,hd35_y+adjust,6.35]) rotate([90,0,0]) cylinder(d=3,h=3); + color("Black",.6) translate([76.6,hd35_y+adjust,6.35]) rotate([90,0,0]) cylinder(d=3,h=3); + color("Black",.6) translate([16.9,hd35_y+adjust,6.35]) rotate([90,0,0]) cylinder(d=3,h=3); + + // connector opening + color("LightSlateGray",.6) translate([hd35_x-5,11,-1]) cube([5+adjust,32,5+adjust]); + + } +} + + +/* 3.5" hdd to 2.5" hdd holder */ +module hdd35_25holder(length,width=101.6) { + wallthick = 3; + floorthick = 2; + hd35_x = length; // 145mm for 3.5" drive + hd35_y = width; + hd35_z = 12; + hd25_x = 100; + hd25_y = 69.85; + hd25_z = 9.5; + hd25_xloc = 2; // or (hd35_x-hd25_x)/2 + hd25_yloc = (hd35_y-hd25_y)/2; + hd25_zloc = 9.5; + adjust = .1; + $fn=90; + difference() { + union() { + difference() { + translate([(hd35_x/2),(hd35_y/2),(hd35_z/2)]) + cube_fillet_inside([hd35_x,hd35_y,hd35_z], + vertical=[3,3,3,3], top=[0,0,0,0], bottom=[0,0,0,0], $fn=90); + translate([(hd35_x/2),(hd35_y/2),(hd35_z/2)+floorthick]) + cube_fillet_inside([hd35_x-(wallthick*2),hd35_y-(wallthick*2),hd35_z], + vertical=[0,0,0,0], top=[0,0,0,0], bottom=[0,0,0,0], $fn=90); + + // end trim + translate([-adjust,5,wallthick+2]) cube([wallthick+(adjust*2),hd35_y-10,10]); + translate([hd35_x-wallthick-adjust,5,wallthick+2]) cube([wallthick+(adjust*2),hd35_y-10,10]); + + // bottom vents + for ( r=[15:40:hd35_x-40]) { + for (c=[hd35_y-76:4:75]) { + translate ([r,c,-adjust]) cube([35,2,wallthick+(adjust*2)]); + } + } + } + // 2.5 hdd bottom support + translate([9.4+hd25_xloc,4.07+hd25_yloc,floorthick-adjust]) cylinder(d=8,h=4); + translate([86+hd25_xloc,4.07+hd25_yloc,floorthick-adjust]) cylinder(d=8,h=4); + translate([86+hd25_xloc,65.79+hd25_yloc,floorthick-adjust]) cylinder(d=8,h=4); + translate([9.4+hd25_xloc,65.79+hd25_yloc,floorthick-adjust]) cylinder(d=8,h=4); + + // side nut holder support + translate([16,wallthick-adjust,7]) rotate([-90,0,0]) cylinder(d=10,h=3); + translate([76,wallthick-adjust,7]) rotate([-90,0,0]) cylinder(d=10,h=3); + if(length >= 120) { + translate([117.5,wallthick-adjust,7]) rotate([-90,0,0]) cylinder(d=10,h=3); + translate([117.5,hd35_y-wallthick+adjust,7]) rotate([90,0,0]) cylinder(d=10,h=3); + } + translate([76,hd35_y-wallthick+adjust,7]) rotate([90,0,0]) cylinder(d=10,h=3); + translate([16,hd35_y-wallthick+adjust,7]) rotate([90,0,0]) cylinder(d=10,h=3); + + // bottom-side support + translate([wallthick,wallthick,floorthick-2]) rotate([45,0,0]) cube([hd35_x-(wallthick*2),3,3]); + translate([wallthick,hd35_y-wallthick+adjust,floorthick-2]) rotate([45,0,0]) cube([hd35_x-(wallthick*2),3,3]); + + } + // bottom screw holes + translate([9.4+hd25_xloc,4.07+hd25_yloc,-adjust]) cylinder(d=3,h=(floorthick*3)+(adjust*2)); + translate([86+hd25_xloc,4.07+hd25_yloc,-adjust]) cylinder(d=3,h=(floorthick*3)+(adjust*2)); + translate([86+hd25_xloc,65.79+hd25_yloc,-adjust]) cylinder(d=3,h=(floorthick*3)+(adjust*2)); + translate([9.4+hd25_xloc,65.79+hd25_yloc,-adjust]) cylinder(d=3,h=(floorthick*3)+(adjust*2)); + + // countersink holes + translate([9.4+hd25_xloc,4.07+hd25_yloc,-adjust]) cylinder(d1=6.5, d2=3, h=3); + translate([86+hd25_xloc,4.07+hd25_yloc,-adjust]) cylinder(d1=6.5, d2=3, h=3); + translate([86+hd25_xloc,65.79+hd25_yloc,-adjust]) cylinder(d1=6.5, d2=3, h=3); + translate([9.4+hd25_xloc,65.79+hd25_yloc,-adjust]) cylinder(d1=6.5, d2=3, h=3); + + // side screw holes + translate([16,-adjust,7]) rotate([-90,0,0]) cylinder(d=3.6,h=7); + translate([76,-adjust,7]) rotate([-90,0,0]) cylinder(d=3.6,h=7); + translate([117.5,-adjust,7]) rotate([-90,0,0]) cylinder(d=3.6,h=7); + translate([117.5,hd35_y+adjust,7]) rotate([90,0,0]) cylinder(d=3.6,h=7); + translate([76,hd35_y+adjust,7]) rotate([90,0,0]) cylinder(d=3.6,h=7); + translate([16,hd35_y+adjust,7]) rotate([90,0,0]) cylinder(d=3.6,h=7); + + // side nut trap + translate([16,wallthick-adjust,7]) rotate([-90,0,0]) cylinder(r=3.30,h=5,$fn=6); + translate([76,wallthick-adjust,7]) rotate([-90,0,0]) cylinder(r=3.30,h=5,$fn=6); + translate([117.5,wallthick-adjust,7]) rotate([-90,0,0]) cylinder(r=3.30,h=5,$fn=6); + translate([117.5,hd35_y-wallthick-adjust,7]) rotate([90,0,0]) cylinder(r=3.30,h=5,$fn=6); + translate([76,hd35_y-wallthick-adjust,7]) rotate([90,0,0]) cylinder(r=3.30,h=5,$fn=6); + translate([16,hd35_y-wallthick-adjust,7]) rotate([90,0,0]) cylinder(r=3.30,h=5,$fn=6); + } +} diff --git a/lib/holder.scad b/lib/holder.scad new file mode 100644 index 0000000..b76a81e --- /dev/null +++ b/lib/holder.scad @@ -0,0 +1,364 @@ +/* + + pcb_holder(size,wallthick) + nut_holder(nut, style, dia_x, dia_y, height) + vu_holder(vu_model,side,vesa,cheight) + +*/ + +// pcb bottom edge holder +module pcb_holder(size,wallthick) { + + adjust=.01; + $fn = 90; + difference() { + union() { + translate([-1.85,-1.75,0]) cube([size[0]+3.5,5,6]); + translate([size[0]+1.65,-5.75,1]) + rotate([0,-90,0]) + linear_extrude(height = size[0]+3.5) + polygon(points = [ [-wallthick/2,-wallthick/2], + [2,wallthick], + [4,4], + [-wallthick/2,4]]); + translate([-1.85,4,1]) + rotate([0,-90,180]) + linear_extrude(height = size[0]+3.5) + polygon(points = [ [-wallthick/2,-wallthick/2], + [2,wallthick], + [2,2], + [-wallthick/2,2]]); + } + translate([-.5,0,2]) cube([size[0]+1,size[2],5]); + translate([6,-adjust-5-1.75,-adjust]) cube([size[0]-12,14,8]); + } +} + +// +// nut_holder(nut, style, dia_x, dia_y, height) +// nut = "m2", "m2.5", "m3", "m4" +// style = "default", "sloped", "trap" +// dia_x = top diameter or x size in mm +// dia_y = bottom diameter or y size in mm +// height = holder height in mm +// +module nut_holder(nut, style, dia_x, dia_y, height) { + + +nuts = [[2,4,1.6], // m2 size, diameter, height + [2.5,5,2], // m2.5 size, diameter, height + [3,5.5,2.4], // m3 size, diameter, height + [4,7,3.2]]; // m4 size, diameter, height + +$fn = 180; + + if( style == "default") { + difference() { + cylinder(d=dia_x, h=height); + if(nut == "m2") { + translate([0, 0, -1]) cylinder(d=nuts[0][0]+.25, h=height+2); + translate([0, 0, 2]) cylinder(d=nuts[0][1]*2/sqrt(3), h=height, $fn=6); + } + if(nut == "m2.5") { + translate([0, 0, -1]) cylinder(d=nuts[1][0]+.25, h=height+2); + translate([0, 0, 2]) cylinder(d=nuts[1][1]*2/sqrt(3), h=height, $fn=6); + } + if(nut == "m3") { + translate([0, 0, -1]) cylinder(d=nuts[2][0]+.5, h=height+2); + translate([0, 0, 2]) cylinder(d=nuts[2][1]*2/sqrt(3), h=height, $fn=6); + } + if(nut == "m4") { + translate([0, 0, -1]) cylinder(d=nuts[3][0]+.5, h=height+2); + translate([0, 0, 2]) cylinder(d=nuts[3][1]*2/sqrt(3), h=height, $fn=6); + } + } + } + if( style == "sloped") { + difference() { + cylinder(d2=dia_x, d1=dia_y, h=height); + if(nut == "m2") { + translate([0, 0, -1]) cylinder(d=nuts[0][0]+.25, h=height+2); + translate([0, 0, 2]) cylinder(d=nuts[0][1]*2/sqrt(3), h=height, $fn=6); + } + if(nut == "m2.5") { + translate([0, 0, -1]) cylinder(d=nuts[1][0]+.25, h=height+2); + translate([0, 0, 2]) cylinder(d=nuts[1][1]*2/sqrt(3), h=height, $fn=6); + } + if(nut == "m3") { + translate([0, 0, -1]) cylinder(d=nuts[2][0]+.5, h=height+2); + translate([0, 0, 2]) cylinder(d=nuts[2][1]*2/sqrt(3), h=height, $fn=6); + } + if(nut == "m4") { + translate([0, 0, -1]) cylinder(d=nuts[3][0]+.5, h=height+2); + translate([0, 0, 2]) cylinder(d=nuts[3][1]*2/sqrt(3), h=height, $fn=6); + } + } + } + if( style == "trap") { + if(nut == "m2") { + difference() { + translate([-dia_x/2, -dia_y/2, 0]) cube([dia_x, dia_y, height]); + translate([0, 0, -1]) cylinder(d=nuts[0][0]+.25, h=height+2); + translate([0, 0, 2]) rotate([0,0,30]) cylinder(d=nuts[0][1]*2/sqrt(3), h=nuts[0][2], $fn=6); + translate([-nuts[0][1]/2, 0, 2]) cube([nuts[0][1], dia_x, nuts[0][2]]); + } + } + if(nut == "m2.5") { + difference() { + translate([-dia_x/2, -dia_y/2, 0]) cube([dia_x, dia_y, height]); + translate([0, 0, -1]) cylinder(d=nuts[1][0]+.325, h=height+2); + translate([0, 0, 2]) rotate([0,0,30]) cylinder(d=nuts[1][1]*2/sqrt(3), h=nuts[1][2], $fn=6); + translate([-nuts[1][1]/2, 0, 2]) cube([nuts[1][1], dia_x, nuts[1][2]]); + } + } + if(nut == "m3") { + difference() { + translate([-dia_x/2, -dia_y/2, 0]) cube([dia_x, dia_y, height]); + translate([0, 0, -1]) cylinder(d=nuts[2][0]+.5, h=height+2); + translate([0, 0, 2]) rotate([0,0,30]) cylinder(d=nuts[2][1]*2/sqrt(3), h=nuts[2][2], $fn=6); + translate([-nuts[2][1]/2, 0, 2]) cube([nuts[2][1], dia_x, nuts[2][2]]); + } + } + if(nut == "m4") { + difference() { + translate([-dia_x/2, -dia_y/2, 0]) cube([dia_x, dia_y, height]); + translate([0, 0, -1]) cylinder(d=nuts[3][0]+.5, h=height+2); + translate([0, 0, 2]) rotate([0,0,30]) cylinder(d=nuts[3][1]*2/sqrt(3), h=nuts[3][2], $fn=6); + translate([-nuts[3][1]/2, 0, 2]) cube([nuts[3][1], dia_x, nuts[3][2]]); + } + } + } +} + +module vu_holder(vu_model,side,vesa,cheight) { + +//cheight = case_z+90; +v_fillet = 3; + +vu5_case_x_offset = 6.5; // for uniform front vu5=6.5, vu7=20 +vu5_pcb_width = 121; +vu5_pcb_height = 93.31; +vu5_width = vu5_pcb_width + vu5_case_x_offset; +vu5_height = vu5_pcb_height + 9.75; + +vu7_case_x_offset = 20; // for uniform front vu5=6.5, vu7=20 +vu7_pcb_width = 172.90; +vu7_pcb_height = 124.27; +vu7_width = vu7_pcb_width + vu7_case_x_offset; +vu7_height = vu7_pcb_height + 9.75; + + difference() { + union() { + if(side == "right") { + translate([width-wallthick-gap,-(2*wallthick)-gap,0]) + cube([sidethick,depth+2*wallthick,cheight]); + // right tabs for vu5 attachment + if(case_style == "vu5") { + translate([(width/2)+((width-vesa)/2)+(vesa/2)-sidethick,depth-39, + case_z+80]) rotate([90-vu_rotation[0],180,0]) + slab_r([((width-vesa)/2)+4.5,10,sidethick], [.1,.1,3,3]); + translate([(width/2)+((width-vesa)/2)+(vesa/2)-sidethick,depth-26, + case_z+31.5]) rotate([90-vu_rotation[0],180,0]) + slab_r([((width-vesa)/2)+4.5,10,sidethick], [.1,.1,3,3]); + + translate([(width/2)+((width-vesa)/2)+(vesa/2)-sidethick,depth-41.85-adj, + case_z+79.25]) rotate([90-vu_rotation[0],180,0]) + difference() { + cube([sidethick,10,sidethick]); + translate([0,-adj,sidethick]) rotate([0,45,0]) + cube([2*sidethick,10+(2*adj),sidethick]); + } + translate([(width/2)+((width-vesa)/2)+(vesa/2)-sidethick,depth-28.85-adj, + case_z+30.75]) rotate([90-vu_rotation[0],180,0]) + difference() { + cube([sidethick,10,sidethick]); + translate([0,-adj,sidethick]) rotate([0,45,0]) + cube([2*sidethick,10+(2*adj),sidethick]); + } + } + // right tabs for vu7 attachment + if(case_style == "vu7") { + translate([(width/2)+((width-vesa)/2)+(vesa/2)-sidethick-1,depth-49.40, + case_z+vu7_height-15]) rotate([90-vu_rotation[0],180,0]) + slab_r([((width-vesa)/2)+12,10,sidethick], [.1,.1,3,3]); + translate([(width/2)+((width-vesa)/2)+(vesa/2)-sidethick-1,depth-23.60, + case_z+22.5]) rotate([90-vu_rotation[0],180,0]) + slab_r([((width-vesa)/2)+12,10,sidethick], [.1,.1,3,3]); + + translate([(width/2)+((width-vesa)/2)+(vesa/2)-sidethick,depth-52.25, + case_z+vu7_height-15.75]) rotate([90-vu_rotation[0],180,0]) + difference() { + cube([sidethick,10,sidethick]); + translate([0,-adj,sidethick]) rotate([0,45,0]) + cube([2*sidethick,10+(2*adj),sidethick]); + } + translate([(width/2)+((width-vesa)/2)+(vesa/2)-sidethick,depth-26.5, + case_z+21.8]) rotate([90-vu_rotation[0],180,0]) + difference() { + cube([sidethick,10,sidethick]); + translate([0,-adj,sidethick]) rotate([0,45,0]) + cube([2*sidethick,10+(2*adj),sidethick]); + } + } + // top rail + translate([width-6.9-adj,-gap,case_z-floorthick-.5]) + cube([4,depth-2*(wallthick+gap),2]); + } + if(side == "left") { + translate([-wallthick-gap-sidethick,-(2*wallthick)-gap,0]) + cube([sidethick,depth+2*wallthick,cheight]); + // left tabs for vu5 attachment + if(case_style == "vu5") { + translate([-((width-vesa)/2)+(width/2)-(vesa/2)-3.5-adj,depth-36.4, + case_z+70]) rotate([90+vu_rotation[0],0,0]) + slab_r([((width-vesa)/2)+4,10, sidethick], [.1,.1,3,3]); + translate([-((width-vesa)/2)+(width/2)-(vesa/2)-3.5-adj,depth-23.5, + case_z+22]) rotate([90+vu_rotation[0],0,0]) + slab_r([((width-vesa)/2)+4,10,sidethick], [.1,.1,3,3]); + translate([-((width-vesa)/2)+(width/2)-(vesa/2)-3.5-adj,depth-39.35+adj, + case_z+69.25]) rotate([90+vu_rotation[0],0,0]) + difference() { + cube([sidethick,10,sidethick]); + translate([0,-adj,sidethick]) rotate([0,45,0]) + cube([2*sidethick,10+(2*adj),2*sidethick]); + } + translate([-((width-vesa)/2)+(width/2)-(vesa/2)-3.5-adj,depth-26.4+adj, + case_z+21.25]) rotate([90+vu_rotation[0],0,0]) + difference() { + cube([sidethick,10,sidethick]); + translate([0,-adj,sidethick]) rotate([0,45,0]) + cube([2*sidethick,10+(2*adj),2*sidethick]); + } + } + // left tabs for vu7 attachment + if(case_style == "vu7") { + translate([-((width-vesa)/2)+(width/2)-(vesa/2)-4.25-adj,depth-46.85, + case_z+vu7_height-24.5]) rotate([90+vu_rotation[0],0,0]) + slab_r([((width-vesa)/2),10, sidethick], [.1,.1,3,3]); + translate([-((width-vesa)/2)+(width/2)-(vesa/2)-4.25-adj,depth-21, + case_z+13]) rotate([90+vu_rotation[0],0,0]) + slab_r([((width-vesa)/2),10,sidethick], [.1,.1,3,3]); + translate([-((width-vesa)/2)+(width/2)-(vesa/2)-4-adj,depth-49.75+adj, + case_z+vu7_height-25.25]) rotate([90+vu_rotation[0],0,0]) + difference() { + cube([sidethick,10,sidethick]); + translate([0,-adj,sidethick]) rotate([0,45,0]) + cube([2*sidethick,10+(2*adj),2*sidethick]); + } + translate([-((width-vesa)/2)+(width/2)-(vesa/2)-4-adj,depth-23.75+adj, + case_z+12.25]) rotate([90+vu_rotation[0],0,0]) + difference() { + cube([sidethick,10,sidethick]); + translate([0,-adj,sidethick]) rotate([0,45,0]) + cube([2*sidethick,10+(2*adj),2*sidethick]); + } + } + // top rail + translate([-wallthick-gap-adj,-gap,case_z-floorthick-.5]) + cube([4,depth-2*(wallthick+gap),2]); + } + } + + if(side == "right") { + // vu5 shape and back cut + if(case_style == "vu5") { + translate([width+sidethick-2,-.6,case_z+sidethick+2.5]) + rotate([0,-90,0]) + linear_extrude(height = 2*sidethick) + polygon(points = [ [-sidethick,-sidethick-wallthick-5], + [cheight-bottom_height-top_height-3,-sidethick-wallthick-5], + [cheight-bottom_height-top_height-3,depth-53], + [-sidethick,depth-33]]); + + translate([width-(sidethick/2),depth-8,case_z+(121/2)]) + rotate([vu_rotation[0],0,0]) + cube_fillet_inside([10,50,110],vertical=[v_fillet,v_fillet,v_fillet,v_fillet], + top=[0,0,0,0],bottom=[3,3,3,3], $fn=90); + // tab holes + translate([width/2+(vesa/2)-3,depth-37, + case_z+75]) rotate([90-vu_rotation[0],180,0]) cylinder(d=3, h=sidethick+1); + translate([width/2+(vesa/2)-3,depth-24, + case_z+26.75]) rotate([90-vu_rotation[0],180,0]) cylinder(d=3, h=sidethick+1); + } + // vu7 shape and back cut + if(case_style == "vu7") { + translate([width+sidethick-2,-.6,case_z+sidethick+2.5]) + rotate([0,-90,0]) + linear_extrude(height = 2*sidethick) + polygon(points = [ [-sidethick,-sidethick-wallthick-5], + [cheight-bottom_height-top_height-3,-sidethick-wallthick-5], + [cheight-bottom_height-top_height-3,depth-63], + [-sidethick,depth-33]]); + + translate([width-(sidethick/2),depth-10.5,case_z+70.5]) + rotate([vu_rotation[0],0,0]) + cube_fillet_inside([10,50,130],vertical=[v_fillet,v_fillet,v_fillet,v_fillet], + top=[0,0,0,0],bottom=[3,3,3,3], $fn=90); + // tab holes + translate([width/2+(vesa/2)-10,depth-47,case_z+vu7_height-19.75]) + rotate([90-vu_rotation[0],180,0]) cylinder(d=3, h=sidethick+4); + translate([width/2+(vesa/2)-10,depth-21.25,case_z+18]) + rotate([90-vu_rotation[0],180,0]) cylinder(d=3, h=sidethick+4); + } + // bottom attachment holes + translate([width-wallthick-gap-adj-5,wallthick+gap+10, + ((bottom_height+floorthick)/2)-1]) rotate([0,90,0]) cylinder(d=3, h=sidethick+(2*adj)+10); + translate([width-wallthick-gap-adj-5,depth-wallthick-gap-10, + ((bottom_height+floorthick)/2)-1]) rotate([0,90,0]) cylinder(d=3, h=sidethick+(2*adj)+10); + } + + if(side == "left") { + // vu5 shape and back cut + if(case_style == "vu5") { + translate([-sidethick-adj,-.6,case_z+sidethick+2.5]) + rotate([0,-90,0]) + linear_extrude(height = 2*sidethick) + polygon(points = [ [-sidethick,-sidethick-wallthick-5], + [cheight-bottom_height-top_height-3,-sidethick-wallthick-5], + [cheight-bottom_height-top_height-3,depth-53], + [-sidethick,depth-33]]); + + translate([-wallthick-gap-(sidethick/2),depth-8,case_z+(121/2)]) + rotate([vu_rotation[0],0,0]) + cube_fillet_inside([10,50,110],vertical=[v_fillet,v_fillet,v_fillet,v_fillet], + top=[0,0,0,0],bottom=[3,3,3,3], $fn=90); + // tab holes + translate([width/2-(vesa/2)-3,depth-36.75,case_z+75]) + rotate([90+vu_rotation[0],0,0]) cylinder(d=3, h=sidethick+1); + translate([width/2-(vesa/2)-3,depth-24.25,case_z+26.75]) + rotate([90+vu_rotation[0],0,0]) cylinder(d=3, h=sidethick+1); + } + // vu7 shape and back cut + if(case_style == "vu7") { + translate([-sidethick-adj,-.6,case_z+sidethick+2.5]) + rotate([0,-90,0]) + linear_extrude(height = 2*sidethick) + polygon(points = [ [-sidethick,-sidethick-wallthick-5], + [cheight-bottom_height-top_height-3,-sidethick-wallthick-5], + [cheight-bottom_height-top_height-3,depth-63], + [-sidethick,depth-33]]); + + translate([-wallthick-gap-(sidethick/2),depth-10.5,case_z+70.5]) + rotate([vu_rotation[0],0,0]) + cube_fillet_inside([10,50,130],vertical=[v_fillet,v_fillet,v_fillet,v_fillet], + top=[0,0,0,0],bottom=[3,3,3,3], $fn=90); + // tab holes + translate([width/2-(vesa/2)-10,depth-48,case_z+vu7_height-19.75]) + rotate([90+vu_rotation[0],0,0]) cylinder(d=3, h=sidethick+4); + translate([width/2-(vesa/2)-10,depth-22.25,case_z+18]) + rotate([90+vu_rotation[0],0,0]) cylinder(d=3, h=sidethick+4); + } + // bottom attachment holes + translate([-sidethick-adj-6,wallthick+gap+10,((bottom_height+floorthick)/2)-1]) + rotate([0,90,0]) cylinder(d=3, h=sidethick+(2*adj)+10); + if(depth >= 75) { + translate([-sidethick-adj-6,depth-wallthick-gap-10, + ((bottom_height+floorthick)/2)-1]) rotate([0,90,0]) cylinder(d=3, h=sidethick+(2*adj)+10); + } + else { + translate([-sidethick-adj-6,wallthick+gap+40.5,((bottom_height+floorthick)/2)-1]) + rotate([0,90,0]) cylinder(d=3, h=sidethick+(2*adj)+10); + } + } + } +} diff --git a/lib/keyhole.scad b/lib/keyhole.scad new file mode 100644 index 0000000..7ece62f --- /dev/null +++ b/lib/keyhole.scad @@ -0,0 +1,51 @@ +/* + + keyhole(keysize, mask = false) + +*/ + +// enclosed keyhole +module keyhole(keysize, mask = false) { + + adjust=.01; + $fn = 90; + + if(mask == true) { + union() { + translate([0, 0, -adjust]) cylinder(h=keysize[3]+2*adjust, d=keysize[0]); + translate([-keysize[1]/2, 0, -adjust]) cube([keysize[1], keysize[2]+keysize[0]/2, keysize[3]+2*adjust]); + translate([0, -keysize[1]/2, -adjust]) cube([keysize[2]+keysize[0]/2, keysize[1], keysize[3]+2*adjust]); + } + } + else { + difference() { + union() { + translate([0, 0, -adjust]) + difference() { + difference() { + 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([keysize[2], keysize[2], -adjust]) cube([keysize[2]*3, keysize[2]*3, keysize[3]+5]); + } + difference() { + translate([-keysize[2]+2, -keysize[2]+2, keysize[3]-adjust]) + cube([-4+keysize[2]*3, -4+keysize[2]*3, 3.5]); + translate([2, -10, 0]) rotate([0, 0, 135]) cube([20, 10, 10]); + translate([+keysize[2]-2, keysize[2]-2, -adjust]) + cube([keysize[2]*3, keysize[2]*3, keysize[3]+5]); + } + } + difference() { + 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([keysize[2], keysize[2], -adjust]) cube([keysize[2]*3, keysize[2]*3, keysize[3]+2*adjust]); + union() { + translate([0, 0, -adjust]) cylinder(h=keysize[3]+2*adjust, d=keysize[0]); + translate([-keysize[1]/2, 0, -adjust]) cube([keysize[1], keysize[2]+keysize[0]/2, keysize[3]+2*adjust]); + translate([0, -keysize[1]/2, -adjust]) cube([keysize[2]+keysize[0]/2, keysize[1], keysize[3]+2*adjust]); + } + } + } +} diff --git a/lib/oem_hk.scad b/lib/oem_hk.scad new file mode 100644 index 0000000..3fe85bb --- /dev/null +++ b/lib/oem_hk.scad @@ -0,0 +1,1124 @@ +/* + uart_holder() + uart_strap () + hc4_oled_holder(side,floorthick) + hk_wb2() + hc4_oled() + h2_netcard() + hk35_lcd() + hk_uart() + hk_vu7c(gpio_ext, tabs) + hk_vu8m(bracket) + u_bracket() + m1_hdmount() + hk_speaker() + hk_boom(speakers,orientation) + hk_boom_speaker(side,speaker,pcb) + boom_speaker() + hk_boom_grill(style,thick) + boom_speaker_holder(style,tolerance) + boom_speaker_strap() + boom_vring(tolerance) + hk_pwr_button(mask = false) + hk_m1s_case_holes + hk_m1s_ups() + proto_m1s() + proto_ups() + +*/ + +/* odroid uart module holder */ +module hk_uart_holder() { + + rotate([0,0,0]) + translate ([0,0,0]) + union () { + difference () { + translate ([0,0,0]) cube([18,24,9]); + translate ([2,-2,3]) cube([14,27,7]); + //pin slot + translate ([3.5,16,-1]) cube([11,1,5]); + //component bed + translate ([3.5,1.5,2]) cube ([11,14,2]); + //side trim + translate ([-1,-1,6]) cube([20,18,4]); + } + difference (){ + translate ([-1.5,20,0]) cylinder(r=3,h=9, $fn=90); + translate ([-1.5,20,-1]) cylinder (r=1.375, h=11, $fn=90); + } + difference (){ + translate ([19.5,20,0]) cylinder(r=3,h=9, $fn=90); + translate ([19.5,20,-1]) cylinder (r=1.375, h=11,$fn=90); + } + } + } + + +/* odroid uart strap for holder */ +module uart_strap() { + difference () { + translate ([-4.5,17,9]) cube([27,6,3]); + translate ([-1.5,20,8]) cylinder (r=1.6, h=5, $fn=90); + translate ([19.5,20,8]) cylinder (r=1.6, h=5, $fn=90); + } + difference (){ + translate ([-1.5,20,12]) cylinder(r=3,h=1, $fn=90); + translate ([-1.5,20,11]) cylinder (r=1.6, h=7, $fn=90); + } + difference (){ + translate ([19.5,20,12]) cylinder(r=3,h=1, $fn=90); + translate ([19.5,20,11]) cylinder (r=1.6, h=7, $fn=90); + } +} + +module hk_wb2() { + difference () { + union() { + color("tan") cube([16.5,16.5,1]); + translate([1.75,15.75,.75]) rotate([180,0,0]) header_f(6,9); + color("silver") translate([11.5,11.5,1]) cube([2,3,.5]); + color("silver") translate([11.5,3,1]) cube([2,3,.5]); + } + translate([9.6,8.33,-1]) + color("tan") hull() { + cylinder(d=1, h=3); + translate([5,0,0]) cylinder(d=1, h=3); + } + translate([7.36,2,-1]) rotate([0,0,90]) + color("tan") hull() { + cylinder(d=1, h=3); + translate([5,0,0]) cylinder(d=1, h=3); + } + } +} + + +/* odroid-hc4 oled holder */ +module hc4_oled_holder(side,wallthick) { + + adjust=.01; + $fn = 90; + difference() { + union() { + if(side == "top") { + translate([-1.85,-1.75,-4]) cube([32,5,4]); + translate([30.15,-3.75,1]) + rotate([0,-90,0]) + linear_extrude(height = 32) + polygon(points = [ [-wallthick/2,-wallthick/2], + [-4,wallthick], + [-4,2], + [-wallthick/2,2]]); + translate([-1.85,4,1]) + rotate([0,-90,180]) + linear_extrude(height = 32) + polygon(points = [ [-wallthick/2,-wallthick/2], + [-4,wallthick], + [-4,2], + [-wallthick/2,2]]); + } + if(side == "bottom") { + translate([-1.85,-1.75,0]) cube([32,5,4]); + translate([30.15,-3.75,1]) + rotate([0,-90,0]) + linear_extrude(height = 32) + polygon(points = [ [-wallthick/2,-wallthick/2], + [2,wallthick], + [2,2], + [-wallthick/2,2]]); + translate([-1.85,4,1]) + rotate([0,-90,180]) + linear_extrude(height = 32) + polygon(points = [ [-wallthick/2,-wallthick/2], + [2,wallthick], + [2,2], + [-wallthick/2,2]]); + } + } + if(side == "top") { + translate([-.5,0,wallthick-8]) cube([29.5,1.9,5]); + translate([(32.75/2-(15/2))-1.85,-adjust-3-1.75,-wallthick-2.5]) cube([15,12,wallthick+3]); + } + if(side == "bottom") { + translate([-.5,0,-adjust]) cube([29.5,1.42,5]); + translate([(32.75/2-(15/2))-1.85,-adjust-3-1.75,-adjust]) cube([15,12,8]); + translate([2.5,-adjust-3-1.75,-adjust]) cube([6,3,8]); + translate([12.5,adjust,10]) rotate([90,0,0]) cylinder(d=21, h=2); + } + } +} + +/* odroid-hc4 oled */ +module hc4_oled() { + +adjust = .01; +$fn=90; + +oled_x = 28.5; +oled_y = 1.25; +oled_z = 48.6; + +oled_open_x = 29; +oled_open_y = 1.5; + difference() { + union() { + // pcb board + color("Tan", 1) translate([0,0,0]) cube([oled_x,oled_y,oled_z]); + // oled + color("Black", 1) translate([.5,1.25,25.5]) cube([oled_x-1,.625,15]); + color("DarkGrey", 1) translate([.5,1.25,40.5]) cube([oled_x-1,.625,4]); + } + translate([2.8,0,46.7]) { + translate([-.6,1.26,0]) rotate([90,0,0]) + hull() { + translate([1.2,0,0]) cylinder(d=1.8, h=1.25+(adjust*2)); + cylinder(d=1.8, h=1.25+(adjust*2)); + } + } + translate([25.7,0,46.7]) { + translate([-.6,1.26,0]) rotate([90,0,0]) + hull() { + translate([1.2,0,0]) cylinder(d=1.8, h=1.25+(adjust*2)); + cylinder(d=1.8, h=1.25+(adjust*2)); + } + } + + } +} + + +/* h2 network card */ +module h2_netcard() { + + adjust = .01; + $fn = 90; + difference() { + union() { + color("tan") translate ([0,0,0]) linear_extrude(height = 1) import("./dxf/hk-network-card.dxf"); + color("goldenrod") translate([3.75,17.85,1-adjust]) cylinder(d=6,h=3); + color("goldenrod") translate([106,24.85,1-adjust]) cylinder(d=6,h=3); + } + translate([20.85,3.85,-adjust]) cylinder(d=3,h=4); + translate([3.75,17.85,-adjust]) cylinder(d=3,h=6); + translate([3.75,51.1,-adjust]) cylinder(d=3,h=4); + translate([20.15,43.85,-adjust]) cylinder(d=3,h=4); + translate([106,24.85,-adjust]) cylinder(d=3,h=6); + translate([96.5,3.85,-adjust]) cylinder(d=3,h=4); + } + rj45(26,-1,0,"bottom",1); + rj45(43,-1,0,"bottom",1); + rj45(60,-1,0,"bottom",1); + rj45(77,-1,0,"bottom",1); + place(30,25,0,6,6,0,"bottom") color("dimgray") translate([0,0,0]) cube([6,6,.8]); + place(47,25,0,6,6,0,"bottom") color("dimgray") translate([0,0,0]) cube([6,6,.8]); + place(64,25,0,6,6,0,"bottom") color("dimgray") translate([0,0,0]) cube([6,6,.8]); + place(79,25,0,6,6,0,"bottom") color("dimgray") translate([0,0,0]) cube([6,6,.8]); + place(56.5,41,0,5,9.75,0,"bottom") color("dimgray") translate([0,0,0]) cube([5,9.75,.8]); + for (i=[34.65:.5:48.5]) { + color("gold") translate([98,i,1]) cube([2,.25,.25]); + color("gold") translate([98,i,-.24]) cube([2,.25,.25]); + } + for (i=[51:.5:53]) { + color("gold") translate([98,i,1]) cube([2,.25,.25]); + color("gold") translate([98,i,-.24]) cube([2,.25,.25]); + } + +} + + +/* hk 3.5 lcd */ +module hk35_lcd() { + + adjust = .01; + $fn = 90; + difference() { + union() { + color("tan") translate ([0,0,0]) slab([95,56,1.7],3.5); + color("black",1) translate([10.5,0,1.7]) cube([74.75,54.5,4]); + color("white",1) translate([8.5,0,5.7-adjust]) cube([82.75,54.5,2]); + color("grey",1) translate([8.5,0,7.7-adjust]) cube([82.75,54.5,.8]); + color("dimgrey",1) translate([15,2,8.5-adjust]) cube([75.5,51,.25]); + } + translate([3.5,3.5,-adjust]) cylinder(d=3,h=6); + translate([3.5,52.5,-adjust]) cylinder(d=3,h=4); + } + translate([3,8.75,1.70-adjust]) momentary45x15(); + translate([3,19.75,1.70-adjust]) momentary45x15(); + translate([3,30.75,1.70-adjust]) momentary45x15(); + translate([3,41.75,1.70-adjust]) momentary45x15(); + color("black") translate([7.375,.8,-9+adjust]) cube([51.5,5,9]); + translate([92.5,4,adjust]) rotate([0,180,0]) header(5); + } + + +// hk console uart model +module hk_uart() { + + size = [22,13,1.25]; + adjust = .01; + $fn = 90; + color("tan") cube([size[0],size[1],size[2]]); + translate([6.5,.25,6.25-adjust]) rotate([90,180,-90]) uart_micro(); + translate([6.75,3,-2+adjust])cylinder(d=1, 2); + translate([6.75,5.25,-2+adjust])cylinder(d=1, 2); + translate([6.75,7.5,-2+adjust])cylinder(d=1, 2); + translate([6.75,9.75,-2+adjust])cylinder(d=1, 2); + translate([23,2.75,1.25]) rotate([0,0,90]) usb_micro(); + translate([13,4.5,1.25]) rotate([0,0,90]) ic([4,4,1]); +} + + +// hk vu7c lcd display +module hk_vu7c(gpio_ext, tabs) { + + lcd_size = [164.85,100,5.48]; + pcb_size = [184.6,75,1.6]; + view_size = [155,88.5,.125]; // 154.21 x 85.92 + hole = 3.2; + length = 24-hole; + depth = 2; + adjust = .1; + $fn = 90; + difference() { + union() { + color("lightgray") translate([0,0,pcb_size[2]+3.12]) cube(lcd_size); + if(tabs == true) { + color("black") translate([-(pcb_size[0]-lcd_size[0])/2,lcd_size[1]-pcb_size[1]-1,0]) + cube(pcb_size); + } + else { + color("black") translate([0,lcd_size[1]-pcb_size[1]-1,0]) + cube([pcb_size[0]-20,pcb_size[1],pcb_size[2]]); + } + color("black") translate([3,7.5,pcb_size[2]+3.12+lcd_size[2]-adjust]) cube(view_size); + // tabs + color("black") translate([51.8,99,0]) slab_r([8,8,1.6],[.1,4,4,.1]); + color("black") translate([104.8,99,0]) slab_r([8,8,1.6],[.1,4,4,.1]); + } + // slots + color("dimgray") translate([-(pcb_size[0]-lcd_size[0])/4,lcd_size[1]-1-7,-adjust]) + rotate([0,0,-90]) slot(hole,length,depth); + color("dimgray") translate([-(pcb_size[0]-lcd_size[0])/4,lcd_size[1]-1-46,-adjust]) + rotate([0,0,-90]) slot(hole,length,depth); + color("dimgray") translate([(pcb_size[0]-(pcb_size[0]-lcd_size[0])/2)-(pcb_size[0]-lcd_size[0])/4, + lcd_size[1]-1-7,-adjust]) rotate([0,0,-90]) slot(hole,length,depth); + color("dimgray") translate([(pcb_size[0]-(pcb_size[0]-lcd_size[0])/2)-(pcb_size[0]-lcd_size[0])/4, + lcd_size[1]-1-46,-adjust]) rotate([0,0,-90]) slot(hole,length,depth); + // holes + color("dimgray") translate([55.8,103.5,-adjust]) cylinder(d=hole, h=3); + color("dimgray") translate([108.8,103.5,-adjust]) cylinder(d=hole, h=3); + // pcb cuts + color("dimgray") translate([66,97.5,-adjust]) slab_r([20.3,4,2],[1,1,1,1]); + color("dimgray") translate([17.8,lcd_size[1]-pcb_size[1]-2,-adjust]) slab_r([78.8,6,2],[1,1,1,1]); + } + // components + translate([70+14.5,28.58,0]) rotate([180,0,180]) hdmi_a(); + translate([47.49-1,42.09-.75,0]) rotate([180,0,90]) header_f(7,15); + translate([39.5,80.19-1,0]) rotate([180,0,90]) header_f(20,15); + translate([39.5,82.73-1,0]) rotate([180,0,90]) header_f(20,15); + translate([13.15+2.75-.25,36.71-1.25,0]) rotate([180,0,180]) header(7); + translate([23.58+2.5,74.42-1.25,0]) rotate([180,0,180]) header(5); + translate([98+2,26.04-2,0]) rotate([180,0,180]) pcb_pad(7); + color("dimgray") translate([16.25,69.4,-1.99]) cube([4,4,2]); + translate([18.5,58,-1.99]) cube([25,5.5,2]); + translate([80.5,52.5,-1.99]) cube([4.5,3.5,2]); + // gpio extension + if(gpio_ext == true) { + translate([57.37-1.25,94.93-1.25,0]) rotate([180,0,90]) header(20); + translate([57.37-1.25,92.39-1.25,0]) rotate([180,0,90]) header(20); + } + else { + translate([57.37-2,94.93-2,0]) rotate([180,0,90]) pcb_pad(20); + translate([57.37-2,92.39-2,0]) rotate([180,0,90]) pcb_pad(20); + } + translate([59,52.69,-1.59]) ic(9); +} + + +// hk vu8m lcd display +module hk_vu8m(brackets) { + $fn = 90; + + m1_screw_spacing = 72; + + body_size = [ 198, 133, 1.93]; + glass_size = [ 195.73, 131.14, 1.60]; + lcd_size = [ 184.63, 114.94, body_size[2] + 0.40]; + view_size = [ 173.23, 108.64, .1]; + + rb = 5.25; // body edge radius + + lcd_clearance = [0.15, 0.1, 0]; + pcb_size = [14,24,1.6]; + hole = 4.31; + spacer_size = [5.5, 6, 2.5, 5.5, 1, 0, 1, 1, 0, 0, 0]; + + // "body" + color([0.1,0.1,0.1]) + difference(){ + slab(body_size, rb); + lcd_space = lcd_size + 2*lcd_clearance; + translate([3.76 , 9 , -1]) cube(lcd_space); + translate([3.76 , 9 , -1]) cylinder(r=1.3, h=5); + translate([3.76 + lcd_space[0], 9 , -1]) cylinder(r=1.3, h=5); + translate([3.76 , 9 + lcd_space[1], -1]) cylinder(r=1.3, h=5); + translate([3.76 + lcd_space[0], 9 + lcd_space[1], -1]) cylinder(r=1.3, h=5); + // 8x holes in body + translate([ 44.5, 4.5, -1]) cylinder(d=hole, h=5); + translate([ 51.5, 4.5, -1]) cylinder(d=hole, h=5); + translate([ 183.5, 4.5, -1]) cylinder(d=hole, h=5); + translate([ 190.5, 4.5, -1]) cylinder(d=hole, h=5); + translate([ 44.5, body_size[1]-4.5, -1]) cylinder(d=hole, h=5); + translate([ 51.5, body_size[1]-4.5, -1]) cylinder(d=hole, h=5); + translate([ 183.5, body_size[1]-4.5, -1]) cylinder(d=hole, h=5); + translate([ 190.5, body_size[1]-4.5, -1]) cylinder(d=hole, h=5); + + } + // 4x standoffs + color([0.6,0.6,0.6]) { + translate([ 44.5, 4.5, 0]) standoff(spacer_size); + translate([ 183.5, 4.5, 0]) standoff(spacer_size); + translate([ 44.5, body_size[1]-4.5, 0]) standoff(spacer_size); + translate([ 183.5, body_size[1]-4.5, 0]) standoff(spacer_size); + } + // LCD panel + color([0.6, 0.6, 0.65]) + translate([3.76, 9, body_size[2]-lcd_size[2]]+lcd_clearance) + cube(lcd_size); + + // Front glass + // It's actually thinner and glued, but for the sake of simplicity... + color([0.2, 0.2, 0.2], 0.9) + translate([0.86, 1.38, body_size[2] + 0.01]) + slab(glass_size, rb); + + // view area + color("dimgrey", 0.9) + translate([(glass_size[0]-view_size[0])/2, (glass_size[1]-view_size[1])/2, body_size[2] + glass_size[2]- 0.01]) + slab(view_size, .1); + + // PCB stub + color([0.1,0.1,0.1]) + translate([20.5, 24.5, -3]) + cube(pcb_size); + color("dimgrey") + translate([22.5, 26.5, -2]) + cube([8,16,3]); + color([0.1,0.1,0.1]) + translate([12, 21, -2]) + cube([7,7,1.6]); + color([0.1,0.1,0.1]) + translate([10, 34, -2]) + cube([4,10,1.6]); + + //Brackets + if(brackets) { + translate([44.5 - 7.5, body_size[1]/2 + m1_screw_spacing/2 - 7.5, - spacer_size[1] - 2]) u_bracket(); + translate([44.5 - 7.5, body_size[1]/2 - m1_screw_spacing/2 + 7.5, - spacer_size[1] - 2 + 1.93]) rotate([180,0,0]) u_bracket(); + + //Screws + color([0.1,0.1,0.1]) { + translate([ 44.5, 4.5, -8]) rotate([180,0,0]) screw([3,7,0]); + translate([ 183.5, 4.5, -8]) rotate([180,0,0]) screw([3,7,0]); + translate([ 44.5, body_size[1]-4.5, -8]) rotate([180,0,0]) screw([3,7,0]); + translate([ 183.5, body_size[1]-4.5, -8]) rotate([180,0,0]) screw([3,7,0]); + } + } +} + +// Vu8M LCD U-BRACKET +module u_bracket() { + $fn= 30; + xi = 124; + xo = 154; + yi = 42; + yo = 42 + 12; // Outer vertical dimension + z = 1.93; + rlo = 21.3; // Lower outer corner radii + rli = 1; // Lower inner corner radii + ruo = 5.7; // Upper outer corner radii + rui = 5.7; // Upper inner corner radii + + color([0.2,0.2,0.2]) + difference() { + union() { + hull() { + translate([ rlo, rlo,0]) cylinder(r=rlo, h=z, $fn=100); + translate([xo - rlo, rlo,0]) cylinder(r=rlo, h=z, $fn=100); + } + hull() { + translate([ ruo, yo - ruo,0]) cylinder(r=ruo, h=z); + translate([ 15 - rui, yo - rui,0]) cylinder(r=rui, h=z); + translate([ 0, rlo,0]) cube([15,$fs,z]); + } + hull() { + translate([xo - ruo, yo - ruo,0]) cylinder(r=ruo, h=z); + translate([xo - 15 + rui, yo - rui,0]) cylinder(r=rui, h=z); + translate([xo - 15 , rlo,0]) cube([15,$fs,z]); + } + } + hull() { + translate([ 15 + rli, yo - yi + rli,-1]) cylinder(r=rli, h=z+2); + translate([xo - 15 - rli, yo - yi + rli,-1]) cylinder(r=rli, h=z+2); + translate([ 15, yo,-1]) cube([xi,$fs,z+2]); + } + translate([ 7.5, yo - 4, -1]) cylinder(d=3.21, h=z+2); + translate([xo - 7.5, yo - 4, -1]) cylinder(d=3.21, h=z+2); + hull() { + translate([ 7.5, yo - 9.6, -1]) cylinder(d=3.21, h=z+2); + translate([ 7.5, yo - 29.4, -1]) cylinder(d=3.21, h=z+2); + } + hull() { + translate([xo - 7.5, yo - 9.6, -1]) cylinder(d=3.21, h=z+2); + translate([xo - 7.5, yo - 29.4, -1]) cylinder(d=3.21, h=z+2); + } + translate([ 15 + 5.00, 8.25, -1]) cylinder(d=4.11, h=z+2); + translate([xo - 15 - 30.00, 8.25, -1]) cylinder(d=4.11, h=z+2); + translate([ 15 + 10.75, 2.50, -1]) cylinder(d=4.11, h=z+2); + translate([ 15 + 41.75, 2.50, -1]) cylinder(d=4.11, h=z+2); + translate([ 15 + 82.25, 2.50, -1]) cylinder(d=4.11, h=z+2); + translate([ 15 + 113.25, 2.50, -1]) cylinder(d=4.11, h=z+2); + } +} + +// hk vu8s lcd display +module hk_vu8s() { + + body_size = [202, 133, 1.70]; + glass_size = [195.5, 131, 1.75]; + lcd_size = [183.5,114, body_size[2] + 1]; + view_size = [172.5, 107.5, .1]; + + rb = 5.25; // body edge radius + + lcd_clearance = [0.15, 0.1, 0]; + pcb_size = [14,24,1.6]; + hole = 4.31; + spacer_size = [5.5, 1.75+body_size[2], 2.5, 5.5, 1, 0, 1, 1, 0, 0, 0]; + + $fn = 90; + adj = .01; + + // "body" + color([0.1,0.1,0.1]) + difference(){ + union() { + slab(body_size, rb); + translate([(8.25/2),-1.74-(8.25/2),0]) rotate([0,0,90]) slot(8.25,10+(8.25/2),body_size[2]); + translate([body_size[0]-(8.25/2),-1.74-(8.25/2),0]) rotate([0,0,90]) slot(8.25,10+(8.25/2),body_size[2]); + translate([(8.25/2),body_size[1]-10,0]) rotate([0,0,90]) slot(8.25,10.75+(8.25/2),body_size[2]); + translate([body_size[0]-(8.25/2),body_size[1]-10,0]) rotate([0,0,90]) slot(8.25,10.75+(8.25/2),body_size[2]); + } + lcd_space = lcd_size + 2*lcd_clearance; + + // corner holes + translate([4, -5, -1]) cylinder(d=hole, h=5); + translate([4, 143-5, -1]) cylinder(d=hole, h=5); + translate([202-4, -5, -1]) cylinder(d=hole, h=5); + translate([202-4, 143-5, -1]) cylinder(d=hole, h=5); + + translate([3.5, 3.5, -1]) cylinder(d=hole, h=5); + translate([3.5, body_size[1]-3.5, -1]) cylinder(d=hole, h=5); + translate([111, 3.5, -1]) cylinder(d=hole, h=5); + translate([111.5, body_size[1]-3.5, -1]) cylinder(d=hole, h=5); + + } + // standoffs + color([0.6,0.6,0.6]) { + translate([4, 3.75, body_size[2]+adj]) standoff(spacer_size); + translate([3.75, 128.25, body_size[2]+adj]) standoff(spacer_size); + translate([111.5, 4, body_size[2]+adj]) standoff(spacer_size); + translate([111.25, 128.75, body_size[2]+adj]) standoff(spacer_size); + } + // LCD panel + color([0.6, 0.6, 0.65]) + translate([10, 9, body_size[2]-lcd_size[2]]+lcd_clearance) + cube(lcd_size); + + // Front glass + // It's actually thinner and glued, but for the sake of simplicity... + color([0.2, 0.2, 0.2], 0.9) + translate([3, 1.25, body_size[2] + 0.01]) + slab(glass_size, rb); + + // view area + color("dimgrey", 0.9) + translate([14, 12.5, body_size[2] + glass_size[2]- 0.01]) + slab(view_size, .1); + + // PCB stub + color([0.1,0.1,0.1]) + translate([body_size[0]-25, body_size[1]-30, -2]) + cube([7,7,.1]); + color([0.1,0.1,0.1]) + translate([body_size[0]-50, body_size[1]-35, -2]) + cube([4,5,.1]); +} + +// ODROID M1 2.5" SATA HDD mounting kit +module m1_hdmount() { + $fn = 30; + dims = [89.6, 38.5, 2.0]; + holes = 4; + slots = [4.15, 3.3]; + standoff_style = [5, 16, 0, 3, 25, 0, 0, 1, 0, 0, 0]; + + color([0.2,0.2,0.2]) + difference() { + slab(dims, 4.0); + translate([ 3.1, 28.3, -1]) cylinder(d = holes, h = 4); + translate([ 86.5, 28.3, -1]) cylinder(d = holes, h = 4); + hull() { + translate([ 14.75, 10.15, -1]) cylinder(d=3.30, h=4); + translate([ 15.60, 10.15, -1]) cylinder(d=3.30, h=4); + } + hull() { + translate([ 75.60, 10.15, -1]) cylinder(d=3.30, h=4); + translate([ 76.45, 10.15, -1]) cylinder(d=3.30, h=4); + } + } + + color([0.6,0.6,0.6]) { + translate ([ 3.1, 28.3 , 0]) rotate([ 0,0,0]) standoff(standoff_style); + translate ([ 86.5, 28.3 , 0]) rotate([ 0,0,0]) standoff(standoff_style); + } + color([0.1,0.1,0.1]) { + translate ([ 3.1, 28.3 , 2]) rotate([ 0,0,0]) screw([3, 7, 0]); + translate ([ 86.5, 28.3 , 2]) rotate([ 0,0,0]) screw([3, 7, 0]); + + translate ([ 15.1, 10.15, 0]) rotate([180,0,0]) screw([3, 7, 0]); + translate ([ 76, 10.15, 0]) rotate([180,0,0]) screw([3, 7, 0]); + } + + // "HDD HOLDER" + color([0.9, 0.9, 0.9]) + translate([67,8,0]) rotate([180,0,180]) + linear_extrude(height=0.01) text("HDD HOLDER",5); +} + +/* hk speakers */ +module hk_speaker() { + + spk_x = 44; + spk_y = 20; + spk_z = 98; + c_hole = 6; + i_dia = c_hole+3; + adjust = .1; + + difference() { + translate([spk_x/2,spk_y/2,spk_z/2]) cube_fillet_inside([spk_x,spk_y,spk_z], + vertical=[0,0,0,0,0], top=[0,c_hole,0,c_hole], bottom=[0,c_hole,0,c_hole], $fn=90); + // speaker cone + translate([spk_x/2,-adjust,spk_z-72]) rotate([-90,0,0]) cylinder(d=36, h=.5); + + // corner holes + translate([(c_hole/2)+2,-adjust,(c_hole/2)+2]) rotate([-90,0,0]) + cylinder(d=c_hole, h=spk_y+(2*adjust)); + translate([(c_hole/2)+2,-adjust,spk_z-(c_hole/2)-2]) rotate([-90,0,0]) + cylinder(d=c_hole, h=spk_y+(2*adjust)); + translate([spk_x-(c_hole/2)-2,-adjust,spk_z-(c_hole/2)-2]) rotate([-90,0,0]) + cylinder(d=c_hole, h=spk_y+(2*adjust)); + translate([spk_x-(c_hole/2)-2,-adjust,(c_hole/2)+2]) rotate([-90,0,0]) + cylinder(d=c_hole, h=spk_y+(2*adjust)); + + // lower left corner indent + translate([(c_hole/2)+2,-adjust,(c_hole/2)+2]) rotate([-90,0,0]) + cylinder(d=i_dia, h=10+adjust); + translate([-adjust-1,-adjust,-adjust]) cube([c_hole+adjust,10+adjust,i_dia+adjust+.5]); + translate([adjust+.5,-adjust,-(i_dia/2)+adjust]) cube([i_dia+adjust,10+adjust,i_dia+adjust+.5]); + translate([(c_hole/2)+2,-adjust+12+adjust,(c_hole/2)+2]) rotate([-90,0,0]) + cylinder(d=i_dia, h=10+adjust); + translate([-adjust-1,-adjust+12+adjust,-adjust]) cube([c_hole+adjust,10+adjust,i_dia+adjust+.5]); + translate([adjust+.5,-adjust+12+adjust,-(i_dia/2)+adjust]) cube([i_dia+adjust,10+adjust,i_dia+adjust+.5]); + + // upper left corner corner indent + translate([(c_hole/2)+2,-adjust,spk_z-(c_hole/2)-2]) rotate([-90,0,0]) + cylinder(d=i_dia, h=10+adjust); + translate([-adjust-1,-adjust,spk_z-i_dia-.5]) cube([c_hole+adjust,10+adjust,i_dia+adjust+.5]); + translate([-adjust+.5,-adjust,spk_z-(i_dia/2)+adjust-.5]) cube([i_dia,10+adjust,i_dia+adjust+.5]); + translate([(c_hole/2)+2,-adjust+12,spk_z-(c_hole/2)-2]) rotate([-90,0,0]) + cylinder(d=i_dia, h=10+adjust); + translate([-adjust-1,-adjust+12,spk_z-i_dia-.5]) cube([c_hole+adjust,10+adjust,i_dia+adjust+.5]); + translate([-adjust+.5,-adjust+12,spk_z-(i_dia/2)+adjust-.5]) cube([i_dia,10+adjust,i_dia+adjust+.5]); + + // upper right corner corner indent + translate([spk_x-(c_hole/2)-2,-adjust,spk_z-(c_hole/2)-2]) rotate([-90,0,0]) + cylinder(d=i_dia, h=10+adjust); + translate([spk_x-1-(i_dia/2),-adjust,spk_z-i_dia+adjust-.5]) cube([c_hole+adjust,10+adjust,i_dia+adjust+.5]); + translate([spk_x-.5-i_dia,-adjust,spk_z-(i_dia/2)+adjust-.5]) cube([i_dia,10+adjust,i_dia+adjust+.5]); + translate([spk_x-(c_hole/2)-2,-adjust+12,spk_z-(c_hole/2)-2]) rotate([-90,0,0]) + cylinder(d=i_dia, h=10+adjust); + translate([spk_x-1-(i_dia/2),-adjust+12,spk_z-i_dia+adjust-.5]) cube([c_hole+adjust,10+adjust,i_dia+adjust+.5]); + translate([spk_x-.5-i_dia,-adjust+12,spk_z-(i_dia/2)+adjust-.5]) cube([i_dia,10+adjust,i_dia+adjust+.5]); + + // lower right corner corner indent + translate([spk_x-(c_hole/2)-2,-adjust,(c_hole/2)+2]) rotate([-90,0,0]) + cylinder(d=i_dia, h=10+adjust); + translate([spk_x-1-(i_dia/2),-adjust,-adjust]) cube([c_hole+adjust,10+adjust,i_dia+adjust+.5]); + translate([spk_x-.5-i_dia,-adjust,-(i_dia/2)+adjust]) cube([i_dia,10+adjust,i_dia+adjust+.5]); + translate([spk_x-(c_hole/2)-2,-adjust+12,(c_hole/2)+2]) rotate([-90,0,0]) + cylinder(d=i_dia, h=10+adjust); + translate([spk_x-1-(i_dia/2),-adjust+12,-adjust]) cube([c_hole+adjust,10+adjust,i_dia+adjust+.5]); + translate([spk_x-.5-i_dia,-adjust+12,-(i_dia/2)+adjust]) cube([i_dia,10+adjust,i_dia+adjust+.5]); + } + // speaker cone + translate([spk_x/2,-adjust+46,spk_z-72]) { + difference() { + translate([0,0,0]) sphere(d=96, $fn=180); + translate([-50,-46,-50]) cube([100,100,100]); + } + } + + } + + +/* hk boom bonnet */ +module hk_boom(speakers,orientation) { + + adjust = .01; + $fn = 90; + difference() { + union() { + color("tan") translate ([0,0,0]) slab([60,35,1.6],.5); + if(speakers == true) { + color("tan") translate ([-31.5,0,0]) slab([31.5,35,1.6],.5); + color("white") translate ([-0.25,0,0]) cube([.5,35,1.6]); + color("tan") translate ([60,0,0]) slab([31.5,35,1.6],.5); + color("white") translate ([60,0,0]) cube([.5,35,1.6]); + } + } + // pcb holes + color("tan") translate([3.5,3.5,-adjust]) cylinder(d=3,h=6); + color("tan") translate([3.5,31.5,-adjust]) cylinder(d=3,h=6); + color("tan") translate([56.5,3.5,-adjust]) cylinder(d=3,h=4); + color("tan") translate([56.5,31.5,-adjust]) cylinder(d=3,h=4); + if(speakers == true) { + // left + color("tan") translate([-28,3.5,-adjust]) cylinder(d=3,h=6); + color("tan") translate([-28,31.5,-adjust]) cylinder(d=3,h=6); + color("tan") translate([-3.5,3.5,-adjust]) cylinder(d=3,h=6); + color("tan") translate([-3.5,31.5,-adjust]) cylinder(d=3,h=6); + // right + color("tan") translate([64.5,3.5,-adjust]) cylinder(d=3,h=4); + color("tan") translate([64.5,31.5,-adjust]) cylinder(d=3,h=4); + color("tan") translate([88,3.5,-adjust]) cylinder(d=3,h=4); + color("tan") translate([88,31.5,-adjust]) cylinder(d=3,h=4); + // left speaker openings + color("tan") translate([-31.5/2,35/2,-adjust]) cylinder(d=23.5, h=3); + color("tan") translate([-4-31.5/2,35/2+(23.5/2)-.5,-adjust]) cube([6,3,3]); + color("tan") translate([-4-31.5/2,35/2-(23.5/2)-2.5,-adjust]) cube([6,3,3]); + color("tan") translate([-4-31.5/2+(23.5/2)+1,-2+35/2,-adjust]) cube([6,3,3]); + // right speaker openings + color("tan") translate([60+(31.5/2),35/2,-adjust]) cylinder(d=23.5, h=3); + color("tan") translate([60-3+31.5/2,35/2+(23.5/2)-.5,-adjust]) cube([6,3,3]); + color("tan") translate([60-3+31.5/2,35/2-(23.5/2)-2.5,-adjust]) cube([6,3,3]); + color("tan") translate([60+1.25,-2+35/2,-adjust]) cube([6,3,3]); + } + } + // headers + translate([7.5,3.5,1.6-adjust]) rotate([0,0,-90]) header(3); + translate([16,3.5,1.6-adjust]) rotate([0,0,-90]) header(7); + translate([34,2,1.6-adjust]) rotate([0,0,0]) encl_header_12(); + translate([40,13.5,1.6-adjust]) rotate([0,0,-90]) header(2); + translate([45.5,13.5,1.6-adjust]) rotate([0,0,-90]) header(2); + difference() { + union() { + color("dimgray", 1) translate([44.5,27,1.6+2]) rotate([0,0,0]) cylinder(d=16, h=3); + color("dimgray", 1) translate([44.5,27,1.6]) rotate([0,0,0]) cylinder(d=8, h=2); + } + color("dimgray", 1) translate([44.5,27,1.6+4]) rotate([0,0,0]) cylinder(d=12, h=3); + for(d=[5:10:360]) { + color("dimgray") translate([44.5+(16/2)*cos(d),27+(16/2)*sin(d),1.6+2-adjust]) cylinder(d=.75, h=3+2*adjust); + } + } + color("gray", 1) translate([45,27,1.6+4-adjust]) rotate([0,0,0]) cylinder(d=1.5, h=.25); + translate([3.75,13,1.6-adjust]) rotate([0,0,90]) micro2pin(); + translate([56.5,20.5,1.6-adjust]) rotate([0,0,-90]) micro2pin(); + translate([7.75,21.75,1.6-adjust]) audio_jack35(); + translate([20,30,1.6-adjust]) capacitor(6.25,6.5); + translate([30,30,1.6-adjust]) capacitor(6.25,6.5); + translate([22,16,1.6-adjust]) ic([6.5,4.5,1]); + translate([10,12,1.6-adjust]) ic([4,4,1]); + translate([32.5,9,1.6-adjust]) ic([3.5,3,1]); + if(speakers == true && orientation == "rear") { + translate([-31.5/2,35/2,1.6]) boom_speaker(); + translate([60+(31.5/2),35/2,1.6]) boom_speaker(); + } + if(speakers == true && orientation == "front") { + translate([-31.5/2,35/2,0]) rotate([0,180,0]) boom_speaker(); + translate([60+(31.5/2),35/2,0]) rotate([0,180,0]) boom_speaker(); + } +} + + +// hk stero boom bonnet speaker with board +module hk_boom_speaker(side,speaker,pcb) { + + adjust = .01; + $fn = 90; + + if(pcb == true) { + difference() { + color("tan") slab([31.5,35,1.6],.5); + color("tan") translate([27.5,4,-adjust]) cylinder(d=3,h=6); + color("tan") translate([27.5,31,-adjust]) cylinder(d=3,h=6); + color("tan") translate([4,4,-adjust]) cylinder(d=3,h=6); + color("tan") translate([4,31,-adjust]) cylinder(d=3,h=6); + + // speaker openings + color("tan") translate([(31.5/2),35/2,-adjust]) cylinder(d=23.5, h=3); + color("tan") translate([-3+31.5/2,35/2+(23.5/2)-.5,-adjust]) cube([6,3,3]); + color("tan") translate([-3+31.5/2,35/2-(23.5/2)-2.5,-adjust]) cube([6,3,3]); + if(side == "right") { + color("tan") translate([.5,-2+35/2,-adjust]) cube([6,3,3]); + } + if(side == "left") { + color("tan") translate([31.5/2+(23.5/2)-2.5,-2+35/2,-adjust]) cube([6,3,3]); + } + } + } + if(speaker == true && pcb == true) { + translate([(31.5/2),35/2,1.6]) boom_speaker(); + } + if(speaker == true && pcb == false) { + boom_speaker(); + } +} + + +// hk stero boom bonnet speakers +module boom_speaker() { + + adjust = .01; + $fn = 90; + difference() { + union() { + color("silver") translate([0,0,-8.5]) cylinder_fillet_inside(h=6.5, r=21.4/2, + top=0, bottom=2, $fn=90, fillet_fn=30, center=false); + color("dimgray") translate([0,0,2.5-adjust]) cylinder_fillet_inside(h=1, r=21.75/2, + top=1, bottom=0, $fn=90, fillet_fn=30, center=true); + + difference() { + color("black") translate([0,0,-5-adjust]) cylinder(d=23.7, h=5); + for(d=[30:60:360]) { + color("dimgray") translate([(23.7/2)*cos(d),(23.7/2)*sin(d),-6-adjust]) cylinder(d=6, h=5+2*adjust); + } + } + color("black") translate([0,0,-adjust]) cylinder(d=27.8, h=2); + color("dimgray") translate([0,0,1]) cylinder(d=22.8, h=1); + color("dimgray") translate([0,0,1]) cylinder(d=17.5, h=1.25); + } + color("darkgray") translate([0,0,10.5]) sphere(d=23); + } +} + + +// hk boom bonnet speaker grill +module hk_boom_grill(style,thick) { + + adjust = .01; + $fn = 90; + if(style == "dome" || style == "frame") { + difference() { + union() { + difference() { + translate([0,0,-23]) sphere(d=52.5); + translate([0,0,-25]) sphere(d=52.5); + translate([-30,-30,-60.5]) cube([60,60,60]); + for(c=[-14.5:3:24]) { + for(r=[-14.5:3:24]) { + translate([r,c,-1]) cube([2,2,40]); + } + } + } + if(style == "frame") { + difference() { + translate([0,0,-1.25]) cylinder(d=30.5, h=thick); + translate([0,0,-1.25-adjust]) cylinder(d=24, h=thick+2*adjust); + } + } + } + } + } + if(style == "flat") { + difference() { + translate([0,0,0]) cylinder(d=24.5, h=thick); + for(c=[-14.5:3:24]) { + for(r=[-14.5:3:24]) { + translate([r,c,-1]) cube([2,2,thick+2]); + } + } + } + } +} + + +// hk stero boom bonnet speaker holder +module boom_speaker_holder(style, tolerance) { + + adjust = .01; + $fn = 90; + + if(style == "friction") { + difference() { + translate([0,0,0]) cylinder(d=31, h=4); + translate([0,0,-adjust]) cylinder(d=28+tolerance, h=4+2*adjust); + translate([0,-1,-adjust]) cube([15,40,10], center=true); + } + difference() { + translate([0,0,0]) cylinder(d=28+tolerance, h=2); + translate([0,0,-adjust]) cylinder(d=28+tolerance-2, h=4+2*adjust); + translate([0,-1,-adjust]) cube([15,40,10], center=true); + } + } + + if(style == "clamp") { + // bottom clamp + topthick = 2; + top_height = 14; + difference() { + cube([10.5,29,top_height-topthick]); + // speaker holders + translate([-1,14.5,14]) rotate([0,90,0]) cylinder(d=28, h=4.5); + translate([2,14.5,14]) rotate([0,90,0]) cylinder(d=24, h=6); + translate([4,14.5,14]) rotate([0,90,0]) cylinder(d=21.9, h=7.8); + } + } +} + + +// hk stero boom bonnet speaker clamp holder top +module boom_speaker_strap(side) { + + topthick = 2; + top_height = 14; + adjust = .01; + $fn = 90; + // top clamp + difference() { + difference() { + union() { + translate([-3,14.5,top_height]) rotate([0,90,0]) cylinder(d=35,h=13.75); + if(side == "left") { + translate([5.4,16.5,top_height+(topthick/2)-1]) cube_fillet_inside([16.75,55,topthick], + vertical=[6,1,6,1], top=[0,0,0,0], bottom=[0,0,0,0], $fn=90); + } + if(side == "right") { + translate([5.4,13,top_height+(topthick/2)-1]) cube_fillet_inside([16.75,55,topthick], + vertical=[1,6,1,1], top=[0,0,0,0], bottom=[0,0,0,0], $fn=90); + } + translate([10.75-adjust,14.5,top_height]) rotate([0,90,0]) cylinder(d=35,h=3); + } + translate([-9.25,0,top_height-topthick-adjust]) cube([20,29,topthick]); + difference() { + translate([-4.25,14.5,14]) rotate([0,90,0]) cylinder(d=28, h=15); + translate([-5.25,0,19]) cube([20,30,19.5]); + } + } + // speaker holders + translate([-3-adjust,14.5,14]) rotate([0,90,0]) cylinder(d=30.8, h=4.5); + translate([-3-adjust,14.5,14]) rotate([0,90,0]) cylinder(d=32.8, h=2); + translate([-2.75,14.5,14]) rotate([0,90,0]) cylinder(d=28, h=14.5); + translate([-4.55,-4,-4]) cube([20,37,topthick+15]); + + if(side == "left") { + translate([4.15,-3.4,-adjust]) cylinder(d=3.2, h=50); + translate([4.15,-3.4,15]) cylinder(d=6, h=10); + translate([5.75,40,-adjust]) cylinder(d=3.2, h=50); + } + if(side == "right") { + translate([4.5,32.5,-adjust]) cylinder(d=3.2, h=50); + translate([4.5,32.5,15]) cylinder(d=6, h=10); + translate([10.5,-11,-adjust]) cylinder(d=3.2, h=50); + } + } +} + + +// hk stero boom bonnet volume ring +module boom_vring(tolerance) { + + out_dia = 22; + in_dia = 16.15 + tolerance; + thick = 3; + nub = 1.25; + adjust = .01; + $fn = 90; + difference() { + color("black") translate([0,0,0])cylinder(d=out_dia, h=thick); + color("dimgray") translate([0,0,-adjust]) cylinder(d=in_dia, h=thick+2*adjust); + for(d=[5:10:360]) { + color("dimgray") translate([(out_dia/2)*cos(d),(out_dia/2)*sin(d),-adjust]) cylinder(d=nub, h=thick+2*adjust); + } + } +} +// hk power button +module hk_pwr_button(mask = false) { + + adjust=.01; + $fn = 90; + + if(mask == true) { + color("silver") translate([0, 0, -19]) cylinder(h=20, d=16); + } + else { + difference() { + union() { + // light ring + difference() { + color("blue", .6) translate([0, 0, 1.67]) cylinder(h=.1, d=14.75); + color("blue", .6) translate([0, 0, 1.66]) cylinder(h=.2, d=13.75); + } + // power symbol + color("blue", .6) translate([-.5, 0, 1.65]) color("blue", .6) cube([1,3.5,.1]); + difference() { + color("blue", .6) translate([0, 0, 1.66]) cylinder(h=.1, d=5.75); + color("blue", .6) translate([0, 0, 1.65]) cylinder(h=.2, d=4.5); + color("blue", .6) translate([-1.75, 0, 1.65]) cube([3.5,4,2]); + } + // body + color("Gainsboro") cylinder(h=1.66, d1=17.75, d2=14.75); + color("silver") translate([0, 0, -19]) cylinder(h=19, d=15.8); + difference() { + color("steelblue") translate([0, 0, -27.9]) cylinder(h=9, d=15.8); + color("steelblue") translate([-1+15.8/2, -4, -19-9.1]) cube([2,8,6.1]); + color("steelblue") translate([-1-15.8/2, -4, -19-9.1]) cube([2,8,6.1]); + } + color("white") translate([-3.5, -6, -28]) cube([7,12,2]); + + // nut + difference() { + translate([0, 0, -4.75]) color("Gainsboro", .6) cylinder(h=2.75, d=21.5, $fn=6); + translate([0, 0, -4.75]) color("Gainsboro", .6) cylinder(h=2.75, d=15.8); + } + // connector pins + color("silver") translate([-1.4, -.5, -34.99]) cube([2.8, 1, 7]); + color("silver") translate([-1.4, -.5+5, -34.99]) cube([2.8, 1, 7]); + color("silver") translate([-1.4, -.5-5, -34.99]) cube([2.8, 1, 7]); + color("silver") translate([-1.4-1.75, -.5+1.75, -34.99]) cube([1, 2.8, 7]); + color("silver") translate([-1.4+3.5, -.5+1.75, -34.99]) cube([1, 2.8, 7]); + } + } + } +} + +// hk m1s ups +module hk_m1s_ups() { + + pcb_size = [115,32,1.62]; + + adj = .01; + $fn = 90; + + difference() { + union() { + color("#008066") slab(pcb_size,4); + color("#fee5a6") translate([3.5,3.5,-.1]) cylinder(d=5.5, h=pcb_size[2]+.2); + color("#fee5a6") translate([3.5,pcb_size[1]-3.5,-.1]) cylinder(d=5.5, h=pcb_size[2]+.2); + color("#fee5a6") translate([pcb_size[0]-3.5,3.5,-.1]) cylinder(d=5.5, h=pcb_size[2]+.2); + color("#fee5a6") translate([pcb_size[0]-3.5,pcb_size[1]-3.5,-.1]) cylinder(d=5.5, h=pcb_size[2]+.2); + } + color("#fee5a6") translate([3.5,3.5,-1]) cylinder(d=4, h=4); + color("#fee5a6") translate([3.5,pcb_size[1]-3.5,-1]) cylinder(d=4, h=4); + color("#fee5a6") translate([pcb_size[0]-3.5,3.5,-1]) cylinder(d=4, h=4); + color("#fee5a6") translate([pcb_size[0]-3.5,pcb_size[1]-3.5,-1]) cylinder(d=4, h=4); + } + // battery and clips + color("silver") translate([15,5,pcb_size[2]]) rotate([0,0,270]) battery_clip(); + color("silver") translate([80,16,pcb_size[2]]) rotate([0,0,90]) battery_clip(); + translate([13.25,10.5,pcb_size[2]+10.4]) rotate([0,90,0]) battery("18650_convex"); + + translate([86.75,.5,pcb_size[2]]) momentary45x15(); + translate([97.5,-1,pcb_size[2]]) usbc(); + + translate([35,28,pcb_size[2]]) led("DodgerBlue"); + translate([40,28,pcb_size[2]]) led("DodgerBlue"); + translate([45,28,pcb_size[2]]) led("DodgerBlue"); + translate([50,28,pcb_size[2]]) led("DodgerBlue"); + + translate([113,8,pcb_size[2]]) rotate([0,0,90]) led("green"); + translate([113,16,pcb_size[2]]) rotate([0,0,90]) led(); + translate([113,21,pcb_size[2]]) rotate([0,0,90]) led(); + + translate([78,29,pcb_size[2]]) rotate([0,0,270])header(7); + translate([78,31.5,pcb_size[2]]) rotate([0,0,270])header(7); +} + + +// prototype board, ups footprint +module proto_ups() { + + pcb_size = [115,32,1.62]; + + adj = .01; + $fn = 90; + + union() { + difference() { + union() { + color("#008066") slab(pcb_size,4); + color("#fee5a6") translate([3.5,3.5,-.1]) cylinder(d=5.5, h=pcb_size[2]+.2); + color("#fee5a6") translate([3.5,pcb_size[1]-3.5,-.1]) cylinder(d=5.5, h=pcb_size[2]+.2); + color("#fee5a6") translate([pcb_size[0]-3.5,3.5,-.1]) cylinder(d=5.5, h=pcb_size[2]+.2); + color("#fee5a6") translate([pcb_size[0]-3.5,pcb_size[1]-3.5,-.1]) cylinder(d=5.5, h=pcb_size[2]+.2); + } + color("#fee5a6") translate([3.5,3.5,-1]) cylinder(d=4, h=4); + color("#fee5a6") translate([3.5,pcb_size[1]-3.5,-1]) cylinder(d=4, h=4); + color("#fee5a6") translate([pcb_size[0]-3.5,3.5,-1]) cylinder(d=4, h=4); + color("#fee5a6") translate([pcb_size[0]-3.5,pcb_size[1]-3.5,-1]) cylinder(d=4, h=4); + } + // pads + for(r=[5:2.54:30]) { + translate([10,r,pcb_size[2]+adj]) pcb_pad(38); + } + } +} + + +// prototype board, m1s footprint +module proto_m1s() { + + pcb_size = [90,65,1.62]; + + adj = .01; + $fn = 90; + + union() { + difference() { + union() { + color("#008066") slab(pcb_size,2); + color("#fee5a6") translate([3.5,3.5,-.1]) cylinder(d=4.5, h=pcb_size[2]+.2); + color("#fee5a6") translate([pcb_size[0]-3.5,3.5,-.1]) cylinder(d=4.5, h=pcb_size[2]+.2); + color("#fee5a6") translate([17.5,52.5,-.1]) cylinder(d=4.5, h=pcb_size[2]+.2); + color("#fee5a6") translate([67.5,55.1,-.1]) cylinder(d=4.5, h=pcb_size[2]+.2); + } + color("#fee5a6") translate([3.5,3.5,-1]) cylinder(d=3, h=4); + color("#fee5a6") translate([pcb_size[0]-3.5,3.5,-1]) cylinder(d=3, h=4); + color("#fee5a6") translate([17.5,52.5,-1]) cylinder(d=3, h=4); + color("#fee5a6") translate([67.5,55.1,-1]) cylinder(d=3, h=4); + } + // pads + for(r=[7:2.54:32]) { + translate([10,r,pcb_size[2]+adj]) pcb_pad(28); + } + } +} + +module hk_m1s_case_holes(type="landscape") { + + if(type == "portrait") { + cylinder(d=3, h=6); + translate([0,107,0]) cylinder(d=3, h=6); + translate([58,0,0]) cylinder(d=3, h=6); + translate([58,107,0]) cylinder(d=3, h=6); + } + else { + cylinder(d=3, h=6); + translate([0,58,0]) cylinder(d=3, h=6); + translate([107,0,0]) cylinder(d=3, h=6); + translate([107,58,0]) cylinder(d=3, h=6); + } +} + diff --git a/lib/pcb_pad.scad b/lib/pcb_pad.scad new file mode 100644 index 0000000..5710fdb --- /dev/null +++ b/lib/pcb_pad.scad @@ -0,0 +1,30 @@ +/* + pcb_pad(pads = 1, style = "round") + +*/ + +// single row pcb pad +module pcb_pad(pads = 1, style = "round") { + + adjust = .01; + $fn = 90; + pad_size = 1.25; + size_y = 2.54; + size_x = 2.54 * (pads-1); + union() { + for (i=[0:2.54:size_x]) { + if(style == "round") { + difference() { + 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); + } + } + if(style == "square") { + difference() { + 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); + } + } + } + } +} diff --git a/lib/shape.scad b/lib/shape.scad new file mode 100644 index 0000000..99cae1d --- /dev/null +++ b/lib/shape.scad @@ -0,0 +1,163 @@ +/* + + slab(size, radius) + slab_r(size, radius) + slot(hole,length,depth) + punchout(width,depth,gap,thick,fillet,shape) + hdmi_open(hdmi_style) + microusb_open() + +*/ + +/* slab module */ +module slab(size, radius) { + + x = size[0]; + y = size[1]; + z = size[2]; + linear_extrude(height=z) + hull() { + translate([0+radius ,0+radius, 0]) circle(r=radius); + translate([0+radius, y-radius, 0]) circle(r=radius); + translate([x-radius, y-radius, 0]) circle(r=radius); + translate([x-radius, 0+radius, 0]) circle(r=radius); + } +} + + +/* multi-radius round slab */ +module slab_r(size, radius) { + + x = size[0]; + y = size[1]; + z = size[2]; + r0 = radius[0]; + r1 = radius[1]; + r2 = radius[2]; + r3 = radius[3]; + + linear_extrude(height=z) + hull() { + translate([0+radius[0] ,0+radius[0], 0]) circle(r=radius[0]); + translate([0+radius[1], y-radius[1], 0]) circle(r=radius[1]); + translate([x-radius[2], y-radius[2], 0]) circle(r=radius[2]); + translate([x-radius[3], 0+radius[3], 0]) circle(r=radius[3]); + } +} + + +/* slot module */ +module slot(hole,length,depth) { + + hull() { + translate([0,0,0]) cylinder(d=hole,h=depth); + translate([length,0,0]) cylinder(d=hole,h=depth); + } + } + +// punchout opening +module punchout(width,depth,gap,thick,fillet,shape) { + + adjust = .01; + $fn=90; + + // slot punchout + if(shape == "slot") { + difference() { + translate([0,0,0]) slot(depth,width,thick); + translate([0,0,-adjust]) slot(depth-gap,width,thick+(2*adjust)); + // cross ties + translate([-1,-(depth/2)-1,-adjust]) cube([2,depth+2,thick+(2*adjust)]); + translate([(width/2)-1-(width/4)+4,-(depth/2)-1,-adjust]) cube([2,depth+2,thick+(2*adjust)]); + translate([(width/2)-1+(width/4)-4,-(depth/2)-1,-adjust]) cube([2,depth+2,thick+(2*adjust)]); + translate([width-1,-(depth/2)-1,-adjust]) cube([2,depth+2,thick+(2*adjust)]); + } + } + if(shape == "rectangle") { + difference() { + translate([(width/2),(depth/2),thick/2]) + cube_fillet_inside([width,depth,thick], + vertical=[fillet,fillet,fillet,fillet], + top=[0,0,0,0], bottom=[0,0,0,0], $fn=90); + translate([(width/2),(depth/2),(thick/2)-adjust]) + cube_fillet_inside([width-gap,depth-gap,thick+(3*adjust)], + vertical=[fillet,fillet,fillet,fillet], + top=[0,0,0,0], bottom=[0,0,0,0], $fn=90); + // cross ties + translate([-1,(depth/2)-1,-adjust]) cube([gap+2,2,thick+(2*adjust)]); + translate([width-4,depth-gap-1,-adjust]) cube([2,gap+2,thick+(2*adjust)]); + translate([2,depth-gap-1,-adjust]) cube([2,gap+2,thick+(2*adjust)]); + translate([width-gap-1,(depth/2)-1,-adjust]) cube([gap+2,2,thick+(2*adjust)]); + translate([width-4,-1,-adjust]) cube([2,gap+2,thick+(2*adjust)]); + translate([2,-1,-adjust]) cube([2,gap+2,thick+(2*adjust)]); + } + } + if(shape == "round") { + difference() { + translate([(width/2),(width/2),0]) + cylinder(d=width, h=thick); + translate([(width/2),(width/2),-adjust]) + cylinder(d=width-gap, h=thick+2*adjust); + // cross ties + translate([-1,(depth/2)-1,-adjust]) cube([gap+2,2,thick+(2*adjust)]); + translate([(width/2)-1,depth-gap-1,-adjust]) cube([2,gap+2,thick+(2*adjust)]); + translate([width-gap-1,(depth/2)-1,-adjust]) cube([gap+2,2,thick+(2*adjust)]); + translate([(width/2)-1,-1,-adjust]) cube([2,gap+2,thick+(2*adjust)]); + } + } + } + +/* hdmi opening */ +module hdmi_open(hdmi_style) { + + if(hdmi_style == "hdmi_a") { + union() { + difference() { + translate([0,-5,1.25]) cube([15.5,8,5.75]); + translate([0.5,-5.2,.5]) rotate ([-90,0,0]) cylinder(d=3, h=13.5,$fn=30); + translate([15,-5.2,.5]) rotate ([-90,0,0]) cylinder(d=3, h=13.5,$fn=30); + } + translate([1.75,-5,.5]) cube([12, 8, 1]); + } + } + if(hdmi_style == "hdmi_micro") { + union() { + difference() { + translate([-.25,-6,-.01]) cube([7,8,3.15]); + translate([-.25,-6.2,0]) rotate ([-90,0,0]) cylinder(d=1.5, h=9.5,$fn=30); + translate([6.75,-6.2,0]) rotate ([-90,0,0]) cylinder(d=1.5, h=9.5,$fn=30); + } + } + } + if(hdmi_style == "hdmi_mini") { + union() { + difference() { + translate([-.25,-6,-.01]) cube([11.5,8,3.5]); + translate([-1,-6.2,-.5]) rotate ([-90,0,0]) cylinder(d=3, h=10,$fn=30); + translate([12.25,-6.2,-.5]) rotate ([-90,0,0]) cylinder(d=3, h=10,$fn=30); + } + } + } + if(hdmi_style=="dp_mini") { + size_x = 9; + size_y = 8; + union() { + difference() { + translate([-.25,-6,0]) cube([size_x, size_y, 5.75]); + translate([-7.5,-7,1]) rotate([0,45,0]) cube([size_x, size_y+2, 5.6]); + translate([10,-7,-5]) rotate([0,-45,0]) cube([size_x, size_y+2, 5.6]); + } + } + } +} + + +/* micro-usb opening */ +module microusb_open() { + + translate([0,0,.5])rotate([90,0,0]) + hull() { + translate([6,1.5,-5]) cylinder(d=3.5,h=12); + translate([1,1.5,-5]) cylinder(d=3.5,h=12); + } +} diff --git a/lib/standoff.scad b/lib/standoff.scad new file mode 100644 index 0000000..1a0168e --- /dev/null +++ b/lib/standoff.scad @@ -0,0 +1,97 @@ +/* + + standoff(standoff[radius,height,holesize,supportsize,supportheight,sink,style,i_dia,i_depth]) + +*/ + +/* standoff module + standoff(standoff[radius,height,holesize,supportsize,supportheight,sink,style,reverse,insert_e,i_dia,i_depth]) + sink=0 none + sink=1 countersink + sink=2 recessed hole + sink=3 nut holder + sink=4 blind hole + + style=0 hex shape + style=1 cylinder +*/ +module standoff(stand_off){ + + radius = stand_off[0]; + height = stand_off[1]; + holesize = stand_off[2]; + supportsize = stand_off[3]; + supportheight = stand_off[4]; + sink = stand_off[5]; + style = stand_off[6]; + reverse = stand_off[7]; + insert_e = stand_off[8]; + i_dia = stand_off[9]; + i_depth = stand_off[10]; + + adjust = 0.1; + + difference (){ + union () { + if(style == 0 && reverse == 0) { + rotate([0,0,30]) cylinder(d=radius*2/sqrt(3),h=height,$fn=6); + } + if(style == 0 && reverse == 1) { + translate([0,0,-height]) rotate([0,0,30]) cylinder(d=radius*2/sqrt(3),h=height,$fn=6); + } + if(style == 1 && reverse == 0) { + cylinder(d=radius,h=height,$fn=90); + } + if(style == 1 && reverse == 1) { + translate([0,0,-height]) cylinder(d=radius,h=height,$fn=90); + } + if(reverse == 1) { + translate([0,0,-supportheight]) cylinder(d=(supportsize),h=supportheight,$fn=60); + } + else { + cylinder(d=(supportsize),h=supportheight,$fn=60); + } + } + // hole + if(sink <= 3 && reverse == 0) { + translate([0,0,-adjust]) cylinder(d=holesize, h=height+(adjust*2),$fn=90); + } + if(sink <= 3 && reverse == 1) { + translate([0,0,-adjust-height]) cylinder(d=holesize, h=height+(adjust*2),$fn=90); + } + // countersink hole + if(sink == 1 && reverse == 0) { + translate([0,0,-adjust]) cylinder(d1=6.5, d2=(holesize), h=3); + } + if(sink == 1 && reverse == 1) { + translate([0,0,+adjust-2.5]) cylinder(d1=(holesize), d2=6.5, h=3); + } + // recessed hole + if(sink == 2 && reverse == 0) { + translate([0,0,-adjust]) cylinder(d=6.5, h=3); + } + if(sink == 2 && reverse == 1) { + translate([0,0,+adjust-3]) cylinder(d=6.5, h=3); + } + // nut holder + if(sink == 3 && reverse == 0) { + translate([0,0,-adjust]) cylinder(r=3.3,h=3,$fn=6); + } + if(sink == 3 && reverse == 1) { + translate([0,0,+adjust-3]) cylinder(r=3.3,h=3,$fn=6); + } + // blind hole + if(sink == 4 && reverse == 0) { + translate([0,0,2]) cylinder(d=holesize, h=height,$fn=90); + } + if(sink == 4 && reverse == 1) { + translate([0,0,-height-2-adjust]) cylinder(d=holesize, h=height,$fn=90); + } + if(insert_e > 0 && reverse == 0) { + translate([0,0,height-i_depth]) cylinder(d=i_dia, h=i_depth+adjust,$fn=90); + } + if(insert_e > 0 && reverse == 1) { + translate([0,0,-height-adjust]) cylinder(d=i_dia, h=i_depth+adjust,$fn=90); + } + } +} diff --git a/lib/vent.scad b/lib/vent.scad new file mode 100644 index 0000000..c6dc8ee --- /dev/null +++ b/lib/vent.scad @@ -0,0 +1,87 @@ +/* + + vent_hex(cells_x, cells_y, thickness, cell_size, cell_spacing, orientation) + vent_panel_hex(x, y, thick, cell_size, cell_spacing, border, borders); + +*/ + +// vent opening +module vent(width,length,height,gap,rows,columns,orientation) { + + fillet = width/2; + adjust = .01; + $fn=90; + + // vertical orientation + if(orientation == "vertical") { rotate([90,0,0]) + for (r=[0:length+gap:rows*(length+gap)-1]) { + for (c=[0:width+(2*gap):(columns*(width+(2*gap)))-1]) { + translate ([c,r,-1]) cube([width,length,height]); + } + } + } + // horizontal orientation + if(orientation == "horizontal") { + for (r=[0:length+(2*gap):rows*(length+gap)]) { + for (c=[0:width+(2*gap):(columns*(width+(2*gap)))-1]) { + translate ([c,r,-1]) cube([width,length,height]); + } + } + } +} + +// Hex vent opening +module vent_hex(cells_x, cells_y, thickness, cell_size, cell_spacing, orientation) { + xs = cell_size + cell_spacing; + ys = xs * sqrt(3/4); + rot = (orientation=="vertical") ? 90 : 0; + + rotate([rot,0,0]) translate([cell_size/2, cell_size*sqrt(1/3),-1]) { + for (ix = [0 : ceil(cells_x/2)-1]) { + for (iy = [0 : 2 : cells_y-1]) { + translate([ix*xs, iy*ys,0]) rotate([0,0,90]) + cylinder(r=cell_size/sqrt(3), h=thickness, $fn=6); + } + } + for (ix = [0 : (cells_x/2)-1]) { + for (iy = [1 : 2 : cells_y-1]) { + translate([(ix+0.5)*xs, iy*ys,0]) rotate([0,0,90]) + cylinder(r=cell_size/sqrt(3), h=thickness, $fn=6); + } + } + } +} + + + +/* hex vent panel */ +// borders: +// y - specified size along y axis +// x - specified size along x axis +// none - both borders the size of cell_spacing, no mounting holes +// anything else ("default") - all borders of specified size +// +module vent_panel_hex(x, y, thick, cell_size=8, cell_spacing=3, border=3, borders="default") { + hole = 3.2; + xb = (borders == "y" || borders == "none") ? cell_spacing : border; + yb = (borders == "x" || borders == "none") ? cell_spacing : border; + hxb = max(yb/2, cell_spacing + hole); + hyb = max(xb/2, cell_spacing + hole); + + cells_x = floor((2*(x-2*xb-cell_size)/(cell_size+cell_spacing))+1); + cells_y = floor(((sqrt(12)*(y-2*yb)-4*cell_size)/(3*(cell_size+cell_spacing)))+1); + csx = cell_size + (cells_x-1)*(cell_size+cell_spacing)/2; + csy = sqrt(4/3)*cell_size + ((cell_size+cell_spacing)*sqrt(3/4)*(cells_y-1)); + + difference() { + color("grey",1) slab([x,y,thick],2); + color("grey",1) translate([(x-csx)/2,(y-csy)/2,-1]) + vent_hex(cells_x, cells_y, thick+3, cell_size, cell_spacing, "horizontal"); + if (borders != "none") { + color("grey",1) translate([ hxb, hyb, -1]) cylinder(d=hole, h=thick+3); + color("grey",1) translate([x - hxb, hyb, -1]) cylinder(d=hole, h=thick+3); + color("grey",1) translate([ hxb, y - hyb, -1]) cylinder(d=hole, h=thick+3); + color("grey",1) translate([x - hxb, y - hyb, -1]) cylinder(d=hole, h=thick+3); + } + } +} diff --git a/mod/add.scad b/mod/add.scad new file mode 100644 index 0000000..f26ab24 --- /dev/null +++ b/mod/add.scad @@ -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); + } +} diff --git a/mod/case_bottom.scad b/mod/case_bottom.scad new file mode 100644 index 0000000..4a81c08 --- /dev/null +++ b/mod/case_bottom.scad @@ -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); + } + } + } +} diff --git a/mod/case_side.scad b/mod/case_side.scad new file mode 100644 index 0000000..dc87abc --- /dev/null +++ b/mod/case_side.scad @@ -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); + } + } + } +} diff --git a/mod/case_top.scad b/mod/case_top.scad new file mode 100644 index 0000000..cc06b80 --- /dev/null +++ b/mod/case_top.scad @@ -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); + } + } + } +} diff --git a/lib/fillets.scad b/mod/fillets.scad similarity index 100% rename from lib/fillets.scad rename to mod/fillets.scad diff --git a/mod/indent.scad b/mod/indent.scad new file mode 100644 index 0000000..e3923fe --- /dev/null +++ b/mod/indent.scad @@ -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); + } +} diff --git a/mod/parametric_move.scad b/mod/parametric_move.scad new file mode 100644 index 0000000..0f54ebd --- /dev/null +++ b/mod/parametric_move.scad @@ -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); + } + } +} diff --git a/mod/place.scad b/mod/place.scad new file mode 100644 index 0000000..eb25114 --- /dev/null +++ b/mod/place.scad @@ -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]); +} diff --git a/mod/sub.scad b/mod/sub.scad new file mode 100644 index 0000000..98d1c20 --- /dev/null +++ b/mod/sub.scad @@ -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); + } +} diff --git a/sbc_case_builder.scad b/sbc_case_builder.scad index 76c72e8..76340fa 100644 --- a/sbc_case_builder.scad +++ b/sbc_case_builder.scad @@ -15,52 +15,13 @@ Code released under GPLv3: http://www.gnu.org/licenses/gpl.html 20220202 Version 1.0.0 sbc case builder using sbc model framework. - 20220206 Version 1.0.1 added tray-vu7 case style, other fixes. - 20220212 Version 1.1.0 implemented sbc_case_builder.cfg config file, - sbc_case_builder_library.scad and basic accessory framework. - adjusted tray-vu7 tabs, adjusted tray-vu7 model alignment - minor fixes and other maintenance. - 20220220 Version 1.1.1 added .cfg commands add1,add2,model,platter - schema changes, extended standoff fixes, hd mounting acc. - acc. placement and other minor fixes, added raise_top setting. - 20220227 Version 1.1.2 added sbc_off setting, fixed hdmi bottom placement - schema change, extended standoff detection, hd vertical mount, oled holder - access port, access cover, case feet and other fixes. - 20220306 Version 1.1.3 added netcard, buttons, parametric access_port, other fixes and maintenance - 20220312 Version 1.2.0 added fillet array, button cutout style, hk_lcd35, other fixes and maintenance - 20220320 Version 1.2.1 added hk_boom bonnet model and accessories, hk_uart model, fixed uart opening, - enabled pcb_z, added tabs and fixed tray case top, other fixes and maintenance - 20220406 Version 1.2.2 added vu7c, vu8m and weatherboard2 models, other additions, - fixes and maintenance. - 20220515 Version 1.2.3 added odroid-m1, jetson nano, rockpro64, completed mask(), improved docs - changed tray top design. - 20221005 Version 2.0.0 full customizer user interface,case configuration file changed to json, - accessories kept in sbc_case_builder_accessories.cfg, - added round, hexagon, snap and fitted cases, setup additional sbc from - SBC_Model_Framework, added components and masks, added multi-associative - parametric positioning for accessories, added individual variable height - sbc standoffs, added cutaway view when case face is not movable, finished - indents for select components and orientations. - 20221011 Version 2.0.1 adjusted cases and accessories, updated README.md and SBC_Case_Builder_Cases.gif - 20221101 Version 2.0.2 updated sbc model framework, h3/h3+ model and rockpi5b adjustments - 20221207 Version 2.0.3 added part view to facilitate individual part prints, updated sbc model framework, - added n2l and m1 cases - 20231110 Version 2.0.4 fixed standoff sidewall support misplacement on sbc move, fixed standoff auto - opening z height, fixed case top right side standoffs support, - fixed access_port and access_cover 180 rotation in portrait and landscape, - adjusted jack_3.5 and hdmi_a_vertical opening, change radxa rockpi to rock, - changed visionfive2 tray design bottom screw locations, updated sbc model framework. - 20231115 Version 2.0.5 added hex vent and new component openings, updated sbc model framework - 20231211 Version 2.0.6 added 5mm and 8mm hex vent, added three m1s cases, updated sbc model framework, - fixed snap top protrusion placement and other fixes. see https://github.com/hominoids/SBC_Case_Builder */ -use <./SBC_Model_Framework/sbc_models.scad>; -use <./sbc_case_builder_library.scad>; -use <./lib/fillets.scad>; -include <./SBC_Model_Framework/sbc_models.cfg>; +use <./SBC_Model_Framework_v2/sbc_models.scad>; +include <./sbc_case_builder_library.scad>; +include <./SBC_Model_Framework_v2/sbc_models.cfg>; include <./sbc_case_builder_accessories.cfg>; /* [View] */ @@ -86,13 +47,13 @@ move_front = 0; // [-1:100] // move rear mm in model view or < 0 = off move_rear = 0; // [-1:100] -/* [Adjustments] */ +/* [adjments] */ // base case design case_design = "shell"; // [shell,panel,stacked,tray,round,hex,snap,fitted] // base case style case_style = "none"; // ["none","vu5","vu7","sides"] // single board computer model -sbc_model = "c1+"; // ["c1+", "c2", "c4", "xu4", "xu4q", "mc1", "hc1", "n1", "n2", "n2+", "n2+_noheatsink", "n2l", "n2lq", "m1", "m1_noheatsink", "m1s", "h2", "h3", "hc4", "show2", "rpizero", "rpizero2w", "rpi1a+", "rpi1b+", "rpi3a+", "rpi3b", "rpi3b+", "rpi4b", "rpi5", "rpi5_noheatsink", "a64", "rock64", "rockpro64", "quartz64a", "quartz64b", "h64b", "star64", "atomicpi", "jetsonnano", "rock4b+", "rock4c", "rock4c+", "rock5b-v1.3", "rock5b-v1.42", "rock5bq-v1.42", "vim1", "vim2", "vim3", "vim3l", "vim4", "tinkerboard", "tinkerboard-s", "tinkerboard-2", "tinkerboard-r2", "opizero", "opizero2", "opir1plus_lts", "opir1", "opi5", "licheerv+dock", "visionfive2", "visionfive2q"] +sbc_model = "c1+"; // ["c1+", "c2", "c4", "hc4", "xu4", "xu4q", "mc1", "hc1", "n1", "n2", "n2+", "n2l", "n2lq", "m1", "m1s", "h2", "h2+", "h3", "h3+", "show2", "rpipico", "rpipicow", "rpicm4+ioboard", "rpicm1", "rpicm3", "rpicm3l", "rpicm3+", "rpicm4s", "rpicm4", "rpicm4l", "rpizero", "rpizerow", "rpizero2w", "rpi1a+", "rpi1b+", "rpi2b", "rpi3a+", "rpi3b", "rpi3b+", "rpi4b", "rpi5", "rock64", "rockpro64", "quartz64a", "quartz64b", "h64b", "star64", "rock4a", "rock4b", "rock4a+", "rock4b+", "rock4c", "rock4c+", "rock5b-v1.3", "rock5b", "rock5bq", "vim1", "vim2", "vim3", "vim3l", "vim4", "tinkerboard", "tinkerboard-s", "tinkerboard-2", "tinkerboard-2s", "tinkerboard-r2", "tinkerboard-r2s", "opizero", "opizero2", "opir1plus_lts", "opir1", "opi5", "jetsonnano", "lepotato", "sweetpotato", "tritium-h2+", "tritium-h3", "tritium-h5", "solitude", "alta", "atomicpi", "visionfive2", "licheerv+dock", "rak19007"] // sbc location x axis pcb_loc_x = 0; //[0:.5:300] // sbc location y axis @@ -178,11 +139,16 @@ accessory_name = "none"; // ["none", "hk_uart", "c1+_shell_boombox", "c1+_panel_ a = search([accessory_name],accessory_data); s = search([sbc_model],sbc_data); -pcb_width = sbc_data[s[0]][1]; -pcb_depth = sbc_data[s[0]][2]; -pcb_z = sbc_data[s[0]][3]; -pcb_tmaxz = sbc_data[s[0]][5]; -pcb_bmaxz = sbc_data[s[0]][6]; +pcb_id = sbc_data[s[0]][4]; +pcb_width = sbc_data[s[0]][10][0]; +pcb_depth = sbc_data[s[0]][10][1]; +pcb_z = sbc_data[s[0]][10][2]; +pcb_tmaxz = sbc_data[s[0]][11][5]; +pcb_bmaxz = sbc_data[s[0]][11][6]; +pcb_color = sbc_data[s[0]][11][1]; +pcb_radius = sbc_data[s[0]][11][0]; + +echo(pcb_id, pcb_width, pcb_depth, pcb_z, pcb_tmaxz, pcb_bmaxz, pcb_color, pcb_radius); width = pcb_width+2*(wallthick+gap)+case_offset_x; depth = pcb_depth+2*(wallthick+gap)+case_offset_y; @@ -194,7 +160,7 @@ hex_diameter = sqrt(pow(width+2*(wallthick+gap),2)+pow(depth+2*(wallthick+gap),2 /* [Hidden] */ -adjust = .01; +adj = .01; $fn=90; case_fn = 360; // circle segments for round cases case_ffn = 90; // circle segments for fillet of round cases @@ -309,7 +275,7 @@ if (view == "model") { cube([gap+wallthick+1.01,depth+2,case_z+2]); } if(move_rightside < 0) { - translate([width-gap-(2*wallthick)-adjust,-gap-wallthick-1,-lower_bottom]) + translate([width-gap-(2*wallthick)-adj,-gap-wallthick-1,-lower_bottom]) cube([gap+wallthick,depth+2,case_z+2]); } } @@ -333,7 +299,7 @@ if (view == "model") { cube([gap+wallthick+1.01,depth+2,case_z+2]); } if(move_rightside < 0) { - translate([width-gap-(2*wallthick)-adjust,-gap-wallthick-1,raise_top]) + translate([width-gap-(2*wallthick)-adj,-gap-wallthick-1,raise_top]) cube([gap+wallthick,depth+2,case_z+2]); } } @@ -667,2569 +633,4 @@ if (view == "part") { else { echo(width=width,depth=depth,top=top_height,bottom=bottom_height); } -} - - -// 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-adjust,0]) - cube([8,wallthick+2*adjust,floorthick]); - translate([width-(width*(1/5))-(wallthick+gap),depth-(2*wallthick)-gap-adjust,0]) - cube([8,wallthick+2*adjust,floorthick]); - translate([(width*(1/5))-8-(wallthick+gap),-wallthick-gap+adjust,0]) - cube([8,wallthick+2*adjust,floorthick]); - translate([width-(width*(1/5))-(wallthick+gap),-wallthick-gap+adjust,0]) - cube([8,wallthick+2*adjust,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+adjust], - 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+adjust,wallthick+gap+10, - floorthick+3.4]) rotate([90,0,90]) - cylinder(d=10, h=4, $fn=6); - // left side nut - translate([-adjust-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+adjust,depth-wallthick-gap-10, - floorthick+3.4]) rotate([90,0,90]) cylinder(d=10, h=4, $fn=6); - translate([-adjust-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+adjust,wallthick+gap+58, - floorthick+3.4]) rotate([90,0,90]) cylinder(d=10, h=4, $fn=6); - translate([-adjust-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+adjust,wallthick+gap+40, - floorthick+3.4]) rotate([90,0,90]) cylinder(d=10, h=4, $fn=6); - translate([-adjust-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-adjust]) - rotate([0,0,0]) cube([width,wallthick,top_height]); - } - else { - translate([-wallthick-gap,depth-(2*wallthick)-gap,bottom_height-adjust]) - rotate([0,0,0]) cube([width,wallthick,top_height-floorthick]); - } - - // rear panel - translate([-wallthick-gap,-wallthick-gap,bottom_height-adjust]) - 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+adjust, 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+adjust, 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*adjust, 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+adjust+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,-adjust]) - cube([width+10,300,case_z-2*floorthick-2]); - translate([width-9,(depth/2)-62.5,bottom_height-2*adjust]) - cube([20,110,top_height-2*floorthick-2]); - } - else { - translate([-width/2,0,-adjust]) - cube([300,depth+100,case_z-2*floorthick-2]); - translate([(-width+50)/2,-50,bottom_height-2*adjust]) - cube([width+50,50+adjust,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+adjust,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+adjust,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*adjust,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+adjust+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,-adjust]) - cube([width+10,300,case_z-2*floorthick-2]); - translate([width-9,(depth/2)-62.5,bottom_height-2*adjust]) - 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+adjust,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+adjust,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*adjust,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+adjust+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,-adjust]) - cube([300,depth+100,case_z-2*floorthick-2]); - translate([(-width+50)/2,-50,bottom_height-2*adjust]) - cube([width+50,50+adjust,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+adjust,depth+adjust,lip+adjust], - 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+adjust], - 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-adjust,wallthick+gap+10, - floorthick+3.4]) rotate([0,90,0]) cylinder(d=3, h=10+sidethick+(2*adjust)); - // 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-adjust,wallthick+gap+10,floorthick+3.4]) rotate([0,90,0]) - cylinder(d=3, h=10+sidethick+(2*adjust)); - // 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-adjust,depth-wallthick-gap-10, - floorthick+3.4]) rotate([0,90,0]) - cylinder(d=3, h=10+sidethick+(2*adjust)); - translate([-wallthick-gap-adjust-6,depth-wallthick-gap-10, - floorthick+3.4]) rotate([0,90,0]) - cylinder(d=3, h=10+sidethick+(2*adjust)); - 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)-adjust,wallthick+gap+58, - floorthick+3.4]) rotate([0,90,0]) - cylinder(d=3, h=10+sidethick+(2*adjust)); - translate([-wallthick-gap-adjust-6,wallthick+gap+58, - floorthick+3.4]) rotate([0,90,0]) - cylinder(d=3, h=10+sidethick+(2*adjust)); - 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)-adjust,wallthick+gap+40, - floorthick+3.4]) rotate([0,90,0]) cylinder(d=3, h=10+sidethick+(2*adjust)); - translate([-wallthick-gap-adjust-6,wallthick+gap+40, - floorthick+3.4]) rotate([0,90,0]) cylinder(d=3, h=10+sidethick+(2*adjust)); - 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=[7:3:16]) { - pcb_hole_x = sbc_data[s[0]][i]+pcb_loc_x; - pcb_hole_y = sbc_data[s[0]][i+1]+pcb_loc_y; - pcb_hole_size = sbc_data[s[0]][i+2]; - if (pcb_hole_x!=0 && pcb_hole_y!=0) { - 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=[7:3:16]) { - pcb_hole_x = sbc_data[s[0]][i]+pcb_loc_x; - pcb_hole_y = sbc_data[s[0]][i+1]+pcb_loc_y; - pcb_hole_size = sbc_data[s[0]][i+2]; - if(pcb_hole_x!=0 && pcb_hole_y!=0) { - if (i == 7) { - 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 (i == 10) { - 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 (i == 13) { - 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 (i == 16) { - 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=[7:3:16]) { - pcb_hole_x = sbc_data[s[0]][i]+pcb_loc_x; - pcb_hole_y = sbc_data[s[0]][i+1]+pcb_loc_y; - pcb_hole_size = sbc_data[s[0]][i+2]; - if(pcb_hole_x!=0 && pcb_hole_y!=0) { - if(i == 7) { - translate([pcb_hole_x-1, pcb_hole_y-(bottom_standoff[0]/2)-(gap+adjust)-1,0]) - cube([2,gap+1.6,bottom_height-pcb_z+pcb_loc_z+bottom_rear_left]); - } - if(i == 10) { - translate([pcb_hole_x-1, pcb_hole_y+(bottom_standoff[0]/2)-.6+adjust,0]) - cube([2,gap+1.6,bottom_height-pcb_z+pcb_loc_z+bottom_front_left]); - } - if(i == 13) { - translate([pcb_hole_x-1, pcb_hole_y-(bottom_standoff[0]/2)-(gap+adjust)-1,0]) - cube([2,gap+1.6,bottom_height-pcb_z+pcb_loc_z+bottom_rear_right]); - } - if(i == 16) { - translate([pcb_hole_x-1, pcb_hole_y+(bottom_standoff[0]/2)-.6+adjust,0]) - cube([2,gap+1.6,bottom_height-pcb_z+pcb_loc_z+bottom_front_right]); - } - } - } - } - else { - for (i=[7:3:16]) { - pcb_hole_x = sbc_data[s[0]][i]+pcb_loc_x; - pcb_hole_y = sbc_data[s[0]][i+1]+pcb_loc_y; - pcb_hole_size = sbc_data[s[0]][i+2]; - if(pcb_hole_x!=0 && pcb_hole_y!=0) { - if(i == 7 && sbc_model != "n2l") { - translate([pcb_hole_x-(bottom_standoff[0]/2)-2.6+adjust, pcb_hole_y-gap,0]) - cube([gap+1.6,2,bottom_height-pcb_z+pcb_loc_z+bottom_rear_left]); - } - if (i == 7 && sbc_model == "n2l") { - translate([pcb_hole_x-1, pcb_hole_y-(bottom_standoff[0]/2)-(gap+adjust)-1,0]) - cube([2,gap+1.6,bottom_height-pcb_z+pcb_loc_z+bottom_rear_left]); - } - if(i == 10 && sbc_model != "n2l") { - translate([pcb_hole_x-(bottom_standoff[0]/2)-2.6+adjust, pcb_hole_y-gap,0]) - cube([gap+1.6,2,bottom_height-pcb_z+pcb_loc_z+bottom_front_left]); - } - if(i == 10 && sbc_model == "n2l") { - translate([pcb_hole_x-1, pcb_hole_y+(bottom_standoff[0]/2)-.6+adjust,0]) - cube([2,gap+1.6,bottom_height-pcb_z+pcb_loc_z+bottom_front_left]); - } - if (i == 13) { - translate([pcb_hole_x+(bottom_standoff[0]/2)-.5+adjust, pcb_hole_y-gap,0]) - cube([gap+1.5,2,bottom_height-pcb_z+pcb_loc_z+bottom_rear_right]); - } - if (i == 16) { - translate([pcb_hole_x+(bottom_standoff[0]/2)-.5+adjust, 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+adjust+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+adjust+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+adjust+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+adjust+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-adjust,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-adjust, - 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-adjust,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-adjust,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-adjust,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-adjust,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-adjust,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-adjust,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-adjust,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-adjust,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-adjust,face,rotation, - parametric,size_x+2,size_y+1,size_z+2*adjust,data_1,data_2,data_3,[.1,.1,.1,.1]); - } - } - } - } - // sbc openings - if(sbc_highlight == true) { - #open_io(); - } - else { - open_io(); - } - // 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); - } - } - } -} - - -// 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-adjust, - case_z-floorthick]) - cube([8,wallthick+2*adjust,floorthick]); - translate([width-(width*(1/5))-(wallthick+gap),depth-(2*wallthick)-gap-adjust, - case_z-floorthick]) - cube([8,wallthick+2*adjust,floorthick]); - translate([(width*(1/5))-8-(wallthick+gap),-wallthick-gap+adjust, - case_z-floorthick]) - cube([8,wallthick+2*adjust,floorthick]); - translate([width-(width*(1/5))-(wallthick+gap),-wallthick-gap+adjust, - case_z-floorthick]) - cube([8,wallthick+2*adjust,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+adjust]) 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-adjust,wallthick+gap+10, - floorthick+3.4]) rotate([0,90,0]) cylinder(d=3, h=10+sidethick+(2*adjust)); - // left side bottom attachment hole - translate([-2*(wallthick+gap)-sidethick-adjust,wallthick+gap+10, - floorthick+3.4]) rotate([0,90,0]) cylinder(d=3, h=10+sidethick+(2*adjust)); - 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-adjust,depth-wallthick-gap-10, - floorthick+3.4]) rotate([0,90,0]) cylinder(d=3, h=10+sidethick+(2*adjust)); - translate([-wallthick-gap-adjust-6,depth-wallthick-gap-10, - floorthick+3.4]) rotate([0,90,0]) cylinder(d=3, h=10+sidethick+(2*adjust)); - } - 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-adjust,wallthick+gap+58, - floorthick+3.4]) rotate([0,90,0]) cylinder(d=3, h=10+sidethick+(2*adjust)); - translate([-wallthick-gap-adjust-6,wallthick+gap+58, - floorthick+3.4]) rotate([0,90,0]) cylinder(d=3, h=10+sidethick+(2*adjust)); - } - else { - translate([width-2*(wallthick+gap)-sidethick-adjust,wallthick+gap+40, - floorthick+3.4]) rotate([0,90,0]) cylinder(d=3, h=10+sidethick+(2*adjust)); - translate([-wallthick-gap-adjust-6,wallthick+gap+40, - floorthick+3.4]) rotate([0,90,0]) cylinder(d=3, h=10+sidethick+(2*adjust)); - } - } - } - } - 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-adjust-lip/2]) rotate([0,0,30]) - cylinder_fillet_inside(h=lip+2*adjust, 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-adjust,depth-2*(floorthick+gap),top_height+adjust]); - } - else { - translate([-.95,depth/2-2*wallthick-gap-(depth-2*(floorthick+gap))/2, - bottom_height]) cube([width-2*(floorthick+gap),wallthick-adjust,top_height+adjust]); - } - } - 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-adjust-lip/2]) rotate([0,0,30]) - cylinder_fillet_inside(h=lip+2*adjust, 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-adjust-lip/2]) rotate([0,0,0]) - cylinder_fillet_inside(h=lip+2*adjust, 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-adjust,depth-2*(floorthick+gap),top_height+adjust]); - } - else { - translate([0,depth/2-2.25*(wallthick+gap)-(depth-2*(floorthick+gap))/2, - bottom_height]) cube([width-2*(floorthick+gap),wallthick-adjust,top_height+adjust]); - } - } - 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-adjust]) - 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-adjust]) - cube_fillet_inside([width-(3*wallthick),depth-(3*wallthick),2*floorthick+1.5+adjust], - 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(top_standoff[5] != 4 && sbc_top_standoffs == true) { - for (i=[7:3:16]) { - pcb_hole_x = sbc_data[s[0]][i]+pcb_loc_x; - pcb_hole_y = sbc_data[s[0]][i+1]+pcb_loc_y; - pcb_hole_size = sbc_data[s[0]][i+2]; - if (pcb_hole_x!=0 && pcb_hole_y!=0) { - 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=[7:3:16]) { - pcb_hole_x = sbc_data[s[0]][i]+pcb_loc_x; - pcb_hole_y = sbc_data[s[0]][i+1]+pcb_loc_y; - pcb_hole_size = sbc_data[s[0]][i+2]; - if(pcb_hole_x!=0 && pcb_hole_y!=0) { - if (i == 7) { - 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 (i == 10) { - 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 (i == 13) { - 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 (i == 16) { - 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=[7:3:16]) { - pcb_hole_x = sbc_data[s[0]][i]+pcb_loc_x; - pcb_hole_y = sbc_data[s[0]][i+1]+pcb_loc_y; - pcb_hole_size = sbc_data[s[0]][i+2]; - if(pcb_hole_x!=0 && pcb_hole_y!=0) { - if (i == 7) { - translate([pcb_hole_x-1, pcb_hole_y-(top_standoff[0]/2)-(gap-adjust)-1.4, - case_z-top_height-top_rear_left]) cube([2,gap+1.6,top_height+top_rear_left]); - } - if (i == 10) { - translate([pcb_hole_x-1, pcb_hole_y+(top_standoff[0]/2)-.6+adjust,case_z-top_height-top_front_left]) - cube([2,gap+1.6,top_height+top_front_left]); - } - if (i == 13) { - translate([pcb_hole_x-1, pcb_hole_y-(top_standoff[0]/2)-(gap-adjust)-1.4, - case_z-top_height-top_rear_right]) cube([2,gap+1.6,top_height+top_rear_right]); - } - if (i == 16) { - translate([pcb_hole_x-1, pcb_hole_y+(top_standoff[0]/2)-.6+adjust,case_z-top_height-top_front_right]) - cube([2,gap+1.6,top_height+top_front_right]); - } - } - } - } - else { - for (i=[7:3:16]) { - pcb_hole_x = sbc_data[s[0]][i]+pcb_loc_x; - pcb_hole_y = sbc_data[s[0]][i+1]+pcb_loc_y; - pcb_hole_size = sbc_data[s[0]][i+2]; - if(pcb_hole_x!=0 && pcb_hole_y!=0) { - if (i == 7 && sbc_model != "n2l") { - translate([pcb_hole_x-(top_standoff[0]/2)-gap-adjust-1,pcb_hole_y-1, - bottom_height-top_rear_left]) cube([gap+adjust+1.6,2,top_height+top_rear_left]); - } - if (i == 7 && sbc_model == "n2l") { - translate([pcb_hole_x-1, pcb_hole_y-(top_standoff[0]/2)-(gap-adjust)-1.4, - case_z-top_height-top_rear_left]) cube([2,gap+1.6,top_height+top_rear_left]); - - } - if (i == 10 && sbc_model != "n2l") { - translate([pcb_hole_x-(top_standoff[0]/2)-gap-adjust-1,pcb_hole_y-1, - bottom_height-top_front_left]) cube([gap+adjust+1.6,2,top_height+top_front_left]); - } - if (i == 10 && sbc_model == "n2l") { - translate([pcb_hole_x-1, pcb_hole_y+(top_standoff[0]/2)-.6+adjust,case_z-top_height-top_front_left]) - cube([2,gap+1.6,top_height+top_front_left]); - - } - if (i == 13) { - translate([pcb_hole_x+(top_standoff[0]/2)-adjust-.45,pcb_hole_y-1, - bottom_height-top_rear_right]) cube([gap+adjust+1.6,2,top_height+top_rear_right]); - } - if (i == 16) { - translate([pcb_hole_x+(top_standoff[0]/2)-adjust-.45,pcb_hole_y-1, - bottom_height-top_front_right]) cube([gap+adjust+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+adjust+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+adjust+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+adjust+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+adjust+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-adjust,face,rotation, - parametric,size_x+2,size_y+1,size_z+2*adjust,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) { - #open_io(); - } - else { - open_io(); - } - // 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); - } - } - } -} - -// 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-adjust,-wallthick-gap, - ((case_z)/2)-4]) - cube([(2*wallthick)+.5,wallthick,8]); - translate([width-(2*wallthick)-gap-adjust,-wallthick-gap-adjust, - ((case_z)/2)-4-adjust]) - cube([wallthick+.25,wallthick+(2*adjust),4.25]); - } - // left hook - difference() { - translate([-(2*wallthick)-gap-adjust-.25,-wallthick-gap, - ((case_z)/2)-4]) - cube([(2*wallthick)+.5,wallthick,8]); - translate([-wallthick-gap-adjust-.25,-wallthick-gap-adjust, - ((case_z)/2)-4-adjust]) - cube([wallthick+.25,wallthick+(2*adjust),4.25]); - } - } - // top slots - translate([(width*(1/5))-8.25-(wallthick+gap),-wallthick-gap-adjust, - case_z-floorthick-.25]) - cube([8.5,wallthick+2*adjust,floorthick+.5]); - translate([width-(width*(1/5))-(wallthick+gap)-.25,-wallthick-gap-adjust, - case_z-floorthick-.25]) - cube([8.5,wallthick+2*adjust,floorthick+.5]); - // bottom slots - translate([(width*(1/5))-8.25-(wallthick+gap),-wallthick-gap-adjust,-.25]) - cube([8.5,wallthick+2*adjust,floorthick+.5]); - translate([width-(width*(1/5))-(wallthick+gap)-.25,-wallthick-gap-adjust,-.25]) - cube([8.5,wallthick+2*adjust,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-adjust,depth-2*(wallthick)-gap-adjust, - ((case_z)/2)-4]) - cube([(2*wallthick)+.5,wallthick,8]); - translate([width-(2*wallthick)-gap-adjust, - depth-2*(wallthick)-adjust-gap-adjust,((case_z)/2)-4-adjust]) - cube([wallthick+.25,wallthick+(2*adjust),4.25]); - } - // left hook - difference() { - translate([-(2*wallthick)-gap-adjust-.25,depth-2*(wallthick)-gap-adjust,( - (case_z)/2)-4]) - cube([(2*wallthick)+.5,wallthick,8]); - translate([-wallthick-gap-adjust-.25,depth-2*(wallthick)-adjust-gap-adjust, - ((case_z)/2)-4-adjust]) - cube([wallthick+.25,wallthick+(2*adjust),4.25]); - } - } - // top slots - translate([(width*(1/5))-8.25-(wallthick+gap),depth-2*wallthick-gap-adjust, - case_z-floorthick-.25]) - cube([8.5,wallthick+2*adjust,floorthick+.5]); - translate([width-(width*(1/5))-(wallthick+gap)-.25,depth-2*wallthick-gap-adjust, - case_z-floorthick-.25]) - cube([8.5,wallthick+2*adjust,floorthick+.5]); - // bottom slots - translate([(width*(1/5))-8.25-(wallthick+gap),depth-2*wallthick-gap-adjust,-.25]) - cube([8.5,wallthick+2*adjust,floorthick+.5]); - translate([width-(width*(1/5))-(wallthick+gap)-.25, - depth-2*wallthick-gap-adjust,-.25]) cube([8.5,wallthick+2*adjust,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-adjust,-wallthick-gap-.25, - ((case_z)/2)]) cube([wallthick+2*adjust,wallthick+.5,8.5]); - translate([width-(2*wallthick)-gap-adjust,depth-2*(wallthick)-gap-.25, - ((case_z)/2)]) - cube([wallthick+2*adjust,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-adjust,-wallthick-gap-.25,((case_z)/2)]) - cube([wallthick+2*adjust,wallthick+.5,8.5]); - translate([-wallthick-gap-adjust,depth-2*(wallthick)-gap-.25, - ((case_z)/2)]) - cube([wallthick+2*adjust,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+adjust,depth-2*(wallthick+gap)-.5,case_z+(2*wallthick)-2]) - cube([1,6,2]); - translate([width-gap-wallthick-1+adjust,-2*(wallthick+gap)+1.5,case_z+(2*wallthick)-2]) - cube([1,6,2]); - // top rail - translate([width-6.9-adjust,-gap,case_z-floorthick-.5]) - cube([4,depth-2*(wallthick+gap),2]); - } - // right side bottom attachment holes - translate([width-2*(wallthick+gap)-sidethick-adjust,wallthick+gap+10, - ((bottom_height+floorthick)/2)-1]) rotate([0,90,0]) cylinder(d=3, h=10+sidethick+(2*adjust)); - if(depth >= 75) { - translate([width-2*(wallthick+gap)-sidethick-adjust,depth-wallthick-gap-10, - ((bottom_height+floorthick)/2)-1]) rotate([0,90,0]) - cylinder(d=3, h=10+sidethick+(2*adjust)); - } - else { - translate([width-2*(wallthick+gap)-sidethick-adjust,wallthick+gap+40, - ((bottom_height+floorthick)/2)-1]) rotate([0,90,0]) - cylinder(d=3, h=10+sidethick+(2*adjust)); - } - } - } - 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-adjust,depth-2*(wallthick+gap)-.5,case_z+(2*wallthick)-2]) - cube([1,6,2]); - translate([-gap-wallthick-adjust,-2*(wallthick+gap)+1.5,case_z+(2*wallthick)-2]) - cube([1,6,2]); - // top rail - translate([-wallthick-gap-adjust,-gap,case_z-floorthick-.5]) - cube([4,depth-2*(wallthick+gap),2]); - } - // left side bottom attachment holes - translate([-wallthick-gap-adjust-5,wallthick+gap+10, - ((bottom_height+floorthick)/2)-1]) rotate([0,90,0]) cylinder(d=3, h=10+sidethick+(2*adjust)); - if(depth >= 75) { - translate([-wallthick-gap-adjust-6,depth-wallthick-gap-10, - ((bottom_height+floorthick)/2)-1]) rotate([0,90,0]) - cylinder(d=3, h=10+sidethick+(2*adjust)); - } - else { - translate([-wallthick-gap-adjust-6,wallthick+gap+40, - ((bottom_height+floorthick)/2)-1]) rotate([0,90,0]) - cylinder(d=3, h=10+sidethick+(2*adjust)); - } - } - } - } - 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-adjust,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-adjust,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-adjust,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-adjust,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-adjust,face,rotation, - parametric,size_x+2,size_y+1,size_z+2*adjust,data_1,data_2,data_3,[.1,.1,.1,.1]); - } - } - } - } - // sbc openings - if(sbc_highlight == true) { - #open_io(); - } - else { - open_io(); - } - } - 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); - } - } - } -} - -// sbc openings -module open_io() { - - for (i=[69:6:len(sbc_data[s[0]])-1]) { - loc_x = sbc_data[s[0]][i]+pcb_loc_x; - loc_y = sbc_data[s[0]][i+1]+pcb_loc_y; - rotation = sbc_data[s[0]][i+2]; - side = sbc_data[s[0]][i+3]; - class = sbc_data[s[0]][i+4]; - type = sbc_data[s[0]][i+5]; - - mask(loc_x,loc_y,bottom_height+pcb_loc_z-adjust,rotation,side,class,type,wallthick,gap,floorthick,pcb_z); - - // indents - if(indents == true) { - indent(loc_x,loc_y,bottom_height+pcb_loc_z-adjust,rotation,side,class,type,wallthick,gap,floorthick,pcb_z); - } - - // bottom cooling openings - if(side == "bottom" && cooling == "fan" && class == "heatsink") { - translate([loc_x+12,loc_y-28,-adjust]) - fan_mask(40,floorthick+(2*adjust),2); - } - if(side == "bottom" && cooling == "vents" && class == "heatsink") { - for(r=[loc_x+13:4:54]) { - translate([r,loc_y-20,-adjust]) - cube([2,25,floorthick+(adjust*2)]); - } - } - if(side == "bottom" && cooling == "custom" && class == "heatsink") { - translate([loc_x+12,loc_y-14,-(floorthick-adjust)]) - linear_extrude(height = wallthick+(2*adjust)) import(file = "./dxf/customfan.dxf"); - } - if(side == "bottom" && exhaust_vents == "vent" && (cooling == "fan" || cooling == "vents" - || cooling == "custom") && class == "heatsink" && gpio_opening != "vent" && gpio_opening != "open" - && gpio_opening != "punchout") { - for(r=[loc_x+7:4:46+loc_x]) { - translate([r,depth-(2*wallthick)-adjust-2,floorthick+2]) - cube([2,wallthick+(2*adjust)+1,top_height-floorthick-6]); - } - } - // top cooling openings - if(side == "top" && cooling == "fan" && class == "heatsink" && type != "h3_oem" - && type != "h2_oem" && type != "n2_oem" && type != "n2+_oem"&& type != "m1s_oem") { - translate([loc_x+6,loc_y-28,case_z-(floorthick+adjust)-5]) - fan_mask(40,floorthick+(2*adjust)+8,2); - } - if(side == "top" && cooling == "fan" && class == "heatsink" && type == "m1s_oem") { - translate([loc_x,loc_y,case_z-(floorthick+adjust)-5]) - fan_mask(40,floorthick+(2*adjust)+8,2); - } - if(side == "top" && cooling == "fan" && class == "heatsink" && (type == "n2_oem" || type == "n2+_oem")) { - translate([loc_x+4,loc_y+5.5,-adjust]) - fan_mask(80,floorthick+(2*adjust),2); - if(sbc_model == "n2") { - translate([pcb_loc_x+7,pcb_loc_y+15,-adjust]) cylinder(d=3,h=floorthick+(adjust*2)); - translate([pcb_loc_x+82,pcb_loc_y+6,-adjust]) cylinder(d=3,h=floorthick+(adjust*2)); - translate([pcb_loc_x+8,pcb_loc_y+75,-adjust]) cylinder(d=3,h=floorthick+(adjust*2)); - translate([pcb_loc_x+82,pcb_loc_y+75,-adjust]) cylinder(d=3,h=floorthick+(adjust*2)); - } - } - if(side == "top" && cooling == "fan" && class == "heatsink" && type == "h2_oem") { - translate([loc_x-28,loc_y-28,case_z-(floorthick+adjust)]) - fan_mask(90,floorthick+6,2); - } - if(side == "top" && cooling == "fan" && class == "heatsink" && type == "h3_oem" ) { - translate([loc_x-5,loc_y-16,case_z-(floorthick+adjust)]) - fan_mask(90,floorthick+6,2); - } - if(side == "top" && cooling == "vents" && class == "heatsink" && type != "m1s_oem") { - for(r=[loc_x+7:4:58+loc_x]) { - translate([r,loc_y-20,case_z-(floorthick+adjust)-6]) - cube([2,30,floorthick+(adjust*2)+12]); - } - } - if(side == "top" && cooling == "vents" && class == "heatsink" && type == "m1s_oem") { - for(r=[loc_x+7:4:58+loc_x]) { - translate([r-8,loc_y+8,case_z-(floorthick+adjust)-6]) - cube([2,30,floorthick+(adjust*2)+12]); - } - } - if(side == "top" && cooling == "hex_5mm" && class == "heatsink" && type != "m1s_oem") { - translate([loc_x+2,loc_y-27,case_z-(floorthick+adjust)-6]) - vent_hex(15, 7, floorthick+(adjust*2)+12, 5, 1.5, "horizontal"); - } - if(side == "top" && cooling == "hex_8mm" && class == "heatsink" && type != "m1s_oem") { - translate([loc_x,loc_y-31,case_z-(floorthick+adjust)-6]) - vent_hex(11, 5, floorthick+(adjust*2)+12, 8, 1.5, "horizontal"); - } - if(side == "top" && cooling == "hex_5mm" && class == "heatsink" && type == "m1s_oem") { - translate([loc_x-8,loc_y,case_z-(floorthick+adjust)-6]) - vent_hex(15, 7, floorthick+(adjust*2)+12, 5, 1.5, "horizontal"); - } - if(side == "top" && cooling == "hex_8mm" && class == "heatsink" && type == "m1s_oem") { - translate([loc_x-8,loc_y,case_z-(floorthick+adjust)-6]) - vent_hex(11, 5, floorthick+(adjust*2)+12, 8, 1.5, "horizontal"); - } - if(side == "top" && cooling == "custom" && class == "heatsink") { - translate([loc_x+6,loc_y-14,case_z-(floorthick+adjust)]) - linear_extrude(height = wallthick+(2*adjust)+12) import(file = "./dxf/customfan.dxf"); - } - if(side == "top" && exhaust_vents == "vent" && (cooling == "fan" || cooling == "vents" || cooling == "hex" - || cooling == "custom") && class == "heatsink" && gpio_opening != "vent" && gpio_opening != "open" - && gpio_opening != "punchout") { - for(r=[loc_x+7:4:50+loc_x]) { - translate([r,depth-(2*wallthick)-adjust-3,bottom_height+2]) - cube([2,wallthick+(2*adjust)+2.5,top_height-floorthick-4]); - } - } - - // gpio opening - if(side == "top" && class == "gpio" && type == "header_40" && rotation == 0) { - if(gpio_opening == "vent") { - for(r=[loc_x-2:4:50+loc_x]) { - translate([r,depth-(2*wallthick)-gap-adjust,bottom_height+2]) - cube([2,wallthick+(2*adjust),top_height-floorthick-4]); - } - } - if(gpio_opening == "open") { - translate([loc_x-2,depth-(2*wallthick)-adjust-gap,bottom_height+3]) - cube([54,wallthick+(2*adjust),top_height-floorthick-5]); - } - if(gpio_opening == "block") { - if(sbc_model == "m1s") { - translate([loc_x-27,depth-(2*wallthick)-adjust-gap-10,bottom_height+2]) - cube([79,20,top_height]); - } - else { - translate([loc_x-2,depth-(2*wallthick)-adjust-gap-10,bottom_height+2]) - cube([54,20,top_height]); - } - } - if(gpio_opening == "punchout") { - translate([loc_x+1,depth-(2*wallthick)-adjust-gap,bottom_height+7.5]) - rotate([-90,0,0]) punchout(50,11,2,wallthick+(2*adjust),c_fillet,"slot"); - } - } - if(side == "top" && class == "gpio" && type == "header_40" && rotation == 90) { - if(gpio_opening == "vent") { - for(r=[loc_y-2:4:50+loc_y]) { - translate([width-2*(wallthick+gap)-adjust,depth-r,bottom_height+2]) - rotate([0,0,0]) cube([6,wallthick+(2*adjust),top_height-floorthick-4]); - } - } - if(gpio_opening == "open") { - translate([loc_x+8,depth-13,bottom_height+4]) - rotate([0,0,-90]) cube([54,wallthick+(2*adjust),top_height-floorthick-5]); - } - if(gpio_opening == "block") { - translate([loc_x+8,depth-13,bottom_height+2]) - rotate([0,0,-90]) cube([54,wallthick+(2*adjust),top_height]); - } - if(gpio_opening == "punchout") { - translate([loc_x+8,depth-15,bottom_height+7.5]) - rotate([-90,0,-90]) punchout(50,11,2,wallthick+(2*adjust),c_fillet,"slot"); - } - } - if(side == "top" && class == "gpio" && type == "encl_header_30") { - if(gpio_opening == "vent") { - for(r=[loc_x-2:4:39+loc_x]) { - translate([r,depth-(2*wallthick)-adjust,bottom_height+2]) - cube([2,wallthick+(2*adjust),top_height-floorthick-4]); - } - } - if(gpio_opening == "open") { - translate([loc_x-2,depth-(2*wallthick)-adjust,bottom_height+3]) - cube([41,wallthick+(2*adjust),top_height-floorthick-5]); - } - if(gpio_opening == "block") { - translate([loc_x-2,depth-(2*wallthick)-adjust-10,bottom_height+2]) - cube([41,20,top_height]); - } - if(gpio_opening == "punchout") { - translate([loc_x+1,depth-(2*wallthick)-adjust-gap,bottom_height+8]) - rotate([-90,0,0]) punchout(34,11,2,wallthick+(2*adjust),3,"slot"); - } - } - if(side == "top" && class == "gpio" && type == "header_26") { - if(gpio_opening == "vent") { - for(r=[loc_x-2:4:39+loc_x]) { - translate([r,-wallthick-gap-adjust,bottom_height+2]) - cube([2,wallthick+(2*adjust),top_height-floorthick-4]); - } - } - if(gpio_opening == "open") { - translate([loc_x-2,-wallthick-gap-adjust,bottom_height+3]) - cube([41,wallthick+(2*adjust),top_height-floorthick-5]); - } - if(gpio_opening == "block") { - translate([loc_x-2,-wallthick-gap-adjust-10,bottom_height+2]) - cube([41,20,top_height]); - } - if(gpio_opening == "punchout") { - translate([loc_x+1,-wallthick-adjust-gap,bottom_height+8]) - rotate([-90,0,0]) punchout(34,11,2,wallthick+(2*adjust),3,"slot"); - } - } - - // uart knockout opening - if(side == "top" && type == "uart_micro" && rotation == 90) { - translate([loc_x-wallthick-gap-8.5,loc_y-1,bottom_height+5]) rotate([90,0,90]) - punchout(15,8,1,wallthick+(2*adjust)+10,2,"rectangle"); - } - if(side == "top" && type == "uart_micro" && rotation == -90) { - translate([loc_x+2*(wallthick+gap)+1,loc_y-1,bottom_height+5]) rotate([90,0,90]) - punchout(15,8,1,wallthick+(2*adjust)+5,2,"rectangle"); - } - if(side == "top" && type == "uart_micro" && rotation == 270) { - translate([loc_x-2*(wallthick),loc_y-1,bottom_height+5]) rotate([90,0,90]) - punchout(15,8,1,wallthick+(2*adjust)+12,2,"rectangle"); - } - - if(side == "bottom" && type == "uart_micro_h" && rotation == 90) { - translate([loc_x-wallthick-gap+8.5,loc_y-1,bottom_height-6]) rotate([90,0,90]) - punchout(15,5,1,wallthick+(2*adjust)+10,2,"rectangle"); - } - if(side == "bottom" && type == "uart_micro_h" && rotation == -90) { - translate([loc_x+2*(wallthick+gap)+1,loc_y-1,bottom_height+5]) rotate([90,0,90]) - punchout(15,5,1,wallthick+(2*adjust)+5,2,"rectangle"); - } - if(side == "bottom" && type == "uart_micro_h" && rotation == 270) { - translate([loc_x-2*(wallthick),loc_y-1,bottom_height+5]) rotate([90,0,90]) - punchout(15,5,1,wallthick+(2*adjust)+12,2,"rectangle"); - } - - // sata openings - if(side == "top" && type == "sata_power_vrec" && sata_punchout == true) { - translate([loc_x-3,loc_y+1.75,case_z-adjust-floorthick]) - punchout(42,7.5,2,floorthick+(2*adjust)+6,3,"slot"); - } - } -} - -module vu_holder(vu_model,side,vesa,cheight) { - -//cheight = case_z+90; -v_fillet = 3; - -vu5_case_x_offset = 6.5; // for uniform front vu5=6.5, vu7=20 -vu5_pcb_width = 121; -vu5_pcb_height = 93.31; -vu5_width = vu5_pcb_width + vu5_case_x_offset; -vu5_height = vu5_pcb_height + 9.75; - -vu7_case_x_offset = 20; // for uniform front vu5=6.5, vu7=20 -vu7_pcb_width = 172.90; -vu7_pcb_height = 124.27; -vu7_width = vu7_pcb_width + vu7_case_x_offset; -vu7_height = vu7_pcb_height + 9.75; - - difference() { - union() { - if(side == "right") { - translate([width-wallthick-gap,-(2*wallthick)-gap,0]) - cube([sidethick,depth+2*wallthick,cheight]); - // right tabs for vu5 attachment - if(case_style == "vu5") { - translate([(width/2)+((width-vesa)/2)+(vesa/2)-sidethick,depth-39, - case_z+80]) rotate([90-vu_rotation[0],180,0]) - slab_r([((width-vesa)/2)+4.5,10,sidethick], [.1,.1,3,3]); - translate([(width/2)+((width-vesa)/2)+(vesa/2)-sidethick,depth-26, - case_z+31.5]) rotate([90-vu_rotation[0],180,0]) - slab_r([((width-vesa)/2)+4.5,10,sidethick], [.1,.1,3,3]); - - translate([(width/2)+((width-vesa)/2)+(vesa/2)-sidethick,depth-41.85-adjust, - case_z+79.25]) rotate([90-vu_rotation[0],180,0]) - difference() { - cube([sidethick,10,sidethick]); - translate([0,-adjust,sidethick]) rotate([0,45,0]) - cube([2*sidethick,10+(2*adjust),sidethick]); - } - translate([(width/2)+((width-vesa)/2)+(vesa/2)-sidethick,depth-28.85-adjust, - case_z+30.75]) rotate([90-vu_rotation[0],180,0]) - difference() { - cube([sidethick,10,sidethick]); - translate([0,-adjust,sidethick]) rotate([0,45,0]) - cube([2*sidethick,10+(2*adjust),sidethick]); - } - } - // right tabs for vu7 attachment - if(case_style == "vu7") { - translate([(width/2)+((width-vesa)/2)+(vesa/2)-sidethick-1,depth-49.40, - case_z+vu7_height-15]) rotate([90-vu_rotation[0],180,0]) - slab_r([((width-vesa)/2)+12,10,sidethick], [.1,.1,3,3]); - translate([(width/2)+((width-vesa)/2)+(vesa/2)-sidethick-1,depth-23.60, - case_z+22.5]) rotate([90-vu_rotation[0],180,0]) - slab_r([((width-vesa)/2)+12,10,sidethick], [.1,.1,3,3]); - - translate([(width/2)+((width-vesa)/2)+(vesa/2)-sidethick,depth-52.25, - case_z+vu7_height-15.75]) rotate([90-vu_rotation[0],180,0]) - difference() { - cube([sidethick,10,sidethick]); - translate([0,-adjust,sidethick]) rotate([0,45,0]) - cube([2*sidethick,10+(2*adjust),sidethick]); - } - translate([(width/2)+((width-vesa)/2)+(vesa/2)-sidethick,depth-26.5, - case_z+21.8]) rotate([90-vu_rotation[0],180,0]) - difference() { - cube([sidethick,10,sidethick]); - translate([0,-adjust,sidethick]) rotate([0,45,0]) - cube([2*sidethick,10+(2*adjust),sidethick]); - } - } - // top rail - translate([width-6.9-adjust,-gap,case_z-floorthick-.5]) - cube([4,depth-2*(wallthick+gap),2]); - } - if(side == "left") { - translate([-wallthick-gap-sidethick,-(2*wallthick)-gap,0]) - cube([sidethick,depth+2*wallthick,cheight]); - // left tabs for vu5 attachment - if(case_style == "vu5") { - translate([-((width-vesa)/2)+(width/2)-(vesa/2)-3.5-adjust,depth-36.4, - case_z+70]) rotate([90+vu_rotation[0],0,0]) - slab_r([((width-vesa)/2)+4,10, sidethick], [.1,.1,3,3]); - translate([-((width-vesa)/2)+(width/2)-(vesa/2)-3.5-adjust,depth-23.5, - case_z+22]) rotate([90+vu_rotation[0],0,0]) - slab_r([((width-vesa)/2)+4,10,sidethick], [.1,.1,3,3]); - translate([-((width-vesa)/2)+(width/2)-(vesa/2)-3.5-adjust,depth-39.35+adjust, - case_z+69.25]) rotate([90+vu_rotation[0],0,0]) - difference() { - cube([sidethick,10,sidethick]); - translate([0,-adjust,sidethick]) rotate([0,45,0]) - cube([2*sidethick,10+(2*adjust),2*sidethick]); - } - translate([-((width-vesa)/2)+(width/2)-(vesa/2)-3.5-adjust,depth-26.4+adjust, - case_z+21.25]) rotate([90+vu_rotation[0],0,0]) - difference() { - cube([sidethick,10,sidethick]); - translate([0,-adjust,sidethick]) rotate([0,45,0]) - cube([2*sidethick,10+(2*adjust),2*sidethick]); - } - } - // left tabs for vu7 attachment - if(case_style == "vu7") { - translate([-((width-vesa)/2)+(width/2)-(vesa/2)-4.25-adjust,depth-46.85, - case_z+vu7_height-24.5]) rotate([90+vu_rotation[0],0,0]) - slab_r([((width-vesa)/2),10, sidethick], [.1,.1,3,3]); - translate([-((width-vesa)/2)+(width/2)-(vesa/2)-4.25-adjust,depth-21, - case_z+13]) rotate([90+vu_rotation[0],0,0]) - slab_r([((width-vesa)/2),10,sidethick], [.1,.1,3,3]); - translate([-((width-vesa)/2)+(width/2)-(vesa/2)-4-adjust,depth-49.75+adjust, - case_z+vu7_height-25.25]) rotate([90+vu_rotation[0],0,0]) - difference() { - cube([sidethick,10,sidethick]); - translate([0,-adjust,sidethick]) rotate([0,45,0]) - cube([2*sidethick,10+(2*adjust),2*sidethick]); - } - translate([-((width-vesa)/2)+(width/2)-(vesa/2)-4-adjust,depth-23.75+adjust, - case_z+12.25]) rotate([90+vu_rotation[0],0,0]) - difference() { - cube([sidethick,10,sidethick]); - translate([0,-adjust,sidethick]) rotate([0,45,0]) - cube([2*sidethick,10+(2*adjust),2*sidethick]); - } - } - // top rail - translate([-wallthick-gap-adjust,-gap,case_z-floorthick-.5]) - cube([4,depth-2*(wallthick+gap),2]); - } - } - - if(side == "right") { - // vu5 shape and back cut - if(case_style == "vu5") { - translate([width+sidethick-2,-.6,case_z+sidethick+2.5]) - rotate([0,-90,0]) - linear_extrude(height = 2*sidethick) - polygon(points = [ [-sidethick,-sidethick-wallthick-5], - [cheight-bottom_height-top_height-3,-sidethick-wallthick-5], - [cheight-bottom_height-top_height-3,depth-53], - [-sidethick,depth-33]]); - - translate([width-(sidethick/2),depth-8,case_z+(121/2)]) - rotate([vu_rotation[0],0,0]) - cube_fillet_inside([10,50,110],vertical=[v_fillet,v_fillet,v_fillet,v_fillet], - top=[0,0,0,0],bottom=[3,3,3,3], $fn=90); - // tab holes - translate([width/2+(vesa/2)-3,depth-37, - case_z+75]) rotate([90-vu_rotation[0],180,0]) cylinder(d=3, h=sidethick+1); - translate([width/2+(vesa/2)-3,depth-24, - case_z+26.75]) rotate([90-vu_rotation[0],180,0]) cylinder(d=3, h=sidethick+1); - } - // vu7 shape and back cut - if(case_style == "vu7") { - translate([width+sidethick-2,-.6,case_z+sidethick+2.5]) - rotate([0,-90,0]) - linear_extrude(height = 2*sidethick) - polygon(points = [ [-sidethick,-sidethick-wallthick-5], - [cheight-bottom_height-top_height-3,-sidethick-wallthick-5], - [cheight-bottom_height-top_height-3,depth-63], - [-sidethick,depth-33]]); - - translate([width-(sidethick/2),depth-10.5,case_z+70.5]) - rotate([vu_rotation[0],0,0]) - cube_fillet_inside([10,50,130],vertical=[v_fillet,v_fillet,v_fillet,v_fillet], - top=[0,0,0,0],bottom=[3,3,3,3], $fn=90); - // tab holes - translate([width/2+(vesa/2)-10,depth-47,case_z+vu7_height-19.75]) - rotate([90-vu_rotation[0],180,0]) cylinder(d=3, h=sidethick+4); - translate([width/2+(vesa/2)-10,depth-21.25,case_z+18]) - rotate([90-vu_rotation[0],180,0]) cylinder(d=3, h=sidethick+4); - } - // bottom attachment holes - translate([width-wallthick-gap-adjust-5,wallthick+gap+10, - ((bottom_height+floorthick)/2)-1]) rotate([0,90,0]) cylinder(d=3, h=sidethick+(2*adjust)+10); - translate([width-wallthick-gap-adjust-5,depth-wallthick-gap-10, - ((bottom_height+floorthick)/2)-1]) rotate([0,90,0]) cylinder(d=3, h=sidethick+(2*adjust)+10); - } - - if(side == "left") { - // vu5 shape and back cut - if(case_style == "vu5") { - translate([-sidethick-adjust,-.6,case_z+sidethick+2.5]) - rotate([0,-90,0]) - linear_extrude(height = 2*sidethick) - polygon(points = [ [-sidethick,-sidethick-wallthick-5], - [cheight-bottom_height-top_height-3,-sidethick-wallthick-5], - [cheight-bottom_height-top_height-3,depth-53], - [-sidethick,depth-33]]); - - translate([-wallthick-gap-(sidethick/2),depth-8,case_z+(121/2)]) - rotate([vu_rotation[0],0,0]) - cube_fillet_inside([10,50,110],vertical=[v_fillet,v_fillet,v_fillet,v_fillet], - top=[0,0,0,0],bottom=[3,3,3,3], $fn=90); - // tab holes - translate([width/2-(vesa/2)-3,depth-36.75,case_z+75]) - rotate([90+vu_rotation[0],0,0]) cylinder(d=3, h=sidethick+1); - translate([width/2-(vesa/2)-3,depth-24.25,case_z+26.75]) - rotate([90+vu_rotation[0],0,0]) cylinder(d=3, h=sidethick+1); - } - // vu7 shape and back cut - if(case_style == "vu7") { - translate([-sidethick-adjust,-.6,case_z+sidethick+2.5]) - rotate([0,-90,0]) - linear_extrude(height = 2*sidethick) - polygon(points = [ [-sidethick,-sidethick-wallthick-5], - [cheight-bottom_height-top_height-3,-sidethick-wallthick-5], - [cheight-bottom_height-top_height-3,depth-63], - [-sidethick,depth-33]]); - - translate([-wallthick-gap-(sidethick/2),depth-10.5,case_z+70.5]) - rotate([vu_rotation[0],0,0]) - cube_fillet_inside([10,50,130],vertical=[v_fillet,v_fillet,v_fillet,v_fillet], - top=[0,0,0,0],bottom=[3,3,3,3], $fn=90); - // tab holes - translate([width/2-(vesa/2)-10,depth-48,case_z+vu7_height-19.75]) - rotate([90+vu_rotation[0],0,0]) cylinder(d=3, h=sidethick+4); - translate([width/2-(vesa/2)-10,depth-22.25,case_z+18]) - rotate([90+vu_rotation[0],0,0]) cylinder(d=3, h=sidethick+4); - } - // bottom attachment holes - translate([-sidethick-adjust-6,wallthick+gap+10,((bottom_height+floorthick)/2)-1]) - rotate([0,90,0]) cylinder(d=3, h=sidethick+(2*adjust)+10); - if(depth >= 75) { - translate([-sidethick-adjust-6,depth-wallthick-gap-10, - ((bottom_height+floorthick)/2)-1]) rotate([0,90,0]) cylinder(d=3, h=sidethick+(2*adjust)+10); - } - else { - translate([-sidethick-adjust-6,wallthick+gap+40.5,((bottom_height+floorthick)/2)-1]) - rotate([0,90,0]) cylinder(d=3, h=sidethick+(2*adjust)+10); - } - } - } -} - -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); - } - } -} - - -/* indent module */ -module indent(loc_x,loc_y,loc_z,rotation,side,class,type,wallthick,gap,floorthick,pcb_z) { - - adjust = .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); - } -} +} \ No newline at end of file diff --git a/sbc_case_builder_library.scad b/sbc_case_builder_library.scad index 6f0b339..1fb335f 100644 --- a/sbc_case_builder_library.scad +++ b/sbc_case_builder_library.scad @@ -1,9 +1,5 @@ /* SBC Case Builder Library Copyright 2022 Edward A. Kisiel hominoid@cablemi.com - - Contributions: - hk_vu8m(brackets),u_bracket(),screw(),m1_hdmount() Copyright 2022 Tomek Szczęsny, mctom @ www.forum.odroid.com - vent_hex(), vent_panel_hex() Copyright 2023 Tomek Szczęsny, mctom @ www.forum.odroid.com This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -19,4364 +15,36 @@ Code released under GPLv3: http://www.gnu.org/licenses/gpl.html 20220212 version 1.1.0 SBC Case Builder Library - 20220220 version 1.1.1 added fan_cover(size, thick), hd_mount(hd,orientation), hd25_tab(side) - hd35_tab(side), hd_bottom_holes(hd,orientation,thick) - adjusted hd35(), other fixes and maintenance - 20220227 version 1.1.2 adjusted hd25(), hd35(), updated hd_mount(hd,orientation,position,side), - hd_bottom_holes(hd,orientation,position,side,thick), hd25_tab(side), hd35_tab(side) - added hd25_vtab(side), hc4_oled() rotated 180, - added pcb_z to mask(loc_x,loc_y,rotation,side,class,type,case_z,wallthick,gap,floorthick,pcb_z) - adjusted hdmi_open() for bottom placment, added hc4_oled_holder(side,floorthick) - added buttom to mask(), - 20220306 version 1.1.3 added access_port(size[],orientation), access_cover(size[],orientation), h2_netcard(), rj45(), - button(style, diameter, height), button_plunger(style, diameter, height), button_top(style, - diameter, height), button_clip(style), fixed momentary_6x6x4 mask, adjusted masks, - 20220312 version 1.2.0 rotated slot in hd25_vtab(side),adjusted hc4_oled_holder(side,floorthick), adjust stud(), - added hk35_lcd(),header_5x1(),momentary45x15 - 20220320 version 1.2.1 added hk_boom(speakers,orientation), hk_boom_speaker(side,speaker,pcb), boom_speaker() - replaced header5x1() with header(pins), added encl_header_12(), micro2pin(), audio_jack35(), - capacitor(diameter, height), ic(size), added hk_boom_grill(), boom_speaker_holder(tolerance), - pcb_holder(size,wallthick), hk_uart(), usb_micro(), uart_micro(), boom_vring(tolerance), - added tolerance to batt_holder(tolerance) - 20220406 version 1.2.2 hk_wb2(), hk_vu7c(gpio_ext, tabs), hdmi_a(), header_f(pins, height), pcb_pad(pads), - embelished boom_speaker(), changed boom_speaker_holder(style, tolerance), added boom_speaker_strap(), - adjusted access_port(), access_cover(), added @mctom's hk_vu8m(bracket), u_bracket(), spacer() - 20220515 version 1.2.3 removed spacer(); added screw(); modified hk_vu8m(); added m1_hdmount(); added hdd35_25holder(length) - printer friendly punchout(),added remaining mask() entries, standardized mask() - 20221005 version 2.0.0 increased mask projection for ir_1, added mask for usb2 and usb3 single_horizontal_a, hdmi_micro, - video-hdmi_mini,microsdcard,momentary_7x3x3_90,rj45_single_short, added subtraction microusb and sphere - 20221011 Version 2.0.1 adjusted cases and accessories, updated README.md and SBC_Case_Builder_Cases.gif - 20221101 version 2.0.2 added hdmi_a_vertical mask, increased jack_3.5 mask dia.to 6mm, lowered hdmi_a_vertical mask by 2mm, - added mask for microsdcard2 - 20221207 version 2.0.3 added double_stacked_usb3-usb2, hd35_vtab(side) and supporting code - 20231110 version 2.0.4 added h3_port_extender(style, mask = false), hk_pwr_button(mask = false), keyhole(keysize, mask = false), - vent_hex(cells_x, cells_y, cell_size, cell_spacing, orientation) and supporting code, dsub(dsubsize, mask = false), - vent_panel_hex(x, y, thick, cell_size, cell_spacing, border, borders), - added nut_holder(nut, style, dia_x, dia_y, height), fixed access_port and access_cover 180 rotation - in portrait and landscape, added h3_port_extender_holder(part,offset), cableholder_spacer() - 20231115 Version 2.0.5 added hex vent and new component openings - 20231211 Version 2.0.6 added vu8s, hk_m1s_case_holes, hk_m1s_ups(), proto_m1s(), proto_ups(), battery_clip(bat_dia = 18.4), - battery(type), pcb_pad(pads = 1, style = "round"), led(ledcolor = "red"), m_insert(type="M3", icolor = "#ebdc8b"), - usbc(). - - - see https://github.com/hominoids/SBC_Case_Builder - - place(x,y,z,size_x,size_y,rotation,side) - 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) - 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) - art(scale_d1,type,size_z) - screw(screw[d, l, style]) - slab(size, radius) - slab_r(size, radius) - slot(hole,length,depth) - standoff(standoff[radius,height,holesize,supportsize,supportheight,sink,style,i_dia,i_depth]) - button(style, diameter, height) - button_assembly(style, diameter, height - button_plunger(style, diameter, height) - button_top(style, diameter, height) - button_clip(style) - feet (height) - pcb_holder(size,wallthick) - batt_holder(tolerance) - uart_holder() - uart_strap () - fan_cover(size, thick) - hc4_oled_holder(side,floorthick) - hd_mount(hd,orientation,position,side) - hd25_tab(side) - hd25_vtab(side) - hd35_tab(side) - hd35_vtab(side) - hd_bottom_holes(hd,orientation,position,side,thick) - hd25(height) - hd35() - hdd35_25holder(length) - hk_wb2() - hc4_oled() - h2_netcard() - hk35_lcd() - hk_uart() - hk_vu7c(gpio_ext, tabs) - hk_vu8m(bracket) - u_bracket() - m1_hdmount() - hdmi_a() - header_f(pins, height) - pcb_pad(pads) - usb_micro() - uart_micro() - rj45() - header(pins) - encl_header_12() - micro2pin() - audio_jack35() - capacitor(diameter, height) - ic(size) - hk_speaker() - hk_boom(speakers,orientation) - hk_boom_speaker(side,speaker,pcb) - boom_speaker() - hk_boom_grill(style,thick) - boom_speaker_holder(style,tolerance) - boom_speaker_strap() - boom_vring(tolerance) - access_port(size[],orientation) - access_cover(size[],orientation) - hdmi_open(hdmi_style) - microusb_open() - fan_mask(size, thick, style) - mask(loc_x,loc_y,rotation,side,class,type,case_z,wallthick,gap,floorthick,pcb_z) - punchout(width,depth,gap,thick,fillet,shape) - h3_port_extender(style, mask = false) - h3_port_extender_holder(part,offset) - hk_pwr_button(mask = false) - keyhole(keysize, mask = false) - vent_hex(cells_x, cells_y, thickness, cell_size, cell_spacing, orientation) - vent_panel_hex(x, y, thick, cell_size, cell_spacing, border, borders); - dsub(dsubsize, mask = false) - nut_holder(nut, style, dia_x, dia_y, height) - cableholder_spacer() - hk_m1s_case_holes - hk_m1s_ups() - proto_m1s() - proto_ups() - battery_clip(bat_dia = 18.4) - battery(type) - pcb_pad(pads = 1, style = "round") - led(ledcolor = "red") - m_insert(type="M3", icolor = "#ebdc8b") - usbc() - -*/ - -use <./lib/fillets.scad>; - -/* 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]); -} - - -/* 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); - } -} - - -/* 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); - } -} - - -/* art work module */ -module art(scale_d1,size_z,type) { - - linear_extrude(height = size_z) import(file = type, scale=scale_d1); - -} - -// General purpose screw -// screw(screw[d, l, style]) -// d - thread diameter -// l - thread length -// style - screw head style -// -// Styles: -// 0 - Mushroom head, 5mm diameter - -module screw(screw_type) { - d = screw_type[0]; - l = screw_type[1]; - style = screw_type[2]; - - // Head - if(style == 0) { - difference() { - translate([ 0, 0, -0.3]) sphere(2.7); - translate([-10,-10,-10]) cube([20,20,10]); - translate([-10,-10, 2]) cube([20,20,10]); - } - } - // Thread - rotate([180,0,0]) cylinder(d=d, h=l); -} - -/* slab module */ -module slab(size, radius) { - - x = size[0]; - y = size[1]; - z = size[2]; - linear_extrude(height=z) - hull() { - translate([0+radius ,0+radius, 0]) circle(r=radius); - translate([0+radius, y-radius, 0]) circle(r=radius); - translate([x-radius, y-radius, 0]) circle(r=radius); - translate([x-radius, 0+radius, 0]) circle(r=radius); - } -} - - -/* multi-radius round slab */ -module slab_r(size, radius) { - - x = size[0]; - y = size[1]; - z = size[2]; - r0 = radius[0]; - r1 = radius[1]; - r2 = radius[2]; - r3 = radius[3]; - - linear_extrude(height=z) - hull() { - translate([0+radius[0] ,0+radius[0], 0]) circle(r=radius[0]); - translate([0+radius[1], y-radius[1], 0]) circle(r=radius[1]); - translate([x-radius[2], y-radius[2], 0]) circle(r=radius[2]); - translate([x-radius[3], 0+radius[3], 0]) circle(r=radius[3]); - } -} - - -/* slot module */ -module slot(hole,length,depth) { - - hull() { - translate([0,0,0]) cylinder(d=hole,h=depth); - translate([length,0,0]) cylinder(d=hole,h=depth); - } - } - - -/* standoff module - standoff(standoff[radius,height,holesize,supportsize,supportheight,sink,style,reverse,insert_e,i_dia,i_depth]) - sink=0 none - sink=1 countersink - sink=2 recessed hole - sink=3 nut holder - sink=4 blind hole - - style=0 hex shape - style=1 cylinder -*/ -module standoff(stand_off){ - - radius = stand_off[0]; - height = stand_off[1]; - holesize = stand_off[2]; - supportsize = stand_off[3]; - supportheight = stand_off[4]; - sink = stand_off[5]; - style = stand_off[6]; - reverse = stand_off[7]; - insert_e = stand_off[8]; - i_dia = stand_off[9]; - i_depth = stand_off[10]; - - adjust = 0.1; - - difference (){ - union () { - if(style == 0 && reverse == 0) { - rotate([0,0,30]) cylinder(d=radius*2/sqrt(3),h=height,$fn=6); - } - if(style == 0 && reverse == 1) { - translate([0,0,-height]) rotate([0,0,30]) cylinder(d=radius*2/sqrt(3),h=height,$fn=6); - } - if(style == 1 && reverse == 0) { - cylinder(d=radius,h=height,$fn=90); - } - if(style == 1 && reverse == 1) { - translate([0,0,-height]) cylinder(d=radius,h=height,$fn=90); - } - if(reverse == 1) { - translate([0,0,-supportheight]) cylinder(d=(supportsize),h=supportheight,$fn=60); - } - else { - cylinder(d=(supportsize),h=supportheight,$fn=60); - } - } - // hole - if(sink <= 3 && reverse == 0) { - translate([0,0,-adjust]) cylinder(d=holesize, h=height+(adjust*2),$fn=90); - } - if(sink <= 3 && reverse == 1) { - translate([0,0,-adjust-height]) cylinder(d=holesize, h=height+(adjust*2),$fn=90); - } - // countersink hole - if(sink == 1 && reverse == 0) { - translate([0,0,-adjust]) cylinder(d1=6.5, d2=(holesize), h=3); - } - if(sink == 1 && reverse == 1) { - translate([0,0,+adjust-2.5]) cylinder(d1=(holesize), d2=6.5, h=3); - } - // recessed hole - if(sink == 2 && reverse == 0) { - translate([0,0,-adjust]) cylinder(d=6.5, h=3); - } - if(sink == 2 && reverse == 1) { - translate([0,0,+adjust-3]) cylinder(d=6.5, h=3); - } - // nut holder - if(sink == 3 && reverse == 0) { - translate([0,0,-adjust]) cylinder(r=3.3,h=3,$fn=6); - } - if(sink == 3 && reverse == 1) { - translate([0,0,+adjust-3]) cylinder(r=3.3,h=3,$fn=6); - } - // blind hole - if(sink == 4 && reverse == 0) { - translate([0,0,2]) cylinder(d=holesize, h=height,$fn=90); - } - if(sink == 4 && reverse == 1) { - translate([0,0,-height-2-adjust]) cylinder(d=holesize, h=height,$fn=90); - } - if(insert_e > 0 && reverse == 0) { - translate([0,0,height-i_depth]) cylinder(d=i_dia, h=i_depth+adjust,$fn=90); - } - if(insert_e > 0 && reverse == 1) { - translate([0,0,-height-adjust]) cylinder(d=i_dia, h=i_depth+adjust,$fn=90); - } - } -} - - -/* buttons */ -module button(style, size, radius, pad) { - - diameter = size[0]; - height = size[2]; - gap = 1.5; - adjust = .01; - $fn = 90; - - if(style == "recess") { - difference() { - union() { - sphere(d=diameter); - translate([0,0,-height+3]) cylinder(d=6, h=height-6); - } - translate([-(diameter/2)-1,-(diameter/2)-1,0]) cube([diameter+2,diameter+2,(diameter/2)+2]); - difference() { - union() { - sphere(d=diameter-2); - } - } - translate([-1.75,-1.25,-height-1]) cube([3.5,2.5,height+2]); - translate([0,0,-(diameter/2)]) cylinder(d=5, h=2); - } - } - if(style == "cutout") { - 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]); - difference() { - translate([-size[0]+3,-size[1]/2,-adjust]) - 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], - [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([0,0,2]) sphere(d=3); - } - translate([0,0,-pad+adjust]) cylinder(d=3, h=pad); - } -} - - -/* button plunger,top,clip */ -module button_assembly(style, diameter, height) { - -adjust = .01; -$fn = 90; - - if(style == "recess") { - button_plunger(style, diameter, height); - button_top(style, diameter, height); - translate([0,0,-height]) button_clip(style); - } -} - - -/* button plunger */ -module button_plunger(style, diameter, height) { - -adjust = .01; -$fn = 90; - - if(style == "recess") { - difference() { - translate([-1.5,-1,-(height)-2]) cube([3,2,height+1]); - translate([-1.5-adjust,-1.5,-height]) cube([.5,3,1]); - translate([1+adjust,-1.5,-height]) cube([.5,3,1]); - translate([-1.5-adjust,-1.5,-4]) cube([.5,3,4]); - translate([1+adjust,-1.5,-4]) cube([.5,3,4]); - } - } -} - - -/* button top */ -module button_top(style, diameter, height) { - -adjust = .01; -$fn = 90; - - if(style == "recess") { - difference() { - translate([0,0,-3]) cylinder(d=5, h=2.75); - translate([-1.25,-1.25,-3-adjust]) cube([2.5,2.5,2]); - } - } -} - - -/* button c-clip */ -module button_clip(style) { - -adjust = .01; -$fn = 90; - - if(style == "recess") { - difference() { - cylinder(d=8.5, h=.8); - translate([-1.5,-1.75,-adjust]) cube([2.75,3.5,1]); - translate([-.75,-.75,-adjust]) cube([5,1.25,1.25]); - } - } -} -/* case feet */ -module feet (diameter,height) { - - difference (){ - cylinder (d=diameter,h=height); - translate([0,0,-1]) cylinder (d=3, h=height+2,$fn=90); - translate ([0,0,-1]) cylinder(r=3.35,h=height-3,$fn=6); - } -} - - -// pcb bottom edge holder -module pcb_holder(size,wallthick) { - - adjust=.01; - $fn = 90; - difference() { - union() { - translate([-1.85,-1.75,0]) cube([size[0]+3.5,5,6]); - translate([size[0]+1.65,-5.75,1]) - rotate([0,-90,0]) - linear_extrude(height = size[0]+3.5) - polygon(points = [ [-wallthick/2,-wallthick/2], - [2,wallthick], - [4,4], - [-wallthick/2,4]]); - translate([-1.85,4,1]) - rotate([0,-90,180]) - linear_extrude(height = size[0]+3.5) - polygon(points = [ [-wallthick/2,-wallthick/2], - [2,wallthick], - [2,2], - [-wallthick/2,2]]); - } - translate([-.5,0,2]) cube([size[0]+1,size[2],5]); - translate([6,-adjust-5-1.75,-adjust]) cube([size[0]-12,14,8]); - } -} - - -/* odroid rtc battery holder */ -module batt_holder(tolerance) { - - $fn = 90; - difference () { - cylinder(d=25.5,h=6); - translate ([0,0,-1]) cylinder(d=20.4+tolerance,h=8); - cube([14,26,13], true); - } - cylinder(r=12.75, h=2); -} - - -/* odroid uart module holder */ -module uart_holder() { - - rotate([0,0,0]) - translate ([0,0,0]) - union () { - difference () { - translate ([0,0,0]) cube([18,24,9]); - translate ([2,-2,3]) cube([14,27,7]); - //pin slot - translate ([3.5,16,-1]) cube([11,1,5]); - //component bed - translate ([3.5,1.5,2]) cube ([11,14,2]); - //side trim - translate ([-1,-1,6]) cube([20,18,4]); - } - difference (){ - translate ([-1.5,20,0]) cylinder(r=3,h=9, $fn=90); - translate ([-1.5,20,-1]) cylinder (r=1.375, h=11, $fn=90); - } - difference (){ - translate ([19.5,20,0]) cylinder(r=3,h=9, $fn=90); - translate ([19.5,20,-1]) cylinder (r=1.375, h=11,$fn=90); - } - } - } - - -/* odroid uart strap for holder */ -module uart_strap() { - difference () { - translate ([-4.5,17,9]) cube([27,6,3]); - translate ([-1.5,20,8]) cylinder (r=1.6, h=5, $fn=90); - translate ([19.5,20,8]) cylinder (r=1.6, h=5, $fn=90); - } - difference (){ - translate ([-1.5,20,12]) cylinder(r=3,h=1, $fn=90); - translate ([-1.5,20,11]) cylinder (r=1.6, h=7, $fn=90); - } - difference (){ - translate ([19.5,20,12]) cylinder(r=3,h=1, $fn=90); - translate ([19.5,20,11]) cylinder (r=1.6, h=7, $fn=90); - } -} - -/* fan cover */ -module fan_cover(size, thick) { - difference() { - color("grey",1) slab([size,size,thick],3); - color("grey",1) fan_mask(size, thick, 2); - } -} - -/* hex vent panel */ -// borders: -// y - specified size along y axis -// x - specified size along x axis -// none - both borders the size of cell_spacing, no mounting holes -// anything else ("default") - all borders of specified size -// -module vent_panel_hex(x, y, thick, cell_size=8, cell_spacing=3, border=3, borders="default") { - hole = 3.2; - xb = (borders == "y" || borders == "none") ? cell_spacing : border; - yb = (borders == "x" || borders == "none") ? cell_spacing : border; - hxb = max(yb/2, cell_spacing + hole); - hyb = max(xb/2, cell_spacing + hole); - - cells_x = floor((2*(x-2*xb-cell_size)/(cell_size+cell_spacing))+1); - cells_y = floor(((sqrt(12)*(y-2*yb)-4*cell_size)/(3*(cell_size+cell_spacing)))+1); - csx = cell_size + (cells_x-1)*(cell_size+cell_spacing)/2; - csy = sqrt(4/3)*cell_size + ((cell_size+cell_spacing)*sqrt(3/4)*(cells_y-1)); - - difference() { - color("grey",1) slab([x,y,thick],2); - color("grey",1) translate([(x-csx)/2,(y-csy)/2,-1]) - vent_hex(cells_x, cells_y, thick+3, cell_size, cell_spacing, "horizontal"); - if (borders != "none") { - color("grey",1) translate([ hxb, hyb, -1]) cylinder(d=hole, h=thick+3); - color("grey",1) translate([x - hxb, hyb, -1]) cylinder(d=hole, h=thick+3); - color("grey",1) translate([ hxb, y - hyb, -1]) cylinder(d=hole, h=thick+3); - color("grey",1) translate([x - hxb, y - hyb, -1]) cylinder(d=hole, h=thick+3); - } - } -} - - -module hk_wb2() { - difference () { - union() { - color("tan") cube([16.5,16.5,1]); - translate([1.75,15.75,.75]) rotate([180,0,0]) header_f(6,9); - color("silver") translate([11.5,11.5,1]) cube([2,3,.5]); - color("silver") translate([11.5,3,1]) cube([2,3,.5]); - } - translate([9.6,8.33,-1]) - color("tan") hull() { - cylinder(d=1, h=3); - translate([5,0,0]) cylinder(d=1, h=3); - } - translate([7.36,2,-1]) rotate([0,0,90]) - color("tan") hull() { - cylinder(d=1, h=3); - translate([5,0,0]) cylinder(d=1, h=3); - } - } -} - - -/* odroid-hc4 oled holder */ -module hc4_oled_holder(side,wallthick) { - - adjust=.01; - $fn = 90; - difference() { - union() { - if(side == "top") { - translate([-1.85,-1.75,-4]) cube([32,5,4]); - translate([30.15,-3.75,1]) - rotate([0,-90,0]) - linear_extrude(height = 32) - polygon(points = [ [-wallthick/2,-wallthick/2], - [-4,wallthick], - [-4,2], - [-wallthick/2,2]]); - translate([-1.85,4,1]) - rotate([0,-90,180]) - linear_extrude(height = 32) - polygon(points = [ [-wallthick/2,-wallthick/2], - [-4,wallthick], - [-4,2], - [-wallthick/2,2]]); - } - if(side == "bottom") { - translate([-1.85,-1.75,0]) cube([32,5,4]); - translate([30.15,-3.75,1]) - rotate([0,-90,0]) - linear_extrude(height = 32) - polygon(points = [ [-wallthick/2,-wallthick/2], - [2,wallthick], - [2,2], - [-wallthick/2,2]]); - translate([-1.85,4,1]) - rotate([0,-90,180]) - linear_extrude(height = 32) - polygon(points = [ [-wallthick/2,-wallthick/2], - [2,wallthick], - [2,2], - [-wallthick/2,2]]); - } - } - if(side == "top") { - translate([-.5,0,wallthick-8]) cube([29.5,1.9,5]); - translate([(32.75/2-(15/2))-1.85,-adjust-3-1.75,-wallthick-2.5]) cube([15,12,wallthick+3]); - } - if(side == "bottom") { - translate([-.5,0,-adjust]) cube([29.5,1.42,5]); - translate([(32.75/2-(15/2))-1.85,-adjust-3-1.75,-adjust]) cube([15,12,8]); - translate([2.5,-adjust-3-1.75,-adjust]) cube([6,3,8]); - translate([12.5,adjust,10]) rotate([90,0,0]) cylinder(d=21, h=2); - } - } -} - - -module hd_mount(hd,orientation,position,side) { - - adjust = .01; - $fn = 90; - if(hd == 2.5) { - if(orientation == "portrait") { - if(position == "vertical") { - if(side == "left") { - translate([0,14,0]) rotate([0,0,0]) hd25_vtab("right"); - translate([0,90.6,0]) rotate([0,0,0]) hd25_vtab("right"); - } - else { // right - translate([0,14,0]) rotate([0,0,0]) hd25_vtab("left"); - translate([0,90.6,0]) rotate([0,0,0]) hd25_vtab("left"); - } - } - else { - translate([-.5,14,0]) hd25_tab("left"); - translate([-.5,90.6,0]) hd25_tab("left"); - translate([70.35,14,0]) hd25_tab("right"); - translate([70.35,90.6,0]) hd25_tab("right"); - } - } - if(orientation == "landscape") { - if(position == "vertical") { - if(side == "left") { - translate([9.4,0,0]) rotate([0,0,90]) hd25_vtab("right"); - translate([86,0,0]) rotate([0,0,90]) hd25_vtab("right"); - } - else { // right - translate([9.4,0,0]) rotate([0,0,90]) hd25_vtab("left"); - translate([86,0,0]) rotate([0,0,90]) hd25_vtab("left"); - } - } - else { - translate([9.4,4.07-4.5,0]) rotate([0,0,90]) hd25_tab("left"); - translate([86,4.07-4.5,0]) rotate([0,0,90]) hd25_tab("left"); - translate([86,65.79+4.5,0]) rotate([0,0,90]) hd25_tab("right"); - translate([9.4,65.79+4.5,0]) rotate([0,0,90]) hd25_tab("right"); - } - } - } - if(hd == 3.5) { - if(orientation == "portrait") { - if(position == "vertical") { - if(side == "left") { - translate([0,41.28,0]) rotate([0,0,0]) hd35_vtab("right"); - translate([0,41.28+44.45,0]) rotate([0,0,0]) hd35_vtab("right"); - translate([0,41.28+76.20,0]) rotate([0,0,0]) hd35_vtab("right"); - } - else { // right - translate([0,41.28,0]) rotate([0,0,0]) hd35_vtab("left"); - translate([0,41.28+44.45,0]) rotate([0,0,0]) hd35_vtab("left"); - translate([0,41.28+76.20,0]) rotate([0,0,0]) hd35_vtab("left"); - } - } - else { - translate([-.5,28.5,0]) hd35_tab("left"); - translate([-.5,69.75,0]) hd35_tab("left"); - translate([-.5,130.1,0]) hd35_tab("left"); - translate([101.6+.5,28.5,0]) hd35_tab("right"); - translate([101.6+.5,69.75,0]) hd35_tab("right"); - translate([101.6+.5,130.1,0]) hd35_tab("right"); - } - } - if(orientation == "landscape") { - if(position == "vertical") { - if(side == "left") { - translate([9.4,0,0]) rotate([0,0,90]) hd35_vtab("right"); - translate([86,0,0]) rotate([0,0,90]) hd35_vtab("right"); - } - else { // right - translate([9.4,0,0]) rotate([0,0,90]) hd35_vtab("left"); - translate([86,0,0]) rotate([0,0,90]) hd35_vtab("left"); - } - } - else { - translate([16.9,-.5,0]) rotate([0,0,90]) hd35_tab("left"); - translate([76.6,-.5,0]) rotate([0,0,90]) hd35_tab("left"); - translate([118.5,-.5,0]) rotate([0,0,90]) hd35_tab("left"); - translate([16.9,101.6-.5,0]) rotate([0,0,90]) hd35_tab("right"); - translate([76.6,101.6-.5,0]) rotate([0,0,90]) hd35_tab("right"); - translate([118.5,101.6-.5,0]) rotate([0,0,90]) hd35_tab("right"); - } - } - } -} - - -module hd25_tab(side) { - - width = 15; - l_width = 26; - depth = 15; - height = 4; - fillet = 2; - hole = 3.6; - length = 3; - - adjust = .01; - $fn = 90; - if(side == "left") { - difference() { - union() { - translate([0,-depth/2,0]) rotate([0,-90,0]) - slab_r([l_width,depth,height], [fillet,fillet,fillet,fillet]); - translate([-height,-depth/2,0]) cube([height,depth,height]); - translate([adjust,-5.5,depth]) - rotate([90,0,0]) - linear_extrude(height = 2) - polygon(points = [ [-height,height], - [-depth+4,-depth], - [-height,-depth]]); - translate([adjust,7.5,depth]) - rotate([90,0,0]) - linear_extrude(height = 2) - polygon(points = [ [-height,height], - [-depth+4,-depth], - [-height,-depth]]); - } - translate([4.07,0,-adjust]) rotate([0,0,0]) cylinder(d=hole, h=3); - translate([-height-adjust,(width/2)-(length/2)-depth/2,3]) rotate([90,0,90]) slot(hole,length,height+(2*adjust)); - translate([-height-adjust,(width/2)-(length/2)-depth/2,21]) rotate([90,0,90]) slot(hole,length,height+(2*adjust)); - } - } - if(side == "right") { - difference() { - union() { - translate([height,-depth/2,0]) rotate([0,-90,0]) - slab_r([l_width,depth,height], [fillet,fillet,fillet,fillet]); - translate([0,-depth/2,0]) cube([height,depth,height]); - translate([adjust,-7.5,depth]) - rotate([90,0,180]) - linear_extrude(height = 2) - polygon(points = [ [-height,height], - [-depth+4,-depth], - [-height,-depth]]); - translate([adjust,5.5,depth]) - rotate([90,0,180]) - linear_extrude(height = 2) - polygon(points = [ [-height,height], - [-depth+4,-depth], - [-height,-depth]]); - } - translate([-4.07,0,-adjust]) rotate([0,0,0]) cylinder(d=hole, h=3); - translate([-adjust,(width/2)-(length/2)-depth/2,3]) rotate([90,0,90]) slot(hole,length,height+(2*adjust)); - translate([-adjust,(width/2)-(length/2)-depth/2,21]) rotate([90,0,90]) slot(hole,length,height+(2*adjust)); - } - } -} - - -module hd25_vtab(side) { - - width = 15; - l_width = 16; - depth = 15; - height = 4; - fillet = 2; - hole = 3.6; - length = 3; - - adjust = .01; - $fn = 90; - if(side == "left") { - difference() { - union() { - translate([0,-depth/2,0]) rotate([0,-90,0]) - slab_r([l_width,depth,height], [fillet,fillet,fillet,fillet]); - translate([-height,-depth/2,0]) cube([height,depth,height]); - translate([adjust,-5.5,depth]) - rotate([90,0,0]) - linear_extrude(height = 2) - polygon(points = [ [-height,height-5], - [-depth+4,-depth], - [-height,-depth]]); - translate([adjust,7.5,depth]) - rotate([90,0,0]) - linear_extrude(height = 2) - polygon(points = [ [-height,height-5], - [-depth+4,-depth], - [-height,-depth]]); - } - translate([3,0,-adjust]) rotate([0,0,0]) cylinder(d=hole, h=3); - translate([-height-adjust,1.5+(width/2)-(length/2)-depth/2,5.57]) rotate([90,90,90]) slot(hole,length,height+(2*adjust)); - } - } - if(side == "right") { - difference() { - union() { - translate([height,-depth/2,0]) rotate([0,-90,0]) - slab_r([l_width,depth,height], [fillet,fillet,fillet,fillet]); - translate([0,-depth/2,0]) cube([height,depth,height]); - translate([adjust,-7.5,depth]) - rotate([90,0,180]) - linear_extrude(height = 2) - polygon(points = [ [-height,height-5], - [-depth+4,-depth], - [-height,-depth]]); - translate([adjust,5.5,depth]) - rotate([90,0,180]) - linear_extrude(height = 2) - polygon(points = [ [-height,height-5], - [-depth+4,-depth], - [-height,-depth]]); - } - translate([-3,0,-adjust]) rotate([0,0,0]) cylinder(d=hole, h=3); - translate([-adjust,1.5+(width/2)-(length/2)-depth/2,5.57]) rotate([90,90,90]) slot(hole,length,height+(2*adjust)); - } - } -} - - -module hd35_tab(side) { - - width = 15; - l_width = 46; - depth = 15; - height = 4; - fillet = 2; - hole = 3.6; - length = 3; - - adjust = .01; - $fn = 90; - if(side == "left") { - difference() { - union() { - translate([0,-depth/2,0]) rotate([0,-90,0]) - slab_r([l_width,depth,height], [fillet,fillet,fillet,fillet]); - translate([-height,-depth/2,0]) cube([height,depth,height]); - - translate([adjust,-5.5,depth]) - rotate([90,0,0]) - linear_extrude(height = 2) - polygon(points = [ [-height,height+20], - [-depth+4,-depth], - [-height,-depth]]); - translate([adjust,7.5,depth]) - rotate([90,0,0]) - linear_extrude(height = 2) - polygon(points = [ [-height,height+20], - [-depth+4,-depth], - [-height,-depth]]); - - } - translate([3.18,0,-adjust]) rotate([0,0,0]) cylinder(d=hole, h=3); - translate([-height-adjust,(width/2)-(length/2)-depth/2,6.35]) rotate([90,0,90]) slot(hole,length,height+(2*adjust)); - translate([-height-adjust,(width/2)-(length/2)-depth/2,38.35]) rotate([90,0,90]) slot(hole,length,height+(2*adjust)); - } - } - if(side == "right") { - difference() { - union() { - translate([height,-depth/2,0]) rotate([0,-90,0]) - slab_r([l_width,depth,height], [fillet,fillet,fillet,fillet]); - translate([0,-depth/2,0]) cube([height,depth,height]); - - translate([adjust,-7.5,depth]) - rotate([90,0,180]) - linear_extrude(height = 2) - polygon(points = [ [-height,height+20], - [-depth+4,-depth], - [-height,-depth]]); - translate([adjust,5.5,depth]) - rotate([90,0,180]) - linear_extrude(height = 2) - polygon(points = [ [-height,height+20], - [-depth+4,-depth], - [-height,-depth]]); - - } - translate([-3.18,0,-adjust]) rotate([0,0,0]) cylinder(d=hole, h=3); - translate([-adjust,(width/2)-(length/2)-depth/2,6.35]) rotate([90,0,90]) slot(hole,length,height+(2*adjust)); - translate([-adjust,(width/2)-(length/2)-depth/2,38.35]) rotate([90,0,90]) slot(hole,length,height+(2*adjust)); - } - } -} - -module hd35_vtab(side) { - - width = 15; - l_width = 16; - depth = 15; - height = 4; - fillet = 2; - hole = 3.6; - length = 3; - - adjust = .01; - $fn = 90; - if(side == "left") { - difference() { - union() { - translate([0,-depth/2,0]) rotate([0,-90,0]) - slab_r([l_width,depth,height], [fillet,fillet,fillet,fillet]); - translate([-height,-depth/2,0]) cube([height,depth,height]); - translate([adjust,-5.5,depth]) - rotate([90,0,0]) - linear_extrude(height = 2) - polygon(points = [ [-height,height-5], - [-depth+4,-depth], - [-height,-depth]]); - translate([adjust,7.5,depth]) - rotate([90,0,0]) - linear_extrude(height = 2) - polygon(points = [ [-height,height-5], - [-depth+4,-depth], - [-height,-depth]]); - } - translate([3,0,-adjust]) rotate([0,0,0]) cylinder(d=hole, h=3); - translate([-height-adjust,1.5+(width/2)-(length/2)-depth/2,5.57]) rotate([90,90,90]) slot(hole,length,height+(2*adjust)); - } - } - if(side == "right") { - difference() { - union() { - translate([height,-depth/2,0]) rotate([0,-90,0]) - slab_r([l_width,depth,height], [fillet,fillet,fillet,fillet]); - translate([0,-depth/2,0]) cube([height,depth,height]); - translate([adjust,-7.5,depth]) - rotate([90,0,180]) - linear_extrude(height = 2) - polygon(points = [ [-height,height-5], - [-depth+4,-depth], - [-height,-depth]]); - translate([adjust,5.5,depth]) - rotate([90,0,180]) - linear_extrude(height = 2) - polygon(points = [ [-height,height-5], - [-depth+4,-depth], - [-height,-depth]]); - } - translate([-3,0,-adjust]) rotate([0,0,0]) cylinder(d=hole, h=3); - translate([-adjust,1.5+(width/2)-(length/2)-depth/2,5.57]) rotate([90,90,90]) slot(hole,length,height+(2*adjust)); - } - } -} - - -module hd_bottom_holes(hd,orientation,position,side,thick) { - - adjust = .01; - $fn = 90; - if(hd == 2.5) { - if(orientation == "portrait") { - if(position == "vertical") { - if(side == "left") { - translate([-3,14,0]) cylinder(d=3.6,h=thick+(adjust*2)); - translate([-3,90.6,0]) cylinder(d=3.6,h=thick+(adjust*2)); - } - else { - // portrait 2.5" bottom screw holes - translate([3,14,0]) cylinder(d=3.6,h=thick+(adjust*2)); - translate([3,90.6,0]) cylinder(d=3.6,h=thick+(adjust*2)); - } - } - else { - // portrait 2.5" bottom screw holes - translate([4.07,14,0]) cylinder(d=3.6,h=thick+(adjust*2)); - translate([4.07,90.6,0]) cylinder(d=3.6,h=thick+(adjust*2)); - translate([65.79,90.6,0]) cylinder(d=3.6,h=thick+(adjust*2)); - translate([65.79,14,0]) cylinder(d=3.6,h=thick+(adjust*2)); - - } - } - if(orientation == "landscape") { - if(position == "vertical") { - if(side == "left") { - translate([9.4,-3,0]) cylinder(d=3.6,h=thick+5); - translate([86,-3,0]) cylinder(d=3.6,h=thick+5); - } - else { - echo(side); - translate([9.4,3,0]) cylinder(d=3.6,h=thick+5); - translate([86,3,0]) cylinder(d=3.6,h=thick+5); - } - } - else { - // landscape 2.5" bottom screw holes - translate([9.4,4.07,0]) cylinder(d=3.6,h=thick+(adjust*2)); - translate([86,4.07,0]) cylinder(d=3.6,h=thick+(adjust*2)); - translate([86,65.79,0]) cylinder(d=3.6,h=thick+(adjust*2)); - translate([9.4,65.79,0]) cylinder(d=3.6,h=thick+(adjust*2)); - } - } - } - if(hd == 3.5) { - if(orientation == "portrait") { - if(position == "vertical") { - if(side == "left") { - translate([-6,28.5,0]) cylinder(d=3.6,h=thick+5); - translate([-6,70.5,0]) cylinder(d=3.6,h=thick+5); - translate([-6,28.5+101.6,0]) cylinder(d=3.6,h=thick+5); - } - else { - // portrait 3.5" bottom screw holes - translate([6,28.5,0]) cylinder(d=3.6,h=thick+5); - translate([6,70.5,0]) cylinder(d=3.6,h=thick+5); - translate([6,28.5+101.6,0]) cylinder(d=3.6,h=thick+5); - } - } - else { - // portrait 3.5" bottom screw holes - translate([3.18,41.28,0]) cylinder(d=3.6,h=thick+(adjust*2)); - translate([3.18,85.73,0]) cylinder(d=3.6,h=thick+(adjust*2)); - translate([3.18,117.48,0]) cylinder(d=3.6,h=thick+(adjust*2)); - translate([98.43,41.28,0]) cylinder(d=3.6,h=thick+(adjust*2)); - translate([98.43,85.73,0]) cylinder(d=3.6,h=thick+(adjust*2)); - translate([98.43,117.48,0]) cylinder(d=3.6,h=thick+(adjust*2)); - } - } - if(orientation == "landscape") { - // landscape 3.5" bottom screw holes - translate([29.52,3.18,0]) cylinder(d=3.6,h=thick+(adjust*2)); - translate([61.27,3.18,0]) cylinder(d=3.6,h=thick+(adjust*2)); - translate([105.72,3.18,0]) cylinder(d=3.6,h=thick+(adjust*2)); - translate([29.52,98.43,0]) cylinder(d=3.6,h=thick+(adjust*2)); - translate([61.27,98.43,0]) cylinder(d=3.6,h=thick+(adjust*2)); - translate([105.72,98.43,0]) cylinder(d=3.6,h=thick+(adjust*2)); - } - } -} - - -/* hard drive 2.5", height=drive height */ -module hd25(height) { - - hd25_x = 100; - hd25_y = 69.85; - hd25_z = height; - - adjust = .01; - $fn=90; - - difference() { - color("LightGrey",.6) cube([hd25_x,hd25_y,hd25_z]); - - // bottom screw holes - color("Black",.6) translate([9.4,4.07,-adjust]) cylinder(d=3,h=3); - color("Black",.6) translate([86,4.07,-adjust]) cylinder(d=3,h=3); - color("Black",.6) translate([86,65.79,-adjust]) cylinder(d=3,h=4); - color("Black",.6) translate([9.4,65.79,-adjust]) cylinder(d=3,h=4); - - // side screw holes - color("Black",.6) translate([9.4,-adjust,3]) rotate([-90,0,0]) cylinder(d=3,h=3); - color("Black",.6) translate([86,-adjust,3]) rotate([-90,0,0]) cylinder(d=3,h=3); - color("Black",.6) translate([86,hd25_y+adjust,3]) rotate([90,0,0]) cylinder(d=3,h=3); - color("Black",.6) translate([9.4,hd25_y+adjust,3]) rotate([90,0,0]) cylinder(d=3,h=3); - - // connector opening - color("LightSlateGray",.6) translate([hd25_x-5,11,-1]) cube([5+adjust,32,5+adjust]); - } -} - - -/* hard drive 3.5" */ -module hd35() { - - hd35_x = 147; - hd35_y = 101.6; - hd35_z = 26.1; - - adjust = .01; - $fn=90; - - difference() { - color("LightGrey",.6) cube([hd35_x,hd35_y,hd35_z]); - - // bottom screw holes - color("Black",.6) translate([29.52,3.18,-adjust]) cylinder(d=3,h=3+adjust); - color("Black",.6) translate([61.27,3.18,-adjust]) cylinder(d=3,h=3+adjust); - color("Black",.6) translate([105.72,3.18,-adjust]) cylinder(d=3,h=3+adjust); - color("Black",.6) translate([29.52,98.43,-adjust]) cylinder(d=3,h=3+adjust); - color("Black",.6) translate([61.27,98.43,-adjust]) cylinder(d=3,h=3+adjust); - color("Black",.6) translate([105.72,98.43,-adjust]) cylinder(d=3,h=3+adjust); - - // side screw holes - color("Black",.6) translate([16.9,-adjust,6.35]) rotate([-90,0,0]) cylinder(d=3,h=3); - color("Black",.6) translate([76.6,-adjust,6.35]) rotate([-90,0,0]) cylinder(d=3,h=3); - color("Black",.6) translate([118.5,-adjust,6.35]) rotate([-90,0,0]) cylinder(d=3,h=3); - color("Black",.6) translate([118.5,hd35_y+adjust,6.35]) rotate([90,0,0]) cylinder(d=3,h=3); - color("Black",.6) translate([76.6,hd35_y+adjust,6.35]) rotate([90,0,0]) cylinder(d=3,h=3); - color("Black",.6) translate([16.9,hd35_y+adjust,6.35]) rotate([90,0,0]) cylinder(d=3,h=3); - - // connector opening - color("LightSlateGray",.6) translate([hd35_x-5,11,-1]) cube([5+adjust,32,5+adjust]); - - } -} - - -/* 3.5" hdd to 2.5" hdd holder */ -module hdd35_25holder(length,width=101.6) { - wallthick = 3; - floorthick = 2; - hd35_x = length; // 145mm for 3.5" drive - hd35_y = width; - hd35_z = 12; - hd25_x = 100; - hd25_y = 69.85; - hd25_z = 9.5; - hd25_xloc = 2; // or (hd35_x-hd25_x)/2 - hd25_yloc = (hd35_y-hd25_y)/2; - hd25_zloc = 9.5; - adjust = .1; - $fn=90; - difference() { - union() { - difference() { - translate([(hd35_x/2),(hd35_y/2),(hd35_z/2)]) - cube_fillet_inside([hd35_x,hd35_y,hd35_z], - vertical=[3,3,3,3], top=[0,0,0,0], bottom=[0,0,0,0], $fn=90); - translate([(hd35_x/2),(hd35_y/2),(hd35_z/2)+floorthick]) - cube_fillet_inside([hd35_x-(wallthick*2),hd35_y-(wallthick*2),hd35_z], - vertical=[0,0,0,0], top=[0,0,0,0], bottom=[0,0,0,0], $fn=90); - - // end trim - translate([-adjust,5,wallthick+2]) cube([wallthick+(adjust*2),hd35_y-10,10]); - translate([hd35_x-wallthick-adjust,5,wallthick+2]) cube([wallthick+(adjust*2),hd35_y-10,10]); - - // bottom vents - for ( r=[15:40:hd35_x-40]) { - for (c=[hd35_y-76:4:75]) { - translate ([r,c,-adjust]) cube([35,2,wallthick+(adjust*2)]); - } - } - } - // 2.5 hdd bottom support - translate([9.4+hd25_xloc,4.07+hd25_yloc,floorthick-adjust]) cylinder(d=8,h=4); - translate([86+hd25_xloc,4.07+hd25_yloc,floorthick-adjust]) cylinder(d=8,h=4); - translate([86+hd25_xloc,65.79+hd25_yloc,floorthick-adjust]) cylinder(d=8,h=4); - translate([9.4+hd25_xloc,65.79+hd25_yloc,floorthick-adjust]) cylinder(d=8,h=4); - - // side nut holder support - translate([16,wallthick-adjust,7]) rotate([-90,0,0]) cylinder(d=10,h=3); - translate([76,wallthick-adjust,7]) rotate([-90,0,0]) cylinder(d=10,h=3); - if(length >= 120) { - translate([117.5,wallthick-adjust,7]) rotate([-90,0,0]) cylinder(d=10,h=3); - translate([117.5,hd35_y-wallthick+adjust,7]) rotate([90,0,0]) cylinder(d=10,h=3); - } - translate([76,hd35_y-wallthick+adjust,7]) rotate([90,0,0]) cylinder(d=10,h=3); - translate([16,hd35_y-wallthick+adjust,7]) rotate([90,0,0]) cylinder(d=10,h=3); - - // bottom-side support - translate([wallthick,wallthick,floorthick-2]) rotate([45,0,0]) cube([hd35_x-(wallthick*2),3,3]); - translate([wallthick,hd35_y-wallthick+adjust,floorthick-2]) rotate([45,0,0]) cube([hd35_x-(wallthick*2),3,3]); - - } - // bottom screw holes - translate([9.4+hd25_xloc,4.07+hd25_yloc,-adjust]) cylinder(d=3,h=(floorthick*3)+(adjust*2)); - translate([86+hd25_xloc,4.07+hd25_yloc,-adjust]) cylinder(d=3,h=(floorthick*3)+(adjust*2)); - translate([86+hd25_xloc,65.79+hd25_yloc,-adjust]) cylinder(d=3,h=(floorthick*3)+(adjust*2)); - translate([9.4+hd25_xloc,65.79+hd25_yloc,-adjust]) cylinder(d=3,h=(floorthick*3)+(adjust*2)); - - // countersink holes - translate([9.4+hd25_xloc,4.07+hd25_yloc,-adjust]) cylinder(d1=6.5, d2=3, h=3); - translate([86+hd25_xloc,4.07+hd25_yloc,-adjust]) cylinder(d1=6.5, d2=3, h=3); - translate([86+hd25_xloc,65.79+hd25_yloc,-adjust]) cylinder(d1=6.5, d2=3, h=3); - translate([9.4+hd25_xloc,65.79+hd25_yloc,-adjust]) cylinder(d1=6.5, d2=3, h=3); - // side screw holes - translate([16,-adjust,7]) rotate([-90,0,0]) cylinder(d=3.6,h=7); - translate([76,-adjust,7]) rotate([-90,0,0]) cylinder(d=3.6,h=7); - translate([117.5,-adjust,7]) rotate([-90,0,0]) cylinder(d=3.6,h=7); - translate([117.5,hd35_y+adjust,7]) rotate([90,0,0]) cylinder(d=3.6,h=7); - translate([76,hd35_y+adjust,7]) rotate([90,0,0]) cylinder(d=3.6,h=7); - translate([16,hd35_y+adjust,7]) rotate([90,0,0]) cylinder(d=3.6,h=7); - - // side nut trap - translate([16,wallthick-adjust,7]) rotate([-90,0,0]) cylinder(r=3.30,h=5,$fn=6); - translate([76,wallthick-adjust,7]) rotate([-90,0,0]) cylinder(r=3.30,h=5,$fn=6); - translate([117.5,wallthick-adjust,7]) rotate([-90,0,0]) cylinder(r=3.30,h=5,$fn=6); - translate([117.5,hd35_y-wallthick-adjust,7]) rotate([90,0,0]) cylinder(r=3.30,h=5,$fn=6); - translate([76,hd35_y-wallthick-adjust,7]) rotate([90,0,0]) cylinder(r=3.30,h=5,$fn=6); - translate([16,hd35_y-wallthick-adjust,7]) rotate([90,0,0]) cylinder(r=3.30,h=5,$fn=6); - } -} + see https://github.com/hominoids/SBC_Case_Builder - -/* odroid-hc4 oled */ -module hc4_oled() { - -adjust = .01; -$fn=90; - -oled_x = 28.5; -oled_y = 1.25; -oled_z = 48.6; - -oled_open_x = 29; -oled_open_y = 1.5; - difference() { - union() { - // pcb board - color("Tan", 1) translate([0,0,0]) cube([oled_x,oled_y,oled_z]); - // oled - color("Black", 1) translate([.5,1.25,25.5]) cube([oled_x-1,.625,15]); - color("DarkGrey", 1) translate([.5,1.25,40.5]) cube([oled_x-1,.625,4]); - } - translate([2.8,0,46.7]) { - translate([-.6,1.26,0]) rotate([90,0,0]) - hull() { - translate([1.2,0,0]) cylinder(d=1.8, h=1.25+(adjust*2)); - cylinder(d=1.8, h=1.25+(adjust*2)); - } - } - translate([25.7,0,46.7]) { - translate([-.6,1.26,0]) rotate([90,0,0]) - hull() { - translate([1.2,0,0]) cylinder(d=1.8, h=1.25+(adjust*2)); - cylinder(d=1.8, h=1.25+(adjust*2)); - } - } - - } -} - - -/* h2 network card */ -module h2_netcard() { - - adjust = .01; - $fn = 90; - difference() { - union() { - color("tan") translate ([0,0,0]) linear_extrude(height = 1) import("./dxf/hk-network-card.dxf"); - color("goldenrod") translate([3.75,17.85,1-adjust]) cylinder(d=6,h=3); - color("goldenrod") translate([106,24.85,1-adjust]) cylinder(d=6,h=3); - } - translate([20.85,3.85,-adjust]) cylinder(d=3,h=4); - translate([3.75,17.85,-adjust]) cylinder(d=3,h=6); - translate([3.75,51.1,-adjust]) cylinder(d=3,h=4); - translate([20.15,43.85,-adjust]) cylinder(d=3,h=4); - translate([106,24.85,-adjust]) cylinder(d=3,h=6); - translate([96.5,3.85,-adjust]) cylinder(d=3,h=4); - } - rj45(26,-1,0,"bottom",1); - rj45(43,-1,0,"bottom",1); - rj45(60,-1,0,"bottom",1); - rj45(77,-1,0,"bottom",1); - place(30,25,0,6,6,0,"bottom") color("dimgray") translate([0,0,0]) cube([6,6,.8]); - place(47,25,0,6,6,0,"bottom") color("dimgray") translate([0,0,0]) cube([6,6,.8]); - place(64,25,0,6,6,0,"bottom") color("dimgray") translate([0,0,0]) cube([6,6,.8]); - place(79,25,0,6,6,0,"bottom") color("dimgray") translate([0,0,0]) cube([6,6,.8]); - place(56.5,41,0,5,9.75,0,"bottom") color("dimgray") translate([0,0,0]) cube([5,9.75,.8]); - for (i=[34.65:.5:48.5]) { - color("gold") translate([98,i,1]) cube([2,.25,.25]); - color("gold") translate([98,i,-.24]) cube([2,.25,.25]); - } - for (i=[51:.5:53]) { - color("gold") translate([98,i,1]) cube([2,.25,.25]); - color("gold") translate([98,i,-.24]) cube([2,.25,.25]); - } - -} - - -/* hk 3.5 lcd */ -module hk35_lcd() { - - adjust = .01; - $fn = 90; - difference() { - union() { - color("tan") translate ([0,0,0]) slab([95,56,1.7],3.5); - color("black",1) translate([10.5,0,1.7]) cube([74.75,54.5,4]); - color("white",1) translate([8.5,0,5.7-adjust]) cube([82.75,54.5,2]); - color("grey",1) translate([8.5,0,7.7-adjust]) cube([82.75,54.5,.8]); - color("dimgrey",1) translate([15,2,8.5-adjust]) cube([75.5,51,.25]); - } - translate([3.5,3.5,-adjust]) cylinder(d=3,h=6); - translate([3.5,52.5,-adjust]) cylinder(d=3,h=4); - } - translate([3,8.75,1.70-adjust]) momentary45x15(); - translate([3,19.75,1.70-adjust]) momentary45x15(); - translate([3,30.75,1.70-adjust]) momentary45x15(); - translate([3,41.75,1.70-adjust]) momentary45x15(); - color("black") translate([7.375,.8,-9+adjust]) cube([51.5,5,9]); - translate([92.5,4,adjust]) rotate([0,180,0]) header(5); - } - - -// hk console uart model -module hk_uart() { - - size = [22,13,1.25]; - adjust = .01; - $fn = 90; - color("tan") cube([size[0],size[1],size[2]]); - translate([6.5,.25,6.25-adjust]) rotate([90,180,-90]) uart_micro(); - translate([6.75,3,-2+adjust])cylinder(d=1, 2); - translate([6.75,5.25,-2+adjust])cylinder(d=1, 2); - translate([6.75,7.5,-2+adjust])cylinder(d=1, 2); - translate([6.75,9.75,-2+adjust])cylinder(d=1, 2); - translate([23,2.75,1.25]) rotate([0,0,90]) usb_micro(); - translate([13,4.5,1.25]) rotate([0,0,90]) ic([4,4,1]); -} - - -// hk vu7c lcd display -module hk_vu7c(gpio_ext, tabs) { - - lcd_size = [164.85,100,5.48]; - pcb_size = [184.6,75,1.6]; - view_size = [155,88.5,.125]; // 154.21 x 85.92 - hole = 3.2; - length = 24-hole; - depth = 2; - adjust = .1; - $fn = 90; - difference() { - union() { - color("lightgray") translate([0,0,pcb_size[2]+3.12]) cube(lcd_size); - if(tabs == true) { - color("black") translate([-(pcb_size[0]-lcd_size[0])/2,lcd_size[1]-pcb_size[1]-1,0]) - cube(pcb_size); - } - else { - color("black") translate([0,lcd_size[1]-pcb_size[1]-1,0]) - cube([pcb_size[0]-20,pcb_size[1],pcb_size[2]]); - } - color("black") translate([3,7.5,pcb_size[2]+3.12+lcd_size[2]-adjust]) cube(view_size); - // tabs - color("black") translate([51.8,99,0]) slab_r([8,8,1.6],[.1,4,4,.1]); - color("black") translate([104.8,99,0]) slab_r([8,8,1.6],[.1,4,4,.1]); - } - // slots - color("dimgray") translate([-(pcb_size[0]-lcd_size[0])/4,lcd_size[1]-1-7,-adjust]) - rotate([0,0,-90]) slot(hole,length,depth); - color("dimgray") translate([-(pcb_size[0]-lcd_size[0])/4,lcd_size[1]-1-46,-adjust]) - rotate([0,0,-90]) slot(hole,length,depth); - color("dimgray") translate([(pcb_size[0]-(pcb_size[0]-lcd_size[0])/2)-(pcb_size[0]-lcd_size[0])/4, - lcd_size[1]-1-7,-adjust]) rotate([0,0,-90]) slot(hole,length,depth); - color("dimgray") translate([(pcb_size[0]-(pcb_size[0]-lcd_size[0])/2)-(pcb_size[0]-lcd_size[0])/4, - lcd_size[1]-1-46,-adjust]) rotate([0,0,-90]) slot(hole,length,depth); - // holes - color("dimgray") translate([55.8,103.5,-adjust]) cylinder(d=hole, h=3); - color("dimgray") translate([108.8,103.5,-adjust]) cylinder(d=hole, h=3); - // pcb cuts - color("dimgray") translate([66,97.5,-adjust]) slab_r([20.3,4,2],[1,1,1,1]); - color("dimgray") translate([17.8,lcd_size[1]-pcb_size[1]-2,-adjust]) slab_r([78.8,6,2],[1,1,1,1]); - } - // components - translate([70+14.5,28.58,0]) rotate([180,0,180]) hdmi_a(); - translate([47.49-1,42.09-.75,0]) rotate([180,0,90]) header_f(7,15); - translate([39.5,80.19-1,0]) rotate([180,0,90]) header_f(20,15); - translate([39.5,82.73-1,0]) rotate([180,0,90]) header_f(20,15); - translate([13.15+2.75-.25,36.71-1.25,0]) rotate([180,0,180]) header(7); - translate([23.58+2.5,74.42-1.25,0]) rotate([180,0,180]) header(5); - translate([98+2,26.04-2,0]) rotate([180,0,180]) pcb_pad(7); - color("dimgray") translate([16.25,69.4,-1.99]) cube([4,4,2]); - translate([18.5,58,-1.99]) cube([25,5.5,2]); - translate([80.5,52.5,-1.99]) cube([4.5,3.5,2]); - // gpio extension - if(gpio_ext == true) { - translate([57.37-1.25,94.93-1.25,0]) rotate([180,0,90]) header(20); - translate([57.37-1.25,92.39-1.25,0]) rotate([180,0,90]) header(20); - } - else { - translate([57.37-2,94.93-2,0]) rotate([180,0,90]) pcb_pad(20); - translate([57.37-2,92.39-2,0]) rotate([180,0,90]) pcb_pad(20); - } - translate([59,52.69,-1.59]) ic(9); -} - - -// hk vu8m lcd display -module hk_vu8m(brackets) { - $fn = 90; - - m1_screw_spacing = 72; - - body_size = [ 198, 133, 1.93]; - glass_size = [ 195.73, 131.14, 1.60]; - lcd_size = [ 184.63, 114.94, body_size[2] + 0.40]; - view_size = [ 173.23, 108.64, .1]; - - rb = 5.25; // body edge radius - - lcd_clearance = [0.15, 0.1, 0]; - pcb_size = [14,24,1.6]; - hole = 4.31; - spacer_size = [5.5, 6, 2.5, 5.5, 1, 0, 1, 1, 0, 0, 0]; - - // "body" - color([0.1,0.1,0.1]) - difference(){ - slab(body_size, rb); - lcd_space = lcd_size + 2*lcd_clearance; - translate([3.76 , 9 , -1]) cube(lcd_space); - translate([3.76 , 9 , -1]) cylinder(r=1.3, h=5); - translate([3.76 + lcd_space[0], 9 , -1]) cylinder(r=1.3, h=5); - translate([3.76 , 9 + lcd_space[1], -1]) cylinder(r=1.3, h=5); - translate([3.76 + lcd_space[0], 9 + lcd_space[1], -1]) cylinder(r=1.3, h=5); - // 8x holes in body - translate([ 44.5, 4.5, -1]) cylinder(d=hole, h=5); - translate([ 51.5, 4.5, -1]) cylinder(d=hole, h=5); - translate([ 183.5, 4.5, -1]) cylinder(d=hole, h=5); - translate([ 190.5, 4.5, -1]) cylinder(d=hole, h=5); - translate([ 44.5, body_size[1]-4.5, -1]) cylinder(d=hole, h=5); - translate([ 51.5, body_size[1]-4.5, -1]) cylinder(d=hole, h=5); - translate([ 183.5, body_size[1]-4.5, -1]) cylinder(d=hole, h=5); - translate([ 190.5, body_size[1]-4.5, -1]) cylinder(d=hole, h=5); - - } - // 4x standoffs - color([0.6,0.6,0.6]) { - translate([ 44.5, 4.5, 0]) standoff(spacer_size); - translate([ 183.5, 4.5, 0]) standoff(spacer_size); - translate([ 44.5, body_size[1]-4.5, 0]) standoff(spacer_size); - translate([ 183.5, body_size[1]-4.5, 0]) standoff(spacer_size); - } - // LCD panel - color([0.6, 0.6, 0.65]) - translate([3.76, 9, body_size[2]-lcd_size[2]]+lcd_clearance) - cube(lcd_size); - - // Front glass - // It's actually thinner and glued, but for the sake of simplicity... - color([0.2, 0.2, 0.2], 0.9) - translate([0.86, 1.38, body_size[2] + 0.01]) - slab(glass_size, rb); - - // view area - color("dimgrey", 0.9) - translate([(glass_size[0]-view_size[0])/2, (glass_size[1]-view_size[1])/2, body_size[2] + glass_size[2]- 0.01]) - slab(view_size, .1); - - // PCB stub - color([0.1,0.1,0.1]) - translate([20.5, 24.5, -3]) - cube(pcb_size); - color("dimgrey") - translate([22.5, 26.5, -2]) - cube([8,16,3]); - color([0.1,0.1,0.1]) - translate([12, 21, -2]) - cube([7,7,1.6]); - color([0.1,0.1,0.1]) - translate([10, 34, -2]) - cube([4,10,1.6]); - - //Brackets - if(brackets) { - translate([44.5 - 7.5, body_size[1]/2 + m1_screw_spacing/2 - 7.5, - spacer_size[1] - 2]) u_bracket(); - translate([44.5 - 7.5, body_size[1]/2 - m1_screw_spacing/2 + 7.5, - spacer_size[1] - 2 + 1.93]) rotate([180,0,0]) u_bracket(); - - //Screws - color([0.1,0.1,0.1]) { - translate([ 44.5, 4.5, -8]) rotate([180,0,0]) screw([3,7,0]); - translate([ 183.5, 4.5, -8]) rotate([180,0,0]) screw([3,7,0]); - translate([ 44.5, body_size[1]-4.5, -8]) rotate([180,0,0]) screw([3,7,0]); - translate([ 183.5, body_size[1]-4.5, -8]) rotate([180,0,0]) screw([3,7,0]); - } - } -} - -// Vu8M LCD U-BRACKET -module u_bracket() { - $fn= 30; - xi = 124; - xo = 154; - yi = 42; - yo = 42 + 12; // Outer vertical dimension - z = 1.93; - rlo = 21.3; // Lower outer corner radii - rli = 1; // Lower inner corner radii - ruo = 5.7; // Upper outer corner radii - rui = 5.7; // Upper inner corner radii - - color([0.2,0.2,0.2]) - difference() { - union() { - hull() { - translate([ rlo, rlo,0]) cylinder(r=rlo, h=z, $fn=100); - translate([xo - rlo, rlo,0]) cylinder(r=rlo, h=z, $fn=100); - } - hull() { - translate([ ruo, yo - ruo,0]) cylinder(r=ruo, h=z); - translate([ 15 - rui, yo - rui,0]) cylinder(r=rui, h=z); - translate([ 0, rlo,0]) cube([15,$fs,z]); - } - hull() { - translate([xo - ruo, yo - ruo,0]) cylinder(r=ruo, h=z); - translate([xo - 15 + rui, yo - rui,0]) cylinder(r=rui, h=z); - translate([xo - 15 , rlo,0]) cube([15,$fs,z]); - } - } - hull() { - translate([ 15 + rli, yo - yi + rli,-1]) cylinder(r=rli, h=z+2); - translate([xo - 15 - rli, yo - yi + rli,-1]) cylinder(r=rli, h=z+2); - translate([ 15, yo,-1]) cube([xi,$fs,z+2]); - } - translate([ 7.5, yo - 4, -1]) cylinder(d=3.21, h=z+2); - translate([xo - 7.5, yo - 4, -1]) cylinder(d=3.21, h=z+2); - hull() { - translate([ 7.5, yo - 9.6, -1]) cylinder(d=3.21, h=z+2); - translate([ 7.5, yo - 29.4, -1]) cylinder(d=3.21, h=z+2); - } - hull() { - translate([xo - 7.5, yo - 9.6, -1]) cylinder(d=3.21, h=z+2); - translate([xo - 7.5, yo - 29.4, -1]) cylinder(d=3.21, h=z+2); - } - translate([ 15 + 5.00, 8.25, -1]) cylinder(d=4.11, h=z+2); - translate([xo - 15 - 30.00, 8.25, -1]) cylinder(d=4.11, h=z+2); - translate([ 15 + 10.75, 2.50, -1]) cylinder(d=4.11, h=z+2); - translate([ 15 + 41.75, 2.50, -1]) cylinder(d=4.11, h=z+2); - translate([ 15 + 82.25, 2.50, -1]) cylinder(d=4.11, h=z+2); - translate([ 15 + 113.25, 2.50, -1]) cylinder(d=4.11, h=z+2); - } -} - -// hk vu8s lcd display -module hk_vu8s() { - - body_size = [202, 133, 1.70]; - glass_size = [195.5, 131, 1.75]; - lcd_size = [183.5,114, body_size[2] + 1]; - view_size = [172.5, 107.5, .1]; - - rb = 5.25; // body edge radius - - lcd_clearance = [0.15, 0.1, 0]; - pcb_size = [14,24,1.6]; - hole = 4.31; - spacer_size = [5.5, 1.75+body_size[2], 2.5, 5.5, 1, 0, 1, 1, 0, 0, 0]; - - $fn = 90; - adj = .01; - - // "body" - color([0.1,0.1,0.1]) - difference(){ - union() { - slab(body_size, rb); - translate([(8.25/2),-1.74-(8.25/2),0]) rotate([0,0,90]) slot(8.25,10+(8.25/2),body_size[2]); - translate([body_size[0]-(8.25/2),-1.74-(8.25/2),0]) rotate([0,0,90]) slot(8.25,10+(8.25/2),body_size[2]); - translate([(8.25/2),body_size[1]-10,0]) rotate([0,0,90]) slot(8.25,10.75+(8.25/2),body_size[2]); - translate([body_size[0]-(8.25/2),body_size[1]-10,0]) rotate([0,0,90]) slot(8.25,10.75+(8.25/2),body_size[2]); - } - lcd_space = lcd_size + 2*lcd_clearance; - - // corner holes - translate([4, -5, -1]) cylinder(d=hole, h=5); - translate([4, 143-5, -1]) cylinder(d=hole, h=5); - translate([202-4, -5, -1]) cylinder(d=hole, h=5); - translate([202-4, 143-5, -1]) cylinder(d=hole, h=5); - - translate([3.5, 3.5, -1]) cylinder(d=hole, h=5); - translate([3.5, body_size[1]-3.5, -1]) cylinder(d=hole, h=5); - translate([111, 3.5, -1]) cylinder(d=hole, h=5); - translate([111.5, body_size[1]-3.5, -1]) cylinder(d=hole, h=5); - - } - // standoffs - color([0.6,0.6,0.6]) { - translate([4, 3.75, body_size[2]+adj]) standoff(spacer_size); - translate([3.75, 128.25, body_size[2]+adj]) standoff(spacer_size); - translate([111.5, 4, body_size[2]+adj]) standoff(spacer_size); - translate([111.25, 128.75, body_size[2]+adj]) standoff(spacer_size); - } - // LCD panel - color([0.6, 0.6, 0.65]) - translate([10, 9, body_size[2]-lcd_size[2]]+lcd_clearance) - cube(lcd_size); - - // Front glass - // It's actually thinner and glued, but for the sake of simplicity... - color([0.2, 0.2, 0.2], 0.9) - translate([3, 1.25, body_size[2] + 0.01]) - slab(glass_size, rb); - - // view area - color("dimgrey", 0.9) - translate([14, 12.5, body_size[2] + glass_size[2]- 0.01]) - slab(view_size, .1); - - // PCB stub - color([0.1,0.1,0.1]) - translate([body_size[0]-25, body_size[1]-30, -2]) - cube([7,7,.1]); - color([0.1,0.1,0.1]) - translate([body_size[0]-50, body_size[1]-35, -2]) - cube([4,5,.1]); -} - -// ODROID M1 2.5" SATA HDD mounting kit -module m1_hdmount() { - $fn = 30; - dims = [89.6, 38.5, 2.0]; - holes = 4; - slots = [4.15, 3.3]; - standoff_style = [5, 16, 0, 3, 25, 0, 0, 1, 0, 0, 0]; - - color([0.2,0.2,0.2]) - difference() { - slab(dims, 4.0); - translate([ 3.1, 28.3, -1]) cylinder(d = holes, h = 4); - translate([ 86.5, 28.3, -1]) cylinder(d = holes, h = 4); - hull() { - translate([ 14.75, 10.15, -1]) cylinder(d=3.30, h=4); - translate([ 15.60, 10.15, -1]) cylinder(d=3.30, h=4); - } - hull() { - translate([ 75.60, 10.15, -1]) cylinder(d=3.30, h=4); - translate([ 76.45, 10.15, -1]) cylinder(d=3.30, h=4); - } - } - - color([0.6,0.6,0.6]) { - translate ([ 3.1, 28.3 , 0]) rotate([ 0,0,0]) standoff(standoff_style); - translate ([ 86.5, 28.3 , 0]) rotate([ 0,0,0]) standoff(standoff_style); - } - color([0.1,0.1,0.1]) { - translate ([ 3.1, 28.3 , 2]) rotate([ 0,0,0]) screw([3, 7, 0]); - translate ([ 86.5, 28.3 , 2]) rotate([ 0,0,0]) screw([3, 7, 0]); - - translate ([ 15.1, 10.15, 0]) rotate([180,0,0]) screw([3, 7, 0]); - translate ([ 76, 10.15, 0]) rotate([180,0,0]) screw([3, 7, 0]); - } - - // "HDD HOLDER" - color([0.9, 0.9, 0.9]) - translate([67,8,0]) rotate([180,0,180]) - linear_extrude(height=0.01) text("HDD HOLDER",5); -} - - -// hdmi a female -module hdmi_a() { - size_x = 14.5; - size_y = 11.5; - - translate([0,0,.75]) - union() { - difference() { - color("silver") translate([0,0,0]) cube([size_x, size_y, 5.5]); - color("dimgray") translate([.5,-.1,.5]) cube([13.5, 11, 4.5]); - color("silver") translate([0,-.1,0]) rotate ([-90,0,0]) - cylinder(d=4, h=13.5,$fn=30); - color("silver") translate([14.5,-.1,0]) rotate ([-90,0,0]) - cylinder(d=4, h=13.5,$fn=30); - } - difference() { - union() { - color("silver") translate([0,-.1,0]) rotate ([-90,0,0]) - cylinder(d=4, h=11.5,$fn=30); - color("silver") translate([14.5,-.1,0]) rotate ([-90,0,0]) - cylinder(d=4, h=11.5,$fn=30); - } - color("silver") translate([0,-.2,0]) rotate ([-90,0,0]) - cylinder(d=3, h=13.5,$fn=30); - color("silver") translate([14.5,-.2,0]) rotate ([-90,0,0]) - cylinder(d=3, h=13.5,$fn=30); - color("silver") translate([-3,-1,-3]) cube([3,13.5,7.5]); - color("silver") translate([14.5,-1,-3]) cube([3,13.5,7.5]); - color("silver") translate([-1,-1,-3]) cube([16.5,13.5,3]); - } - color("black") translate([2.5,.5,2.25]) cube([9.25,10.5,1.5]); - } -} - - -// single row female headers -module header_f(pins, height) { - - adjust = .01; - $fn = 90; - size_x = 2.5; - size_y = 2.5 * pins; - union() { - color("black") cube([size_x, size_y, height]); - for (i=[1:2.5:size_y]) { - color("dimgray") translate ([1,i,height-5+adjust]) cube([.64,.64,5]); - } - } -} - - -// single row pcb pad -module pcb_pad(pads) { - - adjust = .01; - $fn = 90; - size_x = 2.5; - size_y = 2.5 * pads; - union() { - for (i=[1:2.5:size_y]) { - difference() { - color("goldenrod") translate ([2,i+1,0]) cylinder(d=1.25, h=.125); - color("dimgray") translate([2,i+1,.01]) cylinder(d=.625, h=2); - } - } - } -} - - -// uart micro connector type -module uart_micro() { - size_x = 12.5; - size_y = 5; - union() { - difference() { - union() { - - difference () { - color("white") translate([0,0,0]) cube([size_x,size_y,6]); - color("darkgray") translate([.5,.5,2]) cube([11.5,4,6]); - } - } - color("white") translate([12.5,0,-.5]) cube([2,6,7]); - color("white") translate([-1,0,-.5]) cube([1,6,7]); - color("white") translate([-1,5,-.5]) cube([14,2,7]); - color("darkgray") translate([-1,1.5,2]) cube([14,1,7]); - } - for (i=[2.5:2.5:10]) { - color("silver") translate ([i,3,.5]) cube([.6,.6,5]); - } - } -} - - -// usb2 micro otg -module usb_micro() { - size_x = 7; - size_y = 4.5; - union() { - difference () { - color("silver") translate([0,0,0]) cube([size_x, size_y, 3.5]); - color("dimgray") translate([.5,-.1,.5]) cube([6, 3.5, 2.5]); - color("silver") translate([0,-.1,0]) rotate ([-90,0,0]) - cylinder(d=2.5, h=6.5,$fn=30); - color("silver") translate([7,-.1,0]) rotate ([-90,0,0]) - cylinder(d=2.5, h=6.5,$fn=30); - - } - difference() { - union() { - color("silver") translate([0,-.1,0]) rotate ([-90,0,0]) - cylinder(d=2.5, h=4.5,$fn=30); - color("silver") translate([7,-.1,0]) rotate ([-90,0,0]) - cylinder(d=2.5, h=4.5,$fn=30); - } - color("silver") translate([0,-.2,0]) rotate ([-90,0,0]) - cylinder(d=1.25, h=6.5,$fn=30); - color("silver") translate([7,-.2,0]) rotate ([-90,0,0]) - cylinder(d=1.25, h=6.5,$fn=30); - - color("silver") translate([-3,-1,-3]) cube([3,6.5,7.5]); - color("silver") translate([7,-1,-3]) cube([3,6.5,7.5]); - color("silver") translate([0,-1,-3]) cube([9,6.5,3]); - color("silver") translate([-1,-1,-3]) cube([9,6.5,3]); - } - color("black") translate([1.5,.5,1.25]) cube([4,3.5,1]); - } - } - - -// rj45 single socket -module rj45(x,y,rotation,side,pcbsize_z) { - size_x = 15.9; - size_y = 21.3; - place(x,y,0,size_x,size_y,rotation,side) - union() { - difference () { - color("lightgray") translate([0,0,0]) cube([size_x, size_y, 13.5]); - color("darkgray") translate([1.5,-1,1.5]) cube([13, 19.5, 8]); - color("darkgray") translate([5.5,-2,7]) cube([5, 19.5, 5]); - } - color("green") translate([2,-.1,10]) cube([3, 2, 2]); - color("orange") translate([11,-.1,10]) cube([3, 2, 2]); - } -} - - -// momentary_4.5x4.5x1.5 button -module momentary45x15() { - - adjust = .01; - $fn = 90; - size_x = 4.5; - size_y = 4.5; - size_z = 3.1; - union() { - 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("black") translate([2.25,2.25,3.1-adjust]) cylinder(d=2.35,h=1.50); - color("black") translate([.75,.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,3.75,3]) sphere(d=.75); - } -} - - -// single row headers -module header(pins) { - - adjust = .01; - $fn = 90; - size_x = 2.54; - size_y = 2.54 * pins; - union() { - color("black") translate([0,0,0]) cube([size_x, size_y, 2.5]); - for (i=[1:2.54:size_y]) { - color("silver") translate ([1,i,2.5]) cube([.64,.64,5]); - } - } -} - - -// gpio 12 enclosed header -module encl_header_12() { - size_x = 19.5; - size_y = 5.5; - union() { - difference () { - color("black") translate([0,0,0]) cube([size_x,size_y,6.25]); - color ("dimgray") translate ([.5,.5,.6]) cube([18.5,4.5,5.75]); - } - for (i=[4.5:2:16]) { - color("silver") translate ([i,1.5,1]) cube([.5,.5,5]); - color("silver") translate ([i,3.5,1]) cube([.5,.5,5]); - } - } -} - - -// micro connector type -module micro2pin() { - size_x = 7.5; - size_y = 3.75; - union() { - difference () { - color("white") translate([0,0,0]) cube([size_x,size_y,4.75]); - color("darkgray") translate([1.5,.5,1]) cube([4.5,2.75,6]); - color("white") translate([-.5,.75,-.5]) cube([1,2.5,6]); - color("white") translate([7,.75,-.5]) cube([1,2.5,6]); - color("darkgray") translate([2.25,-.5,1]) cube([3,2,6]); - } - color("silver") translate ([2.75,2,.5]) cube([.6,.6,4]); - color("silver") translate ([4.5,2,.5]) cube([.6,.6,4]); - } -} - - -// 3.5mm audio plug -module audio_jack35() { - - adjust = .01; - $fn = 90; - size_x = 6.5; - size_y = 13.5; - difference () { - union() { - color("dimgray") cube([size_x,size_y,3]); - 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("gray") translate([size_x/2,0,2.25]) rotate([-90,0,0]) cylinder(d=3, h=size_y+adjust); - } -} - - -// can capacitor -module capacitor(diameter, height) { - adjust = .01; - $fn = 90; - 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,1]) cylinder(d=diameter, h=height-1); -} - - -// ic -module ic(size) { - color("dimgray") cube(size); -} - - -/* hk speakers */ -module hk_speaker() { - - spk_x = 44; - spk_y = 20; - spk_z = 98; - c_hole = 6; - i_dia = c_hole+3; - adjust = .1; - - difference() { - translate([spk_x/2,spk_y/2,spk_z/2]) cube_fillet_inside([spk_x,spk_y,spk_z], - vertical=[0,0,0,0,0], top=[0,c_hole,0,c_hole], bottom=[0,c_hole,0,c_hole], $fn=90); - // speaker cone - translate([spk_x/2,-adjust,spk_z-72]) rotate([-90,0,0]) cylinder(d=36, h=.5); - - // corner holes - translate([(c_hole/2)+2,-adjust,(c_hole/2)+2]) rotate([-90,0,0]) - cylinder(d=c_hole, h=spk_y+(2*adjust)); - translate([(c_hole/2)+2,-adjust,spk_z-(c_hole/2)-2]) rotate([-90,0,0]) - cylinder(d=c_hole, h=spk_y+(2*adjust)); - translate([spk_x-(c_hole/2)-2,-adjust,spk_z-(c_hole/2)-2]) rotate([-90,0,0]) - cylinder(d=c_hole, h=spk_y+(2*adjust)); - translate([spk_x-(c_hole/2)-2,-adjust,(c_hole/2)+2]) rotate([-90,0,0]) - cylinder(d=c_hole, h=spk_y+(2*adjust)); - - // lower left corner indent - translate([(c_hole/2)+2,-adjust,(c_hole/2)+2]) rotate([-90,0,0]) - cylinder(d=i_dia, h=10+adjust); - translate([-adjust-1,-adjust,-adjust]) cube([c_hole+adjust,10+adjust,i_dia+adjust+.5]); - translate([adjust+.5,-adjust,-(i_dia/2)+adjust]) cube([i_dia+adjust,10+adjust,i_dia+adjust+.5]); - translate([(c_hole/2)+2,-adjust+12+adjust,(c_hole/2)+2]) rotate([-90,0,0]) - cylinder(d=i_dia, h=10+adjust); - translate([-adjust-1,-adjust+12+adjust,-adjust]) cube([c_hole+adjust,10+adjust,i_dia+adjust+.5]); - translate([adjust+.5,-adjust+12+adjust,-(i_dia/2)+adjust]) cube([i_dia+adjust,10+adjust,i_dia+adjust+.5]); - - // upper left corner corner indent - translate([(c_hole/2)+2,-adjust,spk_z-(c_hole/2)-2]) rotate([-90,0,0]) - cylinder(d=i_dia, h=10+adjust); - translate([-adjust-1,-adjust,spk_z-i_dia-.5]) cube([c_hole+adjust,10+adjust,i_dia+adjust+.5]); - translate([-adjust+.5,-adjust,spk_z-(i_dia/2)+adjust-.5]) cube([i_dia,10+adjust,i_dia+adjust+.5]); - translate([(c_hole/2)+2,-adjust+12,spk_z-(c_hole/2)-2]) rotate([-90,0,0]) - cylinder(d=i_dia, h=10+adjust); - translate([-adjust-1,-adjust+12,spk_z-i_dia-.5]) cube([c_hole+adjust,10+adjust,i_dia+adjust+.5]); - translate([-adjust+.5,-adjust+12,spk_z-(i_dia/2)+adjust-.5]) cube([i_dia,10+adjust,i_dia+adjust+.5]); - - // upper right corner corner indent - translate([spk_x-(c_hole/2)-2,-adjust,spk_z-(c_hole/2)-2]) rotate([-90,0,0]) - cylinder(d=i_dia, h=10+adjust); - translate([spk_x-1-(i_dia/2),-adjust,spk_z-i_dia+adjust-.5]) cube([c_hole+adjust,10+adjust,i_dia+adjust+.5]); - translate([spk_x-.5-i_dia,-adjust,spk_z-(i_dia/2)+adjust-.5]) cube([i_dia,10+adjust,i_dia+adjust+.5]); - translate([spk_x-(c_hole/2)-2,-adjust+12,spk_z-(c_hole/2)-2]) rotate([-90,0,0]) - cylinder(d=i_dia, h=10+adjust); - translate([spk_x-1-(i_dia/2),-adjust+12,spk_z-i_dia+adjust-.5]) cube([c_hole+adjust,10+adjust,i_dia+adjust+.5]); - translate([spk_x-.5-i_dia,-adjust+12,spk_z-(i_dia/2)+adjust-.5]) cube([i_dia,10+adjust,i_dia+adjust+.5]); - - // lower right corner corner indent - translate([spk_x-(c_hole/2)-2,-adjust,(c_hole/2)+2]) rotate([-90,0,0]) - cylinder(d=i_dia, h=10+adjust); - translate([spk_x-1-(i_dia/2),-adjust,-adjust]) cube([c_hole+adjust,10+adjust,i_dia+adjust+.5]); - translate([spk_x-.5-i_dia,-adjust,-(i_dia/2)+adjust]) cube([i_dia,10+adjust,i_dia+adjust+.5]); - translate([spk_x-(c_hole/2)-2,-adjust+12,(c_hole/2)+2]) rotate([-90,0,0]) - cylinder(d=i_dia, h=10+adjust); - translate([spk_x-1-(i_dia/2),-adjust+12,-adjust]) cube([c_hole+adjust,10+adjust,i_dia+adjust+.5]); - translate([spk_x-.5-i_dia,-adjust+12,-(i_dia/2)+adjust]) cube([i_dia,10+adjust,i_dia+adjust+.5]); - } - // speaker cone - translate([spk_x/2,-adjust+46,spk_z-72]) { - difference() { - translate([0,0,0]) sphere(d=96, $fn=180); - translate([-50,-46,-50]) cube([100,100,100]); - } - } - - } - - -/* hk boom bonnet */ -module hk_boom(speakers,orientation) { - - adjust = .01; - $fn = 90; - difference() { - union() { - color("tan") translate ([0,0,0]) slab([60,35,1.6],.5); - if(speakers == true) { - color("tan") translate ([-31.5,0,0]) slab([31.5,35,1.6],.5); - color("white") translate ([-0.25,0,0]) cube([.5,35,1.6]); - color("tan") translate ([60,0,0]) slab([31.5,35,1.6],.5); - color("white") translate ([60,0,0]) cube([.5,35,1.6]); - } - } - // pcb holes - color("tan") translate([3.5,3.5,-adjust]) cylinder(d=3,h=6); - color("tan") translate([3.5,31.5,-adjust]) cylinder(d=3,h=6); - color("tan") translate([56.5,3.5,-adjust]) cylinder(d=3,h=4); - color("tan") translate([56.5,31.5,-adjust]) cylinder(d=3,h=4); - if(speakers == true) { - // left - color("tan") translate([-28,3.5,-adjust]) cylinder(d=3,h=6); - color("tan") translate([-28,31.5,-adjust]) cylinder(d=3,h=6); - color("tan") translate([-3.5,3.5,-adjust]) cylinder(d=3,h=6); - color("tan") translate([-3.5,31.5,-adjust]) cylinder(d=3,h=6); - // right - color("tan") translate([64.5,3.5,-adjust]) cylinder(d=3,h=4); - color("tan") translate([64.5,31.5,-adjust]) cylinder(d=3,h=4); - color("tan") translate([88,3.5,-adjust]) cylinder(d=3,h=4); - color("tan") translate([88,31.5,-adjust]) cylinder(d=3,h=4); - // left speaker openings - color("tan") translate([-31.5/2,35/2,-adjust]) cylinder(d=23.5, h=3); - color("tan") translate([-4-31.5/2,35/2+(23.5/2)-.5,-adjust]) cube([6,3,3]); - color("tan") translate([-4-31.5/2,35/2-(23.5/2)-2.5,-adjust]) cube([6,3,3]); - color("tan") translate([-4-31.5/2+(23.5/2)+1,-2+35/2,-adjust]) cube([6,3,3]); - // right speaker openings - color("tan") translate([60+(31.5/2),35/2,-adjust]) cylinder(d=23.5, h=3); - color("tan") translate([60-3+31.5/2,35/2+(23.5/2)-.5,-adjust]) cube([6,3,3]); - color("tan") translate([60-3+31.5/2,35/2-(23.5/2)-2.5,-adjust]) cube([6,3,3]); - color("tan") translate([60+1.25,-2+35/2,-adjust]) cube([6,3,3]); - } - } - // headers - translate([7.5,3.5,1.6-adjust]) rotate([0,0,-90]) header(3); - translate([16,3.5,1.6-adjust]) rotate([0,0,-90]) header(7); - translate([34,2,1.6-adjust]) rotate([0,0,0]) encl_header_12(); - translate([40,13.5,1.6-adjust]) rotate([0,0,-90]) header(2); - translate([45.5,13.5,1.6-adjust]) rotate([0,0,-90]) header(2); - difference() { - union() { - color("dimgray", 1) translate([44.5,27,1.6+2]) rotate([0,0,0]) cylinder(d=16, h=3); - color("dimgray", 1) translate([44.5,27,1.6]) rotate([0,0,0]) cylinder(d=8, h=2); - } - color("dimgray", 1) translate([44.5,27,1.6+4]) rotate([0,0,0]) cylinder(d=12, h=3); - for(d=[5:10:360]) { - color("dimgray") translate([44.5+(16/2)*cos(d),27+(16/2)*sin(d),1.6+2-adjust]) cylinder(d=.75, h=3+2*adjust); - } - } - color("gray", 1) translate([45,27,1.6+4-adjust]) rotate([0,0,0]) cylinder(d=1.5, h=.25); - translate([3.75,13,1.6-adjust]) rotate([0,0,90]) micro2pin(); - translate([56.5,20.5,1.6-adjust]) rotate([0,0,-90]) micro2pin(); - translate([7.75,21.75,1.6-adjust]) audio_jack35(); - translate([20,30,1.6-adjust]) capacitor(6.25,6.5); - translate([30,30,1.6-adjust]) capacitor(6.25,6.5); - translate([22,16,1.6-adjust]) ic([6.5,4.5,1]); - translate([10,12,1.6-adjust]) ic([4,4,1]); - translate([32.5,9,1.6-adjust]) ic([3.5,3,1]); - if(speakers == true && orientation == "rear") { - translate([-31.5/2,35/2,1.6]) boom_speaker(); - translate([60+(31.5/2),35/2,1.6]) boom_speaker(); - } - if(speakers == true && orientation == "front") { - translate([-31.5/2,35/2,0]) rotate([0,180,0]) boom_speaker(); - translate([60+(31.5/2),35/2,0]) rotate([0,180,0]) boom_speaker(); - } -} - - -// hk stero boom bonnet speaker with board -module hk_boom_speaker(side,speaker,pcb) { - - adjust = .01; - $fn = 90; - - if(pcb == true) { - difference() { - color("tan") slab([31.5,35,1.6],.5); - color("tan") translate([27.5,4,-adjust]) cylinder(d=3,h=6); - color("tan") translate([27.5,31,-adjust]) cylinder(d=3,h=6); - color("tan") translate([4,4,-adjust]) cylinder(d=3,h=6); - color("tan") translate([4,31,-adjust]) cylinder(d=3,h=6); - - // speaker openings - color("tan") translate([(31.5/2),35/2,-adjust]) cylinder(d=23.5, h=3); - color("tan") translate([-3+31.5/2,35/2+(23.5/2)-.5,-adjust]) cube([6,3,3]); - color("tan") translate([-3+31.5/2,35/2-(23.5/2)-2.5,-adjust]) cube([6,3,3]); - if(side == "right") { - color("tan") translate([.5,-2+35/2,-adjust]) cube([6,3,3]); - } - if(side == "left") { - color("tan") translate([31.5/2+(23.5/2)-2.5,-2+35/2,-adjust]) cube([6,3,3]); - } - } - } - if(speaker == true && pcb == true) { - translate([(31.5/2),35/2,1.6]) boom_speaker(); - } - if(speaker == true && pcb == false) { - boom_speaker(); - } -} - - -// hk stero boom bonnet speakers -module boom_speaker() { - - adjust = .01; - $fn = 90; - difference() { - union() { - color("silver") translate([0,0,-8.5]) cylinder_fillet_inside(h=6.5, r=21.4/2, - top=0, bottom=2, $fn=90, fillet_fn=30, center=false); - color("dimgray") translate([0,0,2.5-adjust]) cylinder_fillet_inside(h=1, r=21.75/2, - top=1, bottom=0, $fn=90, fillet_fn=30, center=true); - - difference() { - color("black") translate([0,0,-5-adjust]) cylinder(d=23.7, h=5); - for(d=[30:60:360]) { - color("dimgray") translate([(23.7/2)*cos(d),(23.7/2)*sin(d),-6-adjust]) cylinder(d=6, h=5+2*adjust); - } - } - color("black") translate([0,0,-adjust]) cylinder(d=27.8, h=2); - color("dimgray") translate([0,0,1]) cylinder(d=22.8, h=1); - color("dimgray") translate([0,0,1]) cylinder(d=17.5, h=1.25); - } - color("darkgray") translate([0,0,10.5]) sphere(d=23); - } -} - - -// hk boom bonnet speaker grill -module hk_boom_grill(style,thick) { - - adjust = .01; - $fn = 90; - if(style == "dome" || style == "frame") { - difference() { - union() { - difference() { - translate([0,0,-23]) sphere(d=52.5); - translate([0,0,-25]) sphere(d=52.5); - translate([-30,-30,-60.5]) cube([60,60,60]); - for(c=[-14.5:3:24]) { - for(r=[-14.5:3:24]) { - translate([r,c,-1]) cube([2,2,40]); - } - } - } - if(style == "frame") { - difference() { - translate([0,0,-1.25]) cylinder(d=30.5, h=thick); - translate([0,0,-1.25-adjust]) cylinder(d=24, h=thick+2*adjust); - } - } - } - } - } - if(style == "flat") { - difference() { - translate([0,0,0]) cylinder(d=24.5, h=thick); - for(c=[-14.5:3:24]) { - for(r=[-14.5:3:24]) { - translate([r,c,-1]) cube([2,2,thick+2]); - } - } - } - } -} - - -// hk stero boom bonnet speaker holder -module boom_speaker_holder(style, tolerance) { - - adjust = .01; - $fn = 90; - - if(style == "friction") { - difference() { - translate([0,0,0]) cylinder(d=31, h=4); - translate([0,0,-adjust]) cylinder(d=28+tolerance, h=4+2*adjust); - translate([0,-1,-adjust]) cube([15,40,10], center=true); - } - difference() { - translate([0,0,0]) cylinder(d=28+tolerance, h=2); - translate([0,0,-adjust]) cylinder(d=28+tolerance-2, h=4+2*adjust); - translate([0,-1,-adjust]) cube([15,40,10], center=true); - } - } - - if(style == "clamp") { - // bottom clamp - topthick = 2; - top_height = 14; - difference() { - cube([10.5,29,top_height-topthick]); - // speaker holders - translate([-1,14.5,14]) rotate([0,90,0]) cylinder(d=28, h=4.5); - translate([2,14.5,14]) rotate([0,90,0]) cylinder(d=24, h=6); - translate([4,14.5,14]) rotate([0,90,0]) cylinder(d=21.9, h=7.8); - } - } -} - - -// hk stero boom bonnet speaker clamp holder top -module boom_speaker_strap(side) { - - topthick = 2; - top_height = 14; - adjust = .01; - $fn = 90; - // top clamp - difference() { - difference() { - union() { - translate([-3,14.5,top_height]) rotate([0,90,0]) cylinder(d=35,h=13.75); - if(side == "left") { - translate([5.4,16.5,top_height+(topthick/2)-1]) cube_fillet_inside([16.75,55,topthick], - vertical=[6,1,6,1], top=[0,0,0,0], bottom=[0,0,0,0], $fn=90); - } - if(side == "right") { - translate([5.4,13,top_height+(topthick/2)-1]) cube_fillet_inside([16.75,55,topthick], - vertical=[1,6,1,1], top=[0,0,0,0], bottom=[0,0,0,0], $fn=90); - } - translate([10.75-adjust,14.5,top_height]) rotate([0,90,0]) cylinder(d=35,h=3); - } - translate([-9.25,0,top_height-topthick-adjust]) cube([20,29,topthick]); - difference() { - translate([-4.25,14.5,14]) rotate([0,90,0]) cylinder(d=28, h=15); - translate([-5.25,0,19]) cube([20,30,19.5]); - } - } - // speaker holders - translate([-3-adjust,14.5,14]) rotate([0,90,0]) cylinder(d=30.8, h=4.5); - translate([-3-adjust,14.5,14]) rotate([0,90,0]) cylinder(d=32.8, h=2); - translate([-2.75,14.5,14]) rotate([0,90,0]) cylinder(d=28, h=14.5); - translate([-4.55,-4,-4]) cube([20,37,topthick+15]); - - if(side == "left") { - translate([4.15,-3.4,-adjust]) cylinder(d=3.2, h=50); - translate([4.15,-3.4,15]) cylinder(d=6, h=10); - translate([5.75,40,-adjust]) cylinder(d=3.2, h=50); - } - if(side == "right") { - translate([4.5,32.5,-adjust]) cylinder(d=3.2, h=50); - translate([4.5,32.5,15]) cylinder(d=6, h=10); - translate([10.5,-11,-adjust]) cylinder(d=3.2, h=50); - } - } -} - - -// hk stero boom bonnet volume ring -module boom_vring(tolerance) { - - out_dia = 22; - in_dia = 16.15 + tolerance; - thick = 3; - nub = 1.25; - adjust = .01; - $fn = 90; - difference() { - color("black") translate([0,0,0])cylinder(d=out_dia, h=thick); - color("dimgray") translate([0,0,-adjust]) cylinder(d=in_dia, h=thick+2*adjust); - for(d=[5:10:360]) { - color("dimgray") translate([(out_dia/2)*cos(d),(out_dia/2)*sin(d),-adjust]) cylinder(d=nub, h=thick+2*adjust); - } - } -} - - -/* access port and support */ -module access_port(size,orientation) { - - floorthick = size[2]; - adjust = .01; - $fn = 90; - if(orientation == "portrait") { - difference() { - union() { - translate([0,0,0]) cube([size[0],size[1],size[2]]); - // access panel support - translate([(size[0]/2)+.25,size[1]-6.5,0]) cylinder(d=9,h=floorthick+(adjust*2)+5); - translate([(size[0]/2)-10,size[1]-11,floorthick-adjust]) cube([20,9.5,floorthick]); - translate([1,0,floorthick-adjust]) cube([size[0]-2,5,4.5]); - } - // access opening - translate([.5,6,-adjust]) cube([size[0]-1.15,size[1]-17,floorthick+(adjust*2)]); - translate([(size[0]/2)-5,size[1]-12,-adjust]) slab([10.5,5.5,floorthick],5.5); - translate([(size[0]/2)+.25,size[1]-6.5,floorthick+2]) - cylinder(r=3.2,h=floorthick+(adjust*2)+5,$fn=6); - translate([(size[0]/2)+.25,size[1]-6.5,-adjust]) - cylinder(d=3.2,h=floorthick+(adjust*2)+5); - translate([4,2+adjust,floorthick]) cube([7.75,3,2.75]); - translate([size[0]-13,2+adjust,floorthick]) cube([7.75,3,2.75]); - if(size[0] > 100) { - translate([(size[0]/2),2+adjust,floorthick]) cube([7.75,3,2.75]); - } - } - } - if(orientation == "landscape") { - difference() { - union() { - translate([0,-1,0]) cube([size[0],size[1],size[2]]); - // access panel support - translate([size[0]-6.5,(size[1]/2)-.5,0]) cylinder(d=9,h=floorthick+(adjust*2)+5); - translate([size[0]-11,(size[1]/2)-10.5,floorthick-adjust]) cube([9.5,20,floorthick]); - translate([0,0,floorthick-adjust]) cube([5,size[1]-2,4.5]); - } - // access opening - translate([6,-.5,-adjust]) cube([size[0]-17,size[1]-1.15,floorthick+(adjust*3)]); - translate([size[0]-12,(size[1]/2)-6,-adjust]) slab([5.5,10.5,floorthick],5.5); - translate([size[0]-6.5,(size[1]/2)-.5,floorthick+2]) rotate([0,0,30]) - cylinder(r=3.2,h=floorthick+(adjust*2)+5,$fn=6); - translate([size[0]-6.5,(size[1]/2)-.5,-adjust]) - cylinder(d=3.2,h=floorthick+(adjust*2)+5); - translate([2+adjust,3,floorthick]) cube([3,8.25,2.75]); - translate([2+adjust,size[1]-13,floorthick]) cube([3,8.25,2.75]); - if(size[1] > 100) { - translate([2+adjust,(size[1]/2)-(7.75/2)-1.25,floorthick]) cube([3,7.75,2.5]); - } - } - } -} - - -/* access cover and support */ -module access_cover(size,orientation) { - - floorthick = size[2]; - adjust = .01; - $fn = 90; - if(orientation == "portrait") { - difference() { - union() { - translate([1,6.25,0]) cube([size[0]-2.15,size[1]-17.5,floorthick]); - translate([(size[0]/2)-4.75,size[1]-12.25,0]) slab([10,5,floorthick], 5); - translate([1,6.25,floorthick-adjust]) cube([size[0]-2.15,6,floorthick]); - translate([4.25,3,floorthick]) cube([7.25,4,2]); - translate([size[0]-12.75,3,floorthick]) cube([7.25,4,2]); - if(size[0] > 100) { - translate([(size[0]/2)+.25,3,floorthick]) cube([7.25,4,2]); - } - } - translate([(size[0]/2)+.25,size[1]-6.5,-floorthick-adjust]) - cylinder(d=3.2,h=(floorthick*2)+(adjust*2)); - translate([(size[0]/2)+.25,size[1]-6.5,-floorthick-adjust+floorthick]) - cylinder(d1=6, d2=3.2, h=floorthick); - } - } - if(orientation == "landscape") { - difference() { - union() { - translate([6.25,0,0]) cube([size[0]-17.75,size[1]-2,floorthick]); - translate([size[0]-12.25,(size[1]/2)-5.75,0]) slab([5,10,floorthick], 5); - translate([6.25,0,floorthick-adjust]) cube([6,size[1]-2.15,floorthick]); - translate([3.5+adjust,3.25,floorthick]) cube([4,7.25,2]); - translate([3.5+adjust,size[1]-12.75,floorthick]) cube([4,7.25,2]); - if(size[1] > 100) { - translate([3.5+adjust,(size[1]/2)-(7.75/2)-1,floorthick]) cube([4,7.25,2]); - } - } - translate([size[0]-6.5,(size[1]/2)-.75,-floorthick-adjust]) - cylinder(d=3.2,h=(floorthick*2)+(adjust*2)); - translate([size[0]-6.5,(size[1]/2)-.75,-floorthick-adjust+floorthick]) - cylinder(d1=6, d2=3.2, h=floorthick); - } - } -} - - -/* hdmi opening */ -module hdmi_open(hdmi_style) { - - if(hdmi_style == "hdmi_a") { - union() { - difference() { - translate([0,-5,1.25]) cube([15.5,8,5.75]); - translate([0.5,-5.2,.5]) rotate ([-90,0,0]) cylinder(d=3, h=13.5,$fn=30); - translate([15,-5.2,.5]) rotate ([-90,0,0]) cylinder(d=3, h=13.5,$fn=30); - } - translate([1.75,-5,.5]) cube([12, 8, 1]); - } - } - if(hdmi_style == "hdmi_micro") { - union() { - difference() { - translate([-.25,-6,-.01]) cube([7,8,3.15]); - translate([-.25,-6.2,0]) rotate ([-90,0,0]) cylinder(d=1.5, h=9.5,$fn=30); - translate([6.75,-6.2,0]) rotate ([-90,0,0]) cylinder(d=1.5, h=9.5,$fn=30); - } - } - } - if(hdmi_style == "hdmi_mini") { - union() { - difference() { - translate([-.25,-6,-.01]) cube([11.5,8,3.5]); - translate([-1,-6.2,-.5]) rotate ([-90,0,0]) cylinder(d=3, h=10,$fn=30); - translate([12.25,-6.2,-.5]) rotate ([-90,0,0]) cylinder(d=3, h=10,$fn=30); - } - } - } - if(hdmi_style=="dp_mini") { - size_x = 9; - size_y = 8; - union() { - difference() { - translate([-.25,-6,0]) cube([size_x, size_y, 5.75]); - translate([-7.5,-7,1]) rotate([0,45,0]) cube([size_x, size_y+2, 5.6]); - translate([10,-7,-5]) rotate([0,-45,0]) cube([size_x, size_y+2, 5.6]); - } - } - } -} - - -/* micro-usb opening */ -module microusb_open() { - - translate([0,0,.5])rotate([90,0,0]) - hull() { - translate([6,1.5,-5]) cylinder(d=3.5,h=12); - translate([1,1.5,-5]) cylinder(d=3.5,h=12); - } -} - - -/* fan mask to create opening */ -module fan_mask(size, thick, style) { - - $fn=90; - - if(style == 1) { - translate ([size/2,size/2,-1]) cylinder(h=thick+2, d=size-2); - if(size == 40) { - // mount holes - translate ([size-4,size-4,-1]) cylinder(h=thick+2, d=3); - translate ([size-4,4,-1]) cylinder(h=thick+2, d=3); - translate ([4,size-4,-1]) cylinder(h=thick+2, d=3); - translate ([4,4,-1]) cylinder(h=thick+2, d=3); - } - if(size == 60) { - // mount holes - translate ([size-5,size-5,-1]) cylinder(h=thick+2, d=3); - translate ([size-5,5,-1]) cylinder(h=thick+2, d=3); - translate ([5,size-5,-1]) cylinder(h=thick+2, d=3); - translate ([5,5,-1]) cylinder(h=thick+2, d=3); - } - if(size >= 80) { - // mount holes - translate ([size-3.75,size-3.75,-1]) cylinder(h=thick+2, d=3); - translate ([size-3.75,3.75,-1]) cylinder(h=thick+2, d=3); - translate ([3.75,size-3.75,-1]) cylinder(h=thick+2, d=3); - translate ([3.75,3.75,-1]) cylinder(h=thick+2, d=3); - } - } - if(style == 2 && size == 40) { - difference() { - union () { - difference() { - translate ([size/2,size/2,-1]) cylinder(h=thick+2, d=size-2); - translate ([size/2,size/2,-2]) cylinder(h=thick+4, d=size-6); - } - difference() { - translate ([size/2,size/2,-1]) cylinder(h=thick+2, d=size-10); - translate ([size/2,size/2,-2]) cylinder(h=thick+4, d=size-14); - } - difference() { - translate ([size/2,size/2,-1]) cylinder(h=thick+2, d=size-18); - translate ([size/2,size/2,-2]) cylinder(h=thick+4, d=size-22); - } - difference() { - translate ([size/2,size/2,-1]) cylinder(h=thick+2, d=size-26); - translate ([size/2,size/2,-2]) cylinder(h=thick+4, d=size-30); - } - difference() { - translate ([size/2,size/2,-1]) cylinder(h=thick+2, d=size-34); - translate ([size/2,size/2,-2]) cylinder(h=thick+4, d=size-38); - } - // mount holes - translate ([size-4,size-4,-1]) cylinder(h=thick+2, d=3); - translate ([size-4,4,-1]) cylinder(h=thick+2, d=3); - translate ([4,size-4,-1]) cylinder(h=thick+2, d=3); - translate ([4,4,-1]) cylinder(h=thick+2, d=3); - } - translate([6.5,5,-2]) rotate([0,0,45]) cube([size,2,thick+4]); - translate([4.5,size-6,-2]) rotate([0,0,-45]) cube([size,2,thick+4]); - } - } - if(style == 2 && size == 60) { - difference() { - union () { - difference() { - translate ([size/2,size/2,-1]) cylinder(h=thick+2, d=size-2); - translate ([size/2,size/2,-2]) cylinder(h=thick+4, d=size-6); - } - difference() { - translate ([size/2,size/2,-1]) cylinder(h=thick+2, d=size-10); - translate ([size/2,size/2,-2]) cylinder(h=thick+4, d=size-14); - } - difference() { - translate ([size/2,size/2,-1]) cylinder(h=thick+2, d=size-18); - translate ([size/2,size/2,-2]) cylinder(h=thick+4, d=size-22); - } - difference() { - translate ([size/2,size/2,-1]) cylinder(h=thick+2, d=size-26); - translate ([size/2,size/2,-2]) cylinder(h=thick+4, d=size-30); - } - difference() { - translate ([size/2,size/2,-1]) cylinder(h=thick+2, d=size-34); - translate ([size/2,size/2,-2]) cylinder(h=thick+4, d=size-38); - } - difference() { - translate ([size/2,size/2,-1]) cylinder(h=thick+2, d=size-42); - translate ([size/2,size/2,-2]) cylinder(h=thick+4, d=size-46); - } - difference() { - translate ([size/2,size/2,-1]) cylinder(h=thick+2, d=size-50); - translate ([size/2,size/2,-2]) cylinder(h=thick+4, d=size-54); - } - // mount holes - translate ([size-5,size-5,-1]) cylinder(h=thick+2, d=3); - translate ([size-5,5,-1]) cylinder(h=thick+2, d=3); - translate ([5,size-5,-1]) cylinder(h=thick+2, d=3); - translate ([5,5,-1]) cylinder(h=thick+2, d=3); - } - translate([9.5,8,-2]) rotate([0,0,45]) cube([size,2,thick+4]); - translate([8.5,size-10,-2]) rotate([0,0,-45]) cube([size,2,thick+4]); - } - } - if(style == 2 && size >= 80) { - difference() { - union () { - difference() { - translate ([size/2,size/2,-1]) cylinder(h=thick+2, d=size-2); - translate ([size/2,size/2,-2]) cylinder(h=thick+4, d=size-8); - } - difference() { - translate ([size/2,size/2,-1]) cylinder(h=thick+2, d=size-14); - translate ([size/2,size/2,-2]) cylinder(h=thick+4, d=size-20); - } - difference() { - translate ([size/2,size/2,-1]) cylinder(h=thick+2, d=size-26); - translate ([size/2,size/2,-2]) cylinder(h=thick+4, d=size-32); - } - difference() { - translate ([size/2,size/2,-1]) cylinder(h=thick+2, d=size-38); - translate ([size/2,size/2,-2]) cylinder(h=thick+4, d=size-44); - } - difference() { - translate ([size/2,size/2,-1]) cylinder(h=thick+2, d=size-50); - translate ([size/2,size/2,-2]) cylinder(h=thick+4, d=size-56); - } - difference() { - translate ([size/2,size/2,-1]) cylinder(h=thick+2, d=size-62); - translate ([size/2,size/2,-2]) cylinder(h=thick+4, d=size-68); - } - difference() { - translate ([size/2,size/2,-1]) cylinder(h=thick+2, d=size-74); - translate ([size/2,size/2,-2]) cylinder(h=thick+4, d=size-79); - } - if(size == 92) { - difference() { - translate ([size/2,size/2,-1]) cylinder(h=thick+2, d=size-86); - translate ([size/2,size/2,-2]) cylinder(h=thick+4, d=size-92); - } - } - // mount holes - translate ([size-3.75,size-3.75,-1]) cylinder(h=thick+2, d=3); - translate ([size-3.75,3.75,-1]) cylinder(h=thick+2, d=3); - translate ([3.75,size-3.75,-1]) cylinder(h=thick+2, d=3); - translate ([3.75,3.75,-1]) cylinder(h=thick+2, d=3); - } - translate([6.5,4.25,-2]) rotate([0,0,45]) cube([size*1.2,3,thick+4]); - translate([4.25,size-6.5,-2]) rotate([0,0,-45]) cube([size*1.2,3,thick+4]); - } - } - if(style == 3) { - inner = size == 30 ? 24 : - size == 40 ? 32 : - size == 50 ? 40 : - size == 60 ? 50 : - size == 70 ? 61.9 : - size == 80 ? 71.5 : - size * 0.8; // Use 80% as default - - rings = size <= 40 ? 4 : 6; - bar_size = size <= 40 ? 2 : 3; - - screw_offset = inner / 2; - center_point = size * 0.5; - base_ring_size = size * 0.95; - rings_spacing = size / rings; - - translate([size/2, size/2, -1]) - union() { - translate([screw_offset, screw_offset, (thick+2)/2]) cylinder(d=3, h=thick+2, center=true); - translate([-screw_offset, screw_offset, (thick+2)/2]) cylinder(d=3, h=thick+2, center=true); - translate([screw_offset, -screw_offset, (thick+2)/2]) cylinder(d=3, h=thick+2, center=true); - translate([-screw_offset, -screw_offset, (thick+2)/2]) cylinder(d=3, h=thick+2, center=true); - - difference() { - union() { - for(i=[inner:-rings_spacing:0]) { - difference() { - cylinder(d=base_ring_size - i, h=thick+2); - translate([0, 0, -1]) cylinder(d=base_ring_size - i - (rings_spacing/2), h=thick+4); - } - } - } - - translate([0, 0, -1]) union() { - cylinder(d=bar_size*2+0.1, thick+6); // Add a circle to prevent any tiny holes around cross bar - rotate([0, 0, 45]) cube([size, bar_size, 12], center=true); - rotate([0, 0, 45]) cube([bar_size, size, 12], center=true); - } - } - } - } -} - -/* mask module */ -module mask(loc_x,loc_y,loc_z,rotation,side,class,type,wallthick,gap,floorthick,pcb_z) { - - adjust = .01; - $fn=90; - - // hdmi opening - if(type == "hdmi_a" && side == "top" && rotation == 0) { - place(loc_x-.5,loc_y,loc_z,15,11.5,rotation,side) hdmi_open("hdmi_a"); - } - if(type == "hdmi_a" && side == "top" && rotation == 90) { - place(loc_x-1,loc_y,loc_z,15,11.5,rotation,side) hdmi_open("hdmi_a"); - } - if(type == "hdmi_a" && side == "top" && rotation == 180) { - place(loc_x,loc_y+1,loc_z,15,11.5,rotation,side) hdmi_open("hdmi_a"); - } - if(type == "hdmi_a" && side == "top" && rotation == 270) { - place(loc_x+1,loc_y-.5,loc_z,15,11.5,rotation,side) hdmi_open("hdmi_a"); - } - if(type == "hdmi_a" && side == "bottom" && rotation == 0) { - place(loc_x,loc_y-1,loc_z-pcb_z,15,11.5,rotation,side) hdmi_open("hdmi_a"); - } - if(type == "hdmi_a" && side == "bottom" && rotation == 90) { - place(loc_x,loc_y,loc_z-pcb_z,15,11.5,rotation,side) hdmi_open("hdmi_a"); - } - if(type == "hdmi_a" && side == "bottom" && rotation == 180) { - place(loc_x-.5,loc_y-1,loc_z-pcb_z,15,11.5,rotation,side) hdmi_open("hdmi_a"); - } - if(type == "hdmi_a" && side == "bottom" && rotation == 270) { - place(loc_x-1,loc_y-1,loc_z-pcb_z,15,11.5,rotation,side) hdmi_open("hdmi_a"); - } - // hdmi vertical opening - if(type == "hdmi_a_vertical" && side == "top" && rotation == 0) { - place(loc_x-.5,loc_y,loc_z+1.5,15,11.5,rotation,side) translate([-.25,0,15.4]) rotate([0,90,0]) hdmi_open("hdmi_a"); - } - if(type == "hdmi_a_vertical" && side == "top" && rotation == 90) { - place(loc_x-1,loc_y,loc_z+1.5,15,11.5,rotation,side) translate([-.25,0,15.4]) rotate([0,90,0]) hdmi_open("hdmi_a"); - } - if(type == "hdmi_a_vertical" && side == "top" && rotation == 180) { - place(loc_x,loc_y+1,loc_z+1.5,15,11.5,rotation,side) translate([-.25,0,15.4]) rotate([0,90,0]) hdmi_open("hdmi_a"); - } - if(type == "hdmi_a_vertical" && side == "top" && rotation == 270) { - place(loc_x+1,loc_y-.5,loc_z+1.5,15,11.5,rotation,side) translate([-.25,0,15.4]) rotate([0,90,0]) hdmi_open("hdmi_a"); - } - // hdmi micro opening - if(class == "video" && type == "hdmi_micro" && rotation == 0 && side == "top") { - place(loc_x,loc_y,loc_z,7.25,6.5,rotation,side) hdmi_open("hdmi_micro"); - } - if(class == "video" && type == "hdmi_micro" && rotation == 90 && side == "top") { - place(loc_x,loc_y-.75,loc_z,7.25,6.5,rotation,side) hdmi_open("hdmi_micro"); - } - if(class == "video" && type == "hdmi_micro" && rotation == 180 && side == "top") { - place(loc_x-.75,loc_y+1,loc_z,7.25,6.5,rotation,side) hdmi_open("hdmi_micro"); - } - if(class == "video" && type == "hdmi_micro" && rotation == 270 && side == "top") { - place(loc_x,loc_y,loc_z,7.25,6.5,rotation,side) hdmi_open("hdmi_micro"); - } - if(class == "video" && type == "hdmi_micro" && rotation == 0 && side == "bottom") { - place(loc_x-1.5,loc_y,loc_z-1.5,8,3,rotation,side) hdmi_open("hdmi_micro"); - } - if(class == "video" && type == "hdmi_micro" && rotation == 90 && side == "bottom") { - place(loc_x+4.5,loc_y-1.5,loc_z-1.5,8,3,rotation,side) hdmi_open("hdmi_micro"); - } - if(class == "video" && type == "hdmi_micro" && rotation == 180 && side == "bottom") { - place(loc_x,loc_y+4.5,loc_z-1.5,8,3,rotation,side) hdmi_open("hdmi_micro"); - } - if(class == "video" && type == "hdmi_micro" && rotation == 270 && side == "bottom") { - place(loc_x,loc_y,loc_z-1.5,8,3,rotation,side) hdmi_open("hdmi_micro"); - } - - // hdmi mini opening - if(class == "video" && type == "hdmi_mini" && rotation == 0 && side == "top") { - place(loc_x+.125,loc_y,loc_z,11.5,8,rotation,side) hdmi_open("hdmi_mini"); - } - if(class == "video" && type == "hdmi_mini" && rotation == 90 && side == "top") { - place(loc_x,loc_y-.375,loc_z,11.5,8,rotation,side) hdmi_open("hdmi_mini"); - } - if(class == "video" && type == "hdmi_mini" && rotation == 180 && side == "top") { - place(loc_x-.5,loc_y,loc_z,11.5,8,rotation,side) hdmi_open("hdmi_mini"); - } - if(class == "video" && type == "hdmi_mini" && rotation == 270 && side == "top") { - place(loc_x,loc_y+.125,loc_z,11.5,8,rotation,side) hdmi_open("hdmi_mini"); - } - if(class == "video" && type == "hdmi_mini" && rotation == 0 && side == "bottom") { - place(loc_x-.375,loc_y,loc_z-1.5,11.5,8,rotation,side) hdmi_open("hdmi_mini"); - } - if(class == "video" && type == "hdmi_mini" && rotation == 90 && side == "bottom") { - place(loc_x,loc_y-.5,loc_z-1.5,11.5,8,rotation,side) hdmi_open("hdmi_mini"); - } - if(class == "video" && type == "hdmi_mini" && rotation == 180 && side == "bottom") { - place(loc_x,loc_y,loc_z-1.5,11.5,8,rotation,side) hdmi_open("hdmi_mini"); - } - if(class == "video" && type == "hdmi_mini" && rotation == 270 && side == "bottom") { - place(loc_x,loc_y,loc_z-1.5,11.5,8,rotation,side) hdmi_open("hdmi_mini"); - } - // dp mini opening - if(class == "video" && type == "dp_mini" && rotation == 0 && side == "top") { - place(loc_x-.125,loc_y,loc_z,9,8,rotation,side) hdmi_open("dp_mini"); - } - if(class == "video" && type == "dp_mini" && rotation == 90 && side == "top") { - place(loc_x,loc_y-.5,loc_z,9,8,rotation,side) hdmi_open("dp_mini"); - } - if(class == "video" && type == "dp_mini" && rotation == 180 && side == "top") { - place(loc_x-.375,loc_y+6,loc_z,9,8,rotation,side) hdmi_open("dp_mini"); - } - if(class == "video" && type == "dp_mini" && rotation == 270 && side == "top") { - place(loc_x+6,loc_y,loc_z,9,8,rotation,side) hdmi_open("dp_mini"); - } - if(class == "video" && type == "dp_mini" && rotation == 0 && side == "bottom") { - place(loc_x-.675,loc_y,loc_z-1.5,9,8,rotation,side) hdmi_open("dp_mini"); - } - if(class == "video" && type == "dp_mini" && rotation == 90 && side == "bottom") { - place(loc_x+6,loc_y-.5,loc_z-1.5,9,8,rotation,side) hdmi_open("dp_mini"); - } - if(class == "video" && type == "dp_mini" && rotation == 180 && side == "bottom") { - place(loc_x-.375,loc_y+6,loc_z-1.5,9,8,rotation,side) hdmi_open("dp_mini"); - } - if(class == "video" && type == "dp_mini" && rotation == 270 && side == "bottom") { - place(loc_x,loc_y,loc_z-1.5,9,8,rotation,side) hdmi_open("dp_mini"); - } - // power plug openings - if(type == "pwr5.5_7.5x11.5" && rotation == 0 && side == "top") { - place(loc_x,loc_y,loc_z,7,7,rotation,side) - translate([3.75,2,6.5]) rotate([90,0,0]) cylinder(d=7, h=8); - } - if(type == "pwr5.5_7.5x11.5" && rotation == 90 && side == "top") { - place(loc_x,loc_y,loc_z,7,7,rotation,side) - translate([3.25,2,6.5]) rotate([90,0,0]) cylinder(d=7, h=8); - } - if(type == "pwr5.5_7.5x11.5" && rotation == 180 && side == "top") { - place(loc_x,loc_y,loc_z,7,7,rotation,side) - translate([3.25,-2.5,6.5]) rotate([90,0,0]) cylinder(d=7, h=8); - } - if(type == "pwr5.5_7.5x11.5" && rotation == 270 && side == "top") { - place(loc_x-2,loc_y,loc_z,7,7,rotation,side) - translate([3.75,-4.5,6.5]) rotate([90,0,0]) cylinder(d=7, h=8); - } - if(type == "pwr2.5_5x7.5" && rotation == 0 && side == "top") { - place(loc_x,loc_y,loc_z,3,3,rotation,side) - translate([2.75,2,2]) rotate([90,0,0]) cylinder(d=3, h=8); - } - if(type == "pwr2.5_5x7.5" && rotation == 90 && side == "top") { - place(loc_x,loc_y,loc_z,3,3,rotation,side) - translate([.25,2,2]) rotate([90,0,0]) cylinder(d=3, h=8); - } - if(type == "pwr2.5_5x7.5" && rotation == 180 && side == "top") { - place(loc_x,loc_y,loc_z,3,3,rotation,side) - translate([.5,-2.5,2]) rotate([90,0,0]) cylinder(d=3, h=8); - } - if(type == "pwr2.5_5x7.5" && rotation == 270 && side == "top") { - place(loc_x,loc_y,loc_z,3,3,rotation,side) - translate([2.75,-2.5,2]) rotate([90,0,0]) cylinder(d=3, h=8); - } - // pwr5.5_10x10 opening - if(type == "pwr5.5_10x10" && rotation == 0 && side == "top") { - place(loc_x-.25,loc_y-6,loc_z,10.5,13.5,rotation,side) - cube([10.5,8,10.5]); - } - // pwr5.5_10x10 opening - if(type == "pwr5.5_10x10" && rotation == 90 && side == "top") { - place(loc_x-6,loc_y-.25,loc_z,10.5,13.5,rotation,side) - cube([10.5,8,10.5]); - } - // pwr5.5_10x10 opening - if(type == "pwr5.5_10x10" && rotation == 180 && side == "top") { - place(loc_x-.25,loc_y+6,loc_z,10.5,13.5,rotation,side) - cube([10.5,8,10.5]); - } - // pwr5.5_10x10 opening - if(type == "pwr5.5_10x10" && rotation == 270 && side == "top") { - place(loc_x+6,loc_y-.25,loc_z,10.5,13.5,rotation,side) - cube([10.5,8,10.5]); - } - // pwr5.5_9.5x7 opening - if(type == "pwr5.5_9.5x7" && rotation == 0 && side == "top") { - place(loc_x-.25,loc_y-6,loc_z,10,13.5,rotation,side) - cube([10,8,7.5]); - } - // pwr5.5_9.5x7 opening - if(type == "pwr5.5_9.5x7" && rotation == 90 && side == "top") { - place(loc_x-6,loc_y-.25,loc_z,10,13.5,rotation,side) - cube([10,8,7.5]); - } - // pwr5.5_9.5x7 opening - if(type == "pwr5.5_9.5x7" && rotation == 180 && side == "top") { - place(loc_x-.25,loc_y+2,loc_z,10,13.5,rotation,side) - cube([10,8,7.5]); - } - // pwr5.5_9.5x7 opening - if(type == "pwr5.5_9.5x7" && rotation == 270 && side == "top") { - place(loc_x+2,loc_y-.25,loc_z,10,13.5,rotation,side) - cube([10,8,7.5]); - } - // emmc storage - if(type == "emmc" && side == "bottom" && rotation == 0) { - place(loc_x-.5,loc_y-.5,floorthick+adjust,14.5,19.5,rotation,side) - cube([14.5,19.5,floorthick+(2*adjust)]); - } - if(type == "emmc" && side == "bottom" && rotation == 90) { - place(loc_x-.5,loc_y-.5,floorthick+adjust,14.5,19.5,rotation,side) - cube([14.5,19.5,floorthick+(2*adjust)]); - } - if(type == "emmc" && side == "bottom" && rotation == 180) { - place(loc_x-.5,loc_y-.5,floorthick+adjust,14.5,19.5,rotation,side) - cube([14.5,19.5,floorthick+(2*adjust)]); - } - if(type == "emmc" && side == "bottom" && rotation == 270) { - place(loc_x-.5,loc_y-.5,floorthick+adjust+7,15,19.5,rotation,side) - cube([14.5,19.5,floorthick+(2*adjust)+12]); - } - // sd storage - if(type == "sdcard" && side == "bottom" && rotation == 0) { - place(loc_x-1,loc_y-15,loc_z-pcb_z-1.75,12,15.5,rotation,side) - cube([13,15.5,2]); - } - if(type == "sdcard" && side == "bottom" && rotation == 90) { - place(loc_x+5,loc_y,loc_z-pcb_z-1.75,12,15.5,rotation,side) - cube([12,15.5,2]); - } - if(type == "sdcard" && side == "bottom" && rotation == 180) { - place(loc_x,loc_y+5,loc_z-pcb_z-1.75,12,15.5,rotation,side) - cube([12,15.5,2]); - } - if(type == "sdcard" && side == "bottom" && rotation == 270) { - place(loc_x+5,loc_y-18,loc_z-pcb_z-1.75,12,15.5,rotation,side) - cube([12,15.5,2]); - } - if(type == "sdcard" && side == "top" && rotation == 0) { - place(loc_x,loc_y-15,loc_z+1.75,12,15.5,rotation,side) - cube([12,15.5,2]); - } - if(type == "sdcard" && side == "top" && rotation == 90) { - place(loc_x-15,loc_y-.5,loc_z+1.75,12,15.5,rotation,side) - cube([12,15.5,2]); - } - if(type == "sdcard" && side == "top" && rotation == 180) { - place(loc_x-.5,loc_y+5,loc_z+1.75,12,15.5,rotation,side) - cube([12,15.5,2]); - } - if(type == "sdcard" && side == "top" && rotation == 270) { - place(loc_x+5,loc_y,loc_z+1.75,12,15.5,rotation,side) - cube([12,15.5,2]); - } - if(type == "sdcard_i" && side == "bottom" && rotation == 0) { - place(loc_x,loc_y-18.5,floorthick+adjust+4,12,18.5,rotation,side) - cube([12,18.5,floorthick+(2*adjust)+4]); - } - if(type == "sdcard_i" && side == "bottom" && rotation == 90) { - place(loc_x+5.5,loc_y-.25,floorthick+adjust+4,12,18.5,rotation,side) - cube([12,18.5,floorthick+(2*adjust)+4]); - } - if(type == "sdcard_i" && side == "bottom" && rotation == 180) { - place(loc_x,loc_y+5.5,floorthick+adjust+4,12,18.5,rotation,side) - cube([12,18.5,floorthick+(2*adjust)+4]); - } - if(type == "sdcard_i" && side == "bottom" && rotation == 270) { - place(loc_x-18.5,loc_y-.25,floorthick+adjust+4,12,18.5,rotation,side) - cube([12,18.5,floorthick+(2*adjust)+4]); - } - if(type == "microsdcard" && side == "top" && rotation == 0) { - place(loc_x-.125,loc_y-12.1,loc_z,13.2,14.1,rotation,side) - cube([13.5,14.1,2]); - } - if(type == "microsdcard" && side == "top" && rotation == 90) { - place(loc_x-12.1,loc_y+.125,loc_z,13.2,14.1,rotation,side) - cube([13.5,14.1,2]); - } - if(type == "microsdcard" && side == "top" && rotation == 180) { - place(loc_x+.125,loc_y+12.1,loc_z,13.2,14.1,rotation,side) - cube([13.5,14.1,2]); - } - if(type == "microsdcard" && side == "top" && rotation == 270) { - place(loc_x+12.1,loc_y-.125,loc_z,13.2,14.1,rotation,side) - cube([13.5,14.1,2]); - } - if(type == "microsdcard" && side == "bottom" && rotation == 0) { - place(loc_x+.125,loc_y-12.1,loc_z-pcb_z,13.2,14.1,rotation,side) - cube([13.5,14.1,2]); - } - if(type == "microsdcard" && side == "bottom" && rotation == 90) { - place(loc_x+12.1,loc_y-.125,loc_z-pcb_z,13.2,14.1,rotation,side) - cube([13.5,14.1,2]); - } - if(type == "microsdcard" && side == "bottom" && rotation == 180) { - place(loc_x-.125,loc_y+12.1,loc_z-pcb_z,13.2,14.1,rotation,side) - cube([13.5,14.1,2]); - } - if(type == "microsdcard" && side == "bottom" && rotation == 270) { - place(loc_x-12.1,loc_y+.125,loc_z-pcb_z,13.2,14.1,rotation,side) - cube([13.5,14.1,2]); - } - if(type == "microsdcard2" && side == "bottom" && rotation == 0) { - place(loc_x-1,loc_y-15,loc_z-pcb_z,12,15.5,rotation,side) - cube([13,15.5,2]); - } - if(type == "microsdcard2" && side == "bottom" && rotation == 90) { - place(loc_x+5,loc_y,loc_z-pcb_z,12,15.5,rotation,side) - cube([12,15.5,2]); - } - if(type == "microsdcard2" && side == "bottom" && rotation == 180) { - place(loc_x,loc_y+5,loc_z-pcb_z,12,15.5,rotation,side) - cube([12,15.5,2]); - } - if(type == "microsdcard2" && side == "bottom" && rotation == 270) { - place(loc_x+5,loc_y-18,loc_z-pcb_z,12,15.5,rotation,side) - cube([12,15.5,2]); - } - if(type == "microsdcard2" && side == "top" && rotation == 0) { - place(loc_x,loc_y-15,loc_z+1.75,12,15.5,rotation,side) - cube([12,15.5,2]); - } - if(type == "microsdcard2" && side == "top" && rotation == 90) { - place(loc_x-15,loc_y-.5,loc_z+1.75,12,15.5,rotation,side) - cube([12,15.5,2]); - } - if(type == "microsdcard2" && side == "top" && rotation == 180) { - place(loc_x-.5,loc_y+5,loc_z+1.75,12,15.5,rotation,side) - cube([12,15.5,2]); - } - if(type == "microsdcard2" && side == "top" && rotation == 270) { - place(loc_x+5,loc_y,loc_z,12,15.5,rotation,side) - cube([12,15.5,2]); - } - // rj45 opening - if(type == "rj45_single" && rotation == 0) { - place(loc_x,loc_y-6,loc_z,16,17.5,rotation,side) - cube([16,8,14]); - } - if(type == "rj45_single" && rotation == 90) { - place(loc_x-6,loc_y,loc_z,16,17.5,rotation,side) - cube([16,8,14]); - } - if(type == "rj45_single" && rotation == 180) { - place(loc_x,loc_y+10,loc_z,16,17.5,rotation,side) - cube([16,8,14]); - } - if(type == "rj45_single" && rotation == 270) { - place(loc_x+9,loc_y,loc_z,16,17.5,rotation,side) - cube([16.5,8,14]); - } - if(type == "rj45_reverse_single" && rotation == 0) { - place(loc_x-.25,loc_y-6,loc_z,16,17.5,rotation,side) - cube([16.5,8,14]); - } - if(type == "rj45_reverse_single" && rotation == 90) { - place(loc_x-6,loc_y,loc_z,16,17.5,rotation,side) - cube([16.5,8,14]); - } - if(type == "rj45_reverse_single" && rotation == 180) { - place(loc_x,loc_y+10,loc_z,16,17.5,rotation,side) - cube([16.5,8,14]); - } - if(type == "rj45_reverse_single" && rotation == 270) { - place(loc_x+9,loc_y,loc_z,16,17.5,rotation,side) - cube([16.5,8,14]); - } - // rj45 short opening - if(type == "rj45_single_short" && rotation == 0) { - place(loc_x,loc_y-6,loc_z,16,17.5,rotation,side) - cube([15,8,12]); - } - if(type == "rj45_single_short" && rotation == 90) { - place(loc_x-6,loc_y,loc_z,16,17.5,rotation,side) - cube([15,8,12]); - } - if(type == "rj45_single_short" && rotation == 180) { - place(loc_x,loc_y+10,loc_z,16,17.5,rotation,side) - cube([15,8,12]); - } - if(type == "rj45_single_short" && rotation == 270) { - place(loc_x+9,loc_y,loc_z,16,17.5,rotation,side) - cube([15,8,12]); - } - // double stacked rj45 opening - if(type == "rj45_double_stacked" && rotation == 0) { - place(loc_x,loc_y-7.5,loc_z,18,17.5,rotation,side) - cube([19,12,27]); - } - if(type == "rj45_double_stacked" && rotation == 90) { - place(loc_x-7.5,loc_y,loc_z,18,17.5,rotation,side) - cube([19,12,27]); - } - if(type == "rj45_double_stacked" && rotation == 180) { - place(loc_x,loc_y+11.5,loc_z,18,17.5,rotation,side) - cube([19,12,27]); - } - if(type == "rj45_double_stacked" && rotation == 270) { - place(loc_x+10.5,loc_y,loc_z,18,17.5,rotation,side) - cube([19,12,27]); - } - if(type == "rj45_low_profile" && rotation == 0) { - place(loc_x,loc_y-6,loc_z-3.5,15,8,rotation,side) - cube([14.75,8,12.25]); - } - // micro usb opening - if(class == "usb2" && type == "micro" && rotation == 0 && side == "top") { - place(loc_x,loc_y-3,loc_z,8,3,rotation,side) microusb_open(); - } - if(class == "usb2" && type == "micro" && rotation == 90 && side == "top") { - place(loc_x-3,loc_y-1,loc_z,8,3,rotation,side) microusb_open(); - } - if(class == "usb2" && type == "micro" && rotation == 180 && side == "top") { - place(loc_x-1,loc_y+4.5,loc_z,8,3,rotation,side) microusb_open(); - } - if(class == "usb2" && type == "micro" && rotation == 270 && side == "top") { - place(loc_x+4.5,loc_y,loc_z,8,3,rotation,side) microusb_open(); - } - if(class == "usb2" && type == "micro" && rotation == 0 && side == "bottom") { - place(loc_x-1,loc_y-3,loc_z-1.25,8,3,rotation,side) microusb_open(); - } - if(class == "usb2" && type == "micro" && rotation == 90 && side == "bottom") { - place(loc_x+4.5,loc_y-1,loc_z-1.25,8,3,rotation,side) microusb_open(); - } - if(class == "usb2" && type == "micro" && rotation == 180 && side == "bottom") { - place(loc_x,loc_y+4.5,loc_z-1.25,8,3,rotation,side) microusb_open(); - } - if(class == "usb2" && type == "micro" && rotation == 270 && side == "bottom") { - place(loc_x-3,loc_y,loc_z-1.25,8,3,rotation,side) microusb_open(); - } - // double stack usb opening - if((type == "double_stacked_a" || type == "double_stacked_usb3-usbc" || type == "double_stacked_usb3-usb2") && rotation == 0) { - place(loc_x-1,loc_y-6,loc_z,15.5,16,rotation,side) - cube([15.5,8,16.5]); - } - if((type == "double_stacked_a" || type == "double_stacked_usb3-usbc" || type == "double_stacked_usb3-usb2") && rotation == 90) { - place(loc_x-6,loc_y-1.25,loc_z,15.5,16,rotation,side) - cube([15.5,8,16.5]); - } - if((type == "double_stacked_a" || type == "double_stacked_usb3-usbc" || type == "double_stacked_usb3-usb2") && rotation == 180) { - place(loc_x-1,loc_y+7.5,loc_z,15.5,16,rotation,side) - cube([15.5,8,16.5]); - } - if((type == "double_stacked_a" || type == "double_stacked_usb3-usbc" || type == "double_stacked_usb3-usb2") && rotation == 270) { - place(loc_x+6.25,loc_y-1,loc_z,15.5,16,rotation,side) - cube([15.5,8,16.5]); - } - // single vertical usb opening - if(type == "single_vertical_a" && rotation == 0) { - place(loc_x-.5,loc_y-6,loc_z,6.5,19.5,rotation,side) - cube([6.5,8,15]); - } - if(type == "single_vertical_a" && rotation == 90) { - place(loc_x-6,loc_y-.25,loc_z,6.5,19.5,rotation,side) - cube([6.5,8,15]); - } - if(type == "single_vertical_a" && rotation == 180) { - place(loc_x-.5,loc_y+6,loc_z,6.5,19.5,rotation,side) - cube([6.5,8,15]); - } - if(type == "single_vertical_a" && rotation == 270) { - place(loc_x+6.5,loc_y,loc_z,6.5,19.5,rotation,side) - cube([6.5,8,15]); - } - // single horizontal usb opening - if(type == "single_horizontal_a" && rotation == 0) { - place(loc_x-.75,loc_y-6,loc_z,15,7.5,rotation,side) - cube([15.5,8,8]); - } - if(type == "single_horizontal_a" && rotation == 90) { - place(loc_x-6,loc_y-.5,loc_z,15,7.5,rotation,side) - cube([15,8,7.5]); - } - if(type == "single_horizontal_a" && rotation == 180) { - place(loc_x-.5,loc_y+12.5,loc_z,15,7.5,rotation,side) - cube([15,8,7.5]); - } - if(type == "single_horizontal_a" && rotation == 270) { - place(loc_x+12.5,loc_y-.5,loc_z,15,7.5,rotation,side) - cube([15,8,7.5]); - } - // single horizontal usbc opening - if(class == "usbc" && type == "single_horizontal" && rotation == 0 && side == "top") { - place(loc_x+1.5,loc_y+2,loc_z+1.75,6,8,rotation,side) - rotate([90,0,0]) slot(3.75,6,8); - } - if(class == "usbc" && type == "single_horizontal" && rotation == 90 && side == "top") { - place(loc_x+2,loc_y+1.5,loc_z+1.75,6,8,rotation,side) - rotate([90,0,0]) slot(3.75,6,8); - } - if(class == "usbc" && type == "single_horizontal" && rotation == 180 && side == "top") { - place(loc_x+1.5,loc_y-3-adjust,loc_z+2,6,8,rotation,side) - rotate([90,0,0]) slot(3.75,6,8); - } - if(class == "usbc" && type == "single_horizontal" && rotation == 270 && side == "top") { - place(loc_x-3-adjust,loc_y+1.5,loc_z+1.75,6,8,rotation,side) - rotate([90,0,0]) slot(3.75,6,8); - } - if(class == "usbc" && type == "single_horizontal" && rotation == 0 && side == "bottom") { - place(loc_x+1.5,loc_y+2,loc_z-3.25,6,8,rotation,side) - rotate([90,0,0]) slot(3.75,6,8); - } - if(class == "usbc" && type == "single_horizontal" && rotation == 90 && side == "bottom") { - place(loc_x-3-adjust,loc_y+1.5,loc_z-3.25,6,8,rotation,side) - rotate([90,0,0]) slot(3.75,6,8); - } - if(class == "usbc" && type == "single_horizontal" && rotation == 180 && side == "bottom") { - place(loc_x+1.5,loc_y-3-adjust,loc_z-3.25,6,8,rotation,side) - rotate([90,0,0]) slot(3.75,6,8); - } - if(class == "usbc" && type == "single_horizontal" && rotation == 270 && side == "bottom") { - place(loc_x+2,loc_y+1.5,loc_z-3.25,6,8,rotation,side) - rotate([90,0,0]) slot(3.75,6,8); - } - // single horizontal usbc opening, lifted and enlarged for Lichee RV SoM - // TODO: implement other directions - if(class == "usbc" && type == "single_horizontal_on_licheerv" && rotation == 0 && side == "top") { - place(loc_x+1.5,loc_y+2,loc_z+5.05,6,8,rotation,side) - rotate([90,0,0]) slot(6,8,10); - } - // single vertical usbc opening - if(class == "usbc" && type == "single_vertical" && rotation == 0 && side == "top") { - place(loc_x+1.5,loc_y+2,loc_z+1.75,6,8,rotation,side) - translate([.25,0,6.25]) rotate([90,90,0]) slot(3.75,5.5,8); - } - if(class == "usbc" && type == "single_vertical" && rotation == 90 && side == "top") { - place(loc_x+2,loc_y+1.5,loc_z+1.75,6,8,rotation,side) - translate([.25,0,5.75]) rotate([90,90,0]) slot(3.75,5.5,8); - } - if(class == "usbc" && type == "single_vertical" && rotation == 180 && side == "top") { - place(loc_x+1.5,loc_y-3-adjust,loc_z+2,6,8,rotation,side) - translate([.25,0,5.75]) rotate([90,90,0]) slot(3.75,5.5,8); - } - if(class == "usbc" && type == "single_vertical" && rotation == 270 && side == "top") { - place(loc_x-3-adjust,loc_y+1.5,loc_z+1.75,6,8,rotation,side) - translate([.25,0,5.75]) rotate([90,90,0]) slot(3.75,5.5,8); - } - // ir opening - if(type == "ir_1" && rotation == 0) { - place(loc_x,loc_y,loc_z,6,6,rotation,side) - translate([3.5,2,7.5]) rotate([90,0,0]) cylinder(d=6, h=15); - } - if(type == "ir_1" && rotation == 90) { - place(loc_x,loc_y,loc_z,6,6,rotation,side) - translate([2.5,2,7.5]) rotate([90,0,0]) cylinder(d=6, h=15); - } - if(type == "ir_1" && rotation == 180) { - place(loc_x,loc_y,loc_z,6,6,rotation,side) - translate([2.5,5,6.5]) rotate([90,0,0]) cylinder(d=6, h=15); - } - if(type == "ir_1" && rotation == 270) { - place(loc_x,loc_y,loc_z,6,6,rotation,side) - translate([3.375,5,7.5]) rotate([90,0,0]) cylinder(d=6, h=15); - } - // switch opening - if(type == "slide_4x9" && rotation == 0) { - place(loc_x,loc_y,loc_z,4,9,rotation,side) - translate([0,-6,.25]) cube([9,8,4]); - } - if(type == "slide_4x9" && rotation == 90) { - place(loc_x,loc_y,loc_z,4,9,rotation,side) - translate([-5,-6,.25]) cube([9,8,4]); - } - if(type == "slide_4x9" && rotation == 180) { - place(loc_x,loc_y,loc_z,4,9,rotation,side) - translate([-5,-.5,.25]) cube([9,8,4]); - } - if(type == "slide_4x9" && rotation == 270) { - place(loc_x,loc_y,loc_z,4,9,rotation,side) - translate([0,-.75,.25]) cube([9,8,4]); - } - // rj45-usb2_double opening - if(type == "rj45-usb2_double" && rotation == 0) { - place(loc_x,loc_y-6,loc_z,19,28,rotation,side) - cube([19,8,31]); - } - if(type == "rj45-usb2_double" && rotation == 90) { - place(loc_x-6,loc_y,loc_z,19,28,rotation,side) - cube([19,8,31]); - } - if(type == "rj45-usb2_double" && rotation == 180) { - place(loc_x,loc_y+6,loc_z,19,28,rotation,side) - cube([19,8,31]); - } - if(type == "rj45-usb2_double" && rotation == 270) { - place(loc_x+6,loc_y,loc_z,19,28,rotation,side) - cube([19,8,31]); - } - // rj45-usb3_double opening - if(type == "rj45-usb3_double" && rotation == 0) { - place(loc_x-.25,loc_y-6,loc_z,19.5,28,rotation,side) - cube([19.5,8,31.25]); - } - if(type == "rj45-usb3_double" && rotation == 90) { - place(loc_x-6,loc_y-.25,loc_z,19.5,28,rotation,side) - cube([19.5,8,31.25]); - } - if(type == "rj45-usb3_double" && rotation == 180) { - place(loc_x+.25,loc_y+6,loc_z,19.5,28,rotation,side) - cube([19.5,8,31.25]); - } - if(type == "rj45-usb3_double" && rotation == 270) { - place(loc_x+6,loc_y-.25,loc_z,19.5,28,rotation,side) - cube([19.5,8,31.25]); - } - // out-in-spdif opening - if(type == "out-in-spdif" && rotation == 0) { - place(loc_x-.1,loc_y-6,loc_z,13,21.65,rotation,side) - cube([13,8,35.5]); - } - if(type == "out-in-spdif" && rotation == 90) { - place(loc_x-6,loc_y-.1,loc_z,13,21.65,rotation,side) - cube([13,8,35.5]); - } - if(type == "out-in-spdif" && rotation == 180) { - place(loc_x-.2,loc_y+6,loc_z,13,21.65,rotation,side) - cube([13,8,35.5]); - } - if(type == "out-in-spdif" && rotation == 270) { - place(loc_x+6,loc_y-.1,loc_z,13,21.65,rotation,side) - cube([13,8,35.5]); - } - // dp-hdmi_a opening - if(type == "dp-hdmi_a" && rotation == 0) { - place(loc_x-.5,loc_y-6,loc_z,19,18,rotation,side) - cube([19,8,19.25]); - } - if(type == "dp-hdmi_a" && rotation == 90) { - place(loc_x-6,loc_y-.5,loc_z,19,18,rotation,side) - cube([19,8,19.25]); - } - if(type == "dp-hdmi_a" && rotation == 180) { - place(loc_x-.5,loc_y+6,loc_z,19,18,rotation,side) - cube([19,8,19.25]); - } - if(type == "dp-hdmi_a" && rotation == 270) { - place(loc_x+6,loc_y-.5,loc_z,19,18,rotation,side) - cube([19,8,19.25]); - } - // sata_encl_power opening - if(type == "sata_encl_power" && rotation == 0) { - place(loc_x,loc_y,loc_z,38.5,7.5,rotation,side) - translate([1,14,3]) rotate([90,0,0]) slot(7.5,38.5,10); - } - if(type == "sata_encl_power" && rotation == 90) { - place(loc_x,loc_y,loc_z,38.5,7.5,rotation,side) - translate([-1,14,3]) rotate([90,0,0]) slot(7.5,38.5,10); - } - if(type == "sata_encl_power" && rotation == 180) { - place(loc_x,loc_y,loc_z,38.5,7.5,rotation,side) - translate([-1,8,3]) rotate([90,0,0]) slot(7.5,38.5,10); - } - if(type == "sata_encl_power" && rotation == 270) { - place(loc_x,loc_y,loc_z,38.5,7.5,rotation,side) - translate([1,8,3]) rotate([90,0,0]) slot(7.5,38.5,10); - } - // audio jack opening - if(type == "jack_3.5" && rotation == 0 && side == "top") { - place(loc_x,loc_y,loc_z+.25,7.5,7.5,rotation,side) - union() { - translate([3.15,2,2]) rotate([90,0,0]) cylinder(d=7, h=8); - translate([-.5,-.5,0]) cube([7.5,2.5,4.5]); - } - } - if(type == "jack_3.5" && rotation == 90 && side == "top") { - place(loc_x,loc_y,loc_z,7.5,7.5,rotation,side) - union() { - translate([4.1,2,2]) rotate([90,0,0]) cylinder(d=7, h=8); - translate([.5,-.5,0]) cube([7.5,2.5,4.5]); - } - } - if(type == "jack_3.5" && rotation == 180 && side == "top") { - place(loc_x,loc_y,loc_z,7.5,7.5,rotation,side) - union() { - translate([4.1,-2.5,2]) rotate([90,0,0]) cylinder(d=7, h=8); - translate([.5,-5,0]) cube([7.5,2.5,4.5]); - } - } - if(type == "jack_3.5" && rotation == 270 && side == "top") { - place(loc_x,loc_y,loc_z,7.5,7.5,rotation,side) - union() { - translate([3.15,-2.5,2]) rotate([90,0,0]) cylinder(d=7, h=8); - translate([-.5,-5,0]) cube([7.5,2.5,4.5]); - } - } - if(type == "jack_3.5" && rotation == 0 && side == "bottom") { - place(loc_x-1,loc_y,loc_z-1.5,7.5,7.5,rotation,side) - union() { - translate([3.15,2,2]) rotate([90,0,0]) cylinder(d=7, h=8); - translate([-.5,-.5,0]) cube([7.5,2.5,4.5]); - } - } - if(type == "jack_3.5" && rotation == 90 && side == "bottom") { - place(loc_x+4.1,loc_y,loc_z-1.5,7.5,7.5,rotation,side) - union() { - translate([4.1,2,2]) rotate([90,0,0]) cylinder(d=7, h=8); - translate([.5,-.5,0]) cube([7.5,2.5,4.5]); - } - } - if(type == "jack_3.5" && rotation == 180 && side == "bottom") { - place(loc_x-1,loc_y,loc_z-1.5,7.5,7.5,rotation,side) - union() { - translate([4.1,-2.5,2]) rotate([90,0,0]) cylinder(d=6.5, h=8); - translate([.5,-5,0]) cube([7.5,2.5,4.5]); - } - } - if(type == "jack_3.5" && rotation == 270 && side == "bottom") { - place(loc_x+4.1,loc_y,loc_z-1.5,7.5,7.5,rotation,side) - union() { - translate([3,-2.5,2]) rotate([90,0,0]) cylinder(d=7, h=8); - translate([-.5,-5,0]) cube([7.5,2.5,4.5]); - } - } - // button opening - if(type == "momentary_6x6x4") { - place(loc_x,loc_y,loc_z,6,6,rotation,side) - translate([3,3,4]) rotate([0,0,0]) cylinder(d=5, h=10); - } - if(type == "momentary_4x2x1" && rotation == 0) { - place(loc_x,loc_y,loc_z,6,6,rotation,side) - translate([2,1.5,1.5]) rotate([270,0,0]) cylinder(d=4, h=10); - } - if(type == "momentary_4x2x1" && rotation == 180) { - place(loc_x,loc_y,loc_z,6,6,rotation,side) - translate([4,4,1.5]) rotate([90,0,0]) cylinder(d=4, h=10); - } - if(type == "momentary_6x6x4_90" && rotation == 0) { - place(loc_x,loc_y,loc_z,6,6,rotation,side) - union() { - translate([3,-2.5,3]) rotate([90,0,0]) cylinder(d=5, h=8); - translate([-.5,-3.75,0]) cube([7,2.5,6.5]); - } - } - if(type == "momentary_6x6x4_90" && rotation == 90) { - place(loc_x,loc_y,loc_z,6,6,rotation,side) - union() { - translate([3,-2.5,3]) rotate([90,0,0]) cylinder(d=5, h=8); - translate([-.5,-3.75,0]) cube([7,2.5,6.5]); - } - } - if(type == "momentary_6x6x4_90" && rotation == 180) { - place(loc_x,loc_y,loc_z,6,6,rotation,side) - union() { - translate([3,-2.5,3]) rotate([90,0,0]) cylinder(d=5, h=8); - translate([-.5,-3.75,0]) cube([7,2.5,6.5]); - } - } - if(type == "momentary_6x6x4_90" && rotation == 270) { - place(loc_x,loc_y,loc_z,6,6,rotation,side) - union() { - translate([3,-2.5,3]) rotate([90,0,0]) cylinder(d=5, h=8); - translate([-.5,-3.75,0]) cube([7,2.5,6.5]); - } - } - if(type == "momentary_4.5x3.5x2.5_90" && side == "top" && rotation == 0) { - place(loc_x,loc_y,loc_z,4.5,3.5,rotation,side) - translate([2.25,0,1.8]) rotate([90,0,0]) cylinder(d=3.5, h=8); - } - if(type == "momentary_4.5x3.5x2.5_90" && side == "top" && rotation == 90) { - place(loc_x,loc_y,loc_z,4.5,3.5,rotation,side) - translate([2.25,0,1.8]) rotate([90,0,0]) cylinder(d=3.5, h=8); - } - if(type == "momentary_4.5x3.5x2.5_90" && side == "top" && rotation == 180) { - place(loc_x,loc_y,loc_z,4.5,3.5,rotation,side) - translate([2.25,1,1.8]) rotate([90,0,0]) cylinder(d=3.5, h=8); - } - if(type == "momentary_4.5x3.5x2.5_90" && side == "top" && rotation == 270) { - place(loc_x,loc_y,loc_z,4.5,3.5,rotation,side) - translate([2.25,1,1.8]) rotate([90,0,0]) cylinder(d=3.5, h=8); - } - if(type == "momentary_4.5x3.5x2.5_90" && side == "bottom" && rotation == 0) { - place(loc_x,loc_y,loc_z,4.5,3.5,rotation,side) - translate([2.25,0,3.25]) rotate([90,0,0]) cylinder(d=3.5, h=8); - } - if(type == "momentary_4.5x3.5x2.5_90" && side == "bottom" && rotation == 90) { - place(loc_x,loc_y,loc_z,4.5,3.5,rotation,side) - translate([2.25,1.25,3.25]) rotate([90,0,0]) cylinder(d=3.5, h=8); - } - if(type == "momentary_4.5x3.5x2.5_90" && side == "bottom" && rotation == 180) { - place(loc_x,loc_y,loc_z,4.5,3.5,rotation,side) - translate([2.25,1.25,3.25]) rotate([90,0,0]) cylinder(d=3.5, h=8); - } - if(type == "momentary_4.5x3.5x2.5_90" && side == "bottom"&& rotation == 270) { - place(loc_x,loc_y,loc_z,4.5,3.5,rotation,side) - translate([2.25,0,3.25]) rotate([90,0,0]) cylinder(d=3.5, h=8); - } - if(type == "momentary_7x3x3_90" && rotation == 0) { - place(loc_x,loc_y,loc_z,7,3,rotation,side) - translate([0,-6,0]) cube([7,8,3]); - } - if(type == "momentary_7x3x3_90" && rotation == 90) { - place(loc_x,loc_y,loc_z,7,3,rotation,side) - translate([0,-6,0]) cube([7,8,3]); - } - if(type == "momentary_7x3x3_90" && rotation == 180) { - place(loc_x,loc_y,loc_z,7,3,rotation,side) - translate([0,-6,0]) cube([7,8,3]); - } - if(type == "momentary_7x3x3_90" && rotation == 270) { - place(loc_x,loc_y,loc_z,7,3,rotation,side) - translate([0,-6,0]) cube([7,8,3]); - } - if(type == "audio_micro" && rotation == 0) { - place(loc_x,loc_y,loc_z,7.5,7.5,rotation,side) - translate([0,4,0]) cube([7.5,8,4]); - } - if(type == "audio_micro" && rotation == 90) { - place(loc_x,loc_y,loc_z,7.5,7.5,rotation,side) - translate([0,4,0]) cube([7.5,8,4]); - } - if(type == "m1_oem" && rotation == 0) { - place(loc_x,loc_y,loc_z,6,6,rotation,side) - union() { - translate([8.75,7.5,-20]) rotate([0,0,90]) slot(3,3,8); - translate([80,7.5,-20]) rotate([0,0,90]) slot(3,3,8); - translate([8.75,39.5,-20]) rotate([0,0,90]) slot(3,3,8); - translate([80,39.5,-20]) rotate([0,0,90]) slot(3,3,8); - translate([8.75,79.5,-20]) rotate([0,0,90]) slot(3,3,8); - translate([80,79.5,-20]) rotate([0,0,90]) slot(3,3,8); - translate([8.75,111.5,-20]) rotate([0,0,90]) slot(3,3,8); - translate([80,111.5,-20]) rotate([0,0,90]) slot(3,3,8); - } - } -} - - -// punchout opening -module punchout(width,depth,gap,thick,fillet,shape) { - - adjust = .01; - $fn=90; - - // slot punchout - if(shape == "slot") { - difference() { - translate([0,0,0]) slot(depth,width,thick); - translate([0,0,-adjust]) slot(depth-gap,width,thick+(2*adjust)); - // cross ties - translate([-1,-(depth/2)-1,-adjust]) cube([2,depth+2,thick+(2*adjust)]); - translate([(width/2)-1-(width/4)+4,-(depth/2)-1,-adjust]) cube([2,depth+2,thick+(2*adjust)]); - translate([(width/2)-1+(width/4)-4,-(depth/2)-1,-adjust]) cube([2,depth+2,thick+(2*adjust)]); - translate([width-1,-(depth/2)-1,-adjust]) cube([2,depth+2,thick+(2*adjust)]); - } - } - if(shape == "rectangle") { - difference() { - translate([(width/2),(depth/2),thick/2]) - cube_fillet_inside([width,depth,thick], - vertical=[fillet,fillet,fillet,fillet], - top=[0,0,0,0], bottom=[0,0,0,0], $fn=90); - translate([(width/2),(depth/2),(thick/2)-adjust]) - cube_fillet_inside([width-gap,depth-gap,thick+(3*adjust)], - vertical=[fillet,fillet,fillet,fillet], - top=[0,0,0,0], bottom=[0,0,0,0], $fn=90); - // cross ties - translate([-1,(depth/2)-1,-adjust]) cube([gap+2,2,thick+(2*adjust)]); - translate([width-4,depth-gap-1,-adjust]) cube([2,gap+2,thick+(2*adjust)]); - translate([2,depth-gap-1,-adjust]) cube([2,gap+2,thick+(2*adjust)]); - translate([width-gap-1,(depth/2)-1,-adjust]) cube([gap+2,2,thick+(2*adjust)]); - translate([width-4,-1,-adjust]) cube([2,gap+2,thick+(2*adjust)]); - translate([2,-1,-adjust]) cube([2,gap+2,thick+(2*adjust)]); - } - } - if(shape == "round") { - difference() { - translate([(width/2),(width/2),0]) - cylinder(d=width, h=thick); - translate([(width/2),(width/2),-adjust]) - cylinder(d=width-gap, h=thick+2*adjust); - // cross ties - translate([-1,(depth/2)-1,-adjust]) cube([gap+2,2,thick+(2*adjust)]); - translate([(width/2)-1,depth-gap-1,-adjust]) cube([2,gap+2,thick+(2*adjust)]); - translate([width-gap-1,(depth/2)-1,-adjust]) cube([gap+2,2,thick+(2*adjust)]); - translate([(width/2)-1,-1,-adjust]) cube([2,gap+2,thick+(2*adjust)]); - } - } - } - - -// vent opening -module vent(width,length,height,gap,rows,columns,orientation) { - - fillet = width/2; - adjust = .01; - $fn=90; - - // vertical orientation - if(orientation == "vertical") { rotate([90,0,0]) - for (r=[0:length+gap:rows*(length+gap)-1]) { - for (c=[0:width+(2*gap):(columns*(width+(2*gap)))-1]) { - translate ([c,r,-1]) cube([width,length,height]); - } - } - } - // horizontal orientation - if(orientation == "horizontal") { - for (r=[0:length+(2*gap):rows*(length+gap)]) { - for (c=[0:width+(2*gap):(columns*(width+(2*gap)))-1]) { - translate ([c,r,-1]) cube([width,length,height]); - } - } - } -} - -// Hex vent opening -module vent_hex(cells_x, cells_y, thickness, cell_size, cell_spacing, orientation) { - xs = cell_size + cell_spacing; - ys = xs * sqrt(3/4); - rot = (orientation=="vertical") ? 90 : 0; - - rotate([rot,0,0]) translate([cell_size/2, cell_size*sqrt(1/3),-1]) { - for (ix = [0 : ceil(cells_x/2)-1]) { - for (iy = [0 : 2 : cells_y-1]) { - translate([ix*xs, iy*ys,0]) rotate([0,0,90]) - cylinder(r=cell_size/sqrt(3), h=thickness, $fn=6); - } - } - for (ix = [0 : (cells_x/2)-1]) { - for (iy = [1 : 2 : cells_y-1]) { - translate([(ix+0.5)*xs, iy*ys,0]) rotate([0,0,90]) - cylinder(r=cell_size/sqrt(3), h=thickness, $fn=6); - } - } - } -} - - -// hk power button -module hk_pwr_button(mask = false) { - - adjust=.01; - $fn = 90; - - if(mask == true) { - color("silver") translate([0, 0, -19]) cylinder(h=20, d=16); - } - else { - difference() { - union() { - // light ring - difference() { - color("blue", .6) translate([0, 0, 1.67]) cylinder(h=.1, d=14.75); - color("blue", .6) translate([0, 0, 1.66]) cylinder(h=.2, d=13.75); - } - // power symbol - color("blue", .6) translate([-.5, 0, 1.65]) color("blue", .6) cube([1,3.5,.1]); - difference() { - color("blue", .6) translate([0, 0, 1.66]) cylinder(h=.1, d=5.75); - color("blue", .6) translate([0, 0, 1.65]) cylinder(h=.2, d=4.5); - color("blue", .6) translate([-1.75, 0, 1.65]) cube([3.5,4,2]); - } - // body - color("Gainsboro") cylinder(h=1.66, d1=17.75, d2=14.75); - color("silver") translate([0, 0, -19]) cylinder(h=19, d=15.8); - difference() { - color("steelblue") translate([0, 0, -27.9]) cylinder(h=9, d=15.8); - color("steelblue") translate([-1+15.8/2, -4, -19-9.1]) cube([2,8,6.1]); - color("steelblue") translate([-1-15.8/2, -4, -19-9.1]) cube([2,8,6.1]); - } - color("white") translate([-3.5, -6, -28]) cube([7,12,2]); - - // nut - difference() { - translate([0, 0, -4.75]) color("Gainsboro", .6) cylinder(h=2.75, d=21.5, $fn=6); - translate([0, 0, -4.75]) color("Gainsboro", .6) cylinder(h=2.75, d=15.8); - } - // connector pins - color("silver") translate([-1.4, -.5, -34.99]) cube([2.8, 1, 7]); - color("silver") translate([-1.4, -.5+5, -34.99]) cube([2.8, 1, 7]); - color("silver") translate([-1.4, -.5-5, -34.99]) cube([2.8, 1, 7]); - color("silver") translate([-1.4-1.75, -.5+1.75, -34.99]) cube([1, 2.8, 7]); - color("silver") translate([-1.4+3.5, -.5+1.75, -34.99]) cube([1, 2.8, 7]); - } - } - } -} - - -// @mctom's odroid-h3 gpio port extender -module h3_port_extender(style, mask = false) { - - adjust=.01; - $fn = 90; - - if(style == "header") { - if(mask == true) { - translate([-20, 6.25, 15]) cube([12, 7.5, 14.75]); - translate([-20, 15.875, 15]) cube([12, 7.5, 14.75]); - translate([-20, 25.375, 15]) cube([12, 7.5, 14.75]); - translate([-20, 17, 32.2]) rotate([0, 90, 0]) cylinder(d=3.5, h=12); - } - else { - // gpio 24 pin front position - color("silver") translate([1.6, 188.5, 84]) rotate([90, 0, 270]) import("stl/h3_port_extender.stl"); -// color("dimgrey") translate([-3, 15.75, 0.25]) rotate([90, 180, 180]) import("stl/header_f_2x12_90.stl"); - translate([0, 2, 8.25]) rotate([0, 180, 0]) header_f(12,8); - translate([-2.54, 2, 8.25]) rotate([0, 180, 0]) header_f(12,8); - color("dimgrey") translate([-2.5, 0, 29.5]) rotate([270, 0, 90]) import("stl/header_2x2_90.stl"); - } - } - if(style == "remote") { - if(mask == true) { - translate([-19, 6.25, 15]) cube([12,7.5,14.75]); - translate([-19, 15.875, 15]) cube([12,7.5,14.75]); - translate([-19, 25.375, 15]) cube([12,7.5,14.75]); - translate([-19, 17, 32.2]) rotate([0,90,0]) cylinder(d=2.5, h=12); - translate([-19, 17, 4.6]) rotate([0,90,0]) cylinder(d=2.5, h=12); - } - else { - // gpio 24 pin front position - color("silver") translate([1.6, 188.5, 84]) rotate([90, 0, 270]) import("stl/h3_port_extender.stl"); - color("dimgrey") translate([-2.5, 0, 29.5]) rotate([270, 0, 90]) import("stl/header_2x2_90.stl"); - color("dimgrey")translate([9,-.5,12.75]) rotate([0,270,90]) import("stl/header_encl_2x5_90.stl"); - translate([2, 2, 14.08]) rotate([0, 90, 0]) header(12); - translate([2, 2, 11.54]) rotate([0, 90, 0]) header(12); - } - } -} - - -/* -// h3_port_extender_holder(part, offset) -// part = "both","top","bottom" -// offset = projection from inside wall in mm -// holder for the @mctom's remote h3 port extender */ -module h3_port_extender_holder(part,offset=2) { - adjust = .01; - size = [16-offset,40,5.5]; - if(part == "bottom" || part == "both") { - difference() { - translate([-10+offset,-3.5,2]) cube(size); - translate([-.25,-.25,-adjust]) cube([2.5, 33.25, 12]); - translate([2, 2, -adjust]) 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([-7,-1.,-adjust]) cylinder(d=4.25, h=20); - } - } - if(part == "top" || part == "both") { - difference() { - translate([-10+offset,-3.5,29.5]) cube(size); - translate([-.25,-.25,28]) cube([2.5, 33.25, 12]); - translate([1.5, 2, 27.5-adjust]) cube([10, 28.5, 12]); - translate([-12, -4, 28]) cube([20, 13, 10]); - 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); - } - } -} +include <./mod/add.scad>; +include <./mod/case_bottom.scad>; +include <./mod/case_side.scad>; +include <./mod/case_top.scad>; +include <./mod/parametric_move.scad>; +include <./mod/indent.scad>; +include <./mod/fillets.scad>; +include <./mod/place.scad>; +include <./mod/sub.scad>; -// enclosed keyhole -module keyhole(keysize, mask = false) { - - adjust=.01; - $fn = 90; - - if(mask == true) { - union() { - translate([0, 0, -adjust]) cylinder(h=keysize[3]+2*adjust, d=keysize[0]); - translate([-keysize[1]/2, 0, -adjust]) cube([keysize[1], keysize[2]+keysize[0]/2, keysize[3]+2*adjust]); - translate([0, -keysize[1]/2, -adjust]) cube([keysize[2]+keysize[0]/2, keysize[1], keysize[3]+2*adjust]); - } - } - else { - difference() { - union() { - translate([0, 0, -adjust]) - difference() { - difference() { - 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([keysize[2], keysize[2], -adjust]) cube([keysize[2]*3, keysize[2]*3, keysize[3]+5]); - } - difference() { - translate([-keysize[2]+2, -keysize[2]+2, keysize[3]-adjust]) - cube([-4+keysize[2]*3, -4+keysize[2]*3, 3.5]); - translate([2, -10, 0]) rotate([0, 0, 135]) cube([20, 10, 10]); - translate([+keysize[2]-2, keysize[2]-2, -adjust]) - cube([keysize[2]*3, keysize[2]*3, keysize[3]+5]); - } - } - difference() { - 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([keysize[2], keysize[2], -adjust]) cube([keysize[2]*3, keysize[2]*3, keysize[3]+2*adjust]); - union() { - translate([0, 0, -adjust]) cylinder(h=keysize[3]+2*adjust, d=keysize[0]); - translate([-keysize[1]/2, 0, -adjust]) cube([keysize[1], keysize[2]+keysize[0]/2, keysize[3]+2*adjust]); - translate([0, -keysize[1]/2, -adjust]) cube([keysize[2]+keysize[0]/2, keysize[1], keysize[3]+2*adjust]); - } - } - } -} - - -// d-sub connector -module dsub(dsubsize, mask = false) { - - adjust=.01; - $fn = 90; - - if(mask == true) { - union() { - translate([-1, 1, -.75]) rotate([90,0,0]) slab_r([19,10.5,10], [4,4,4,4]); - translate([-4, 1, 4.5]) rotate([90,0,0]) cylinder(h=10, d=3); - translate([21, 1, 4.5]) rotate([90,0,0]) cylinder(h=10, d=3); - } - } - else { - if(dsubsize[0] == 9 && dsubsize[1] == "female") { - translate([8.5,0.4,4.5]) rotate([90,0,0]) import("./stl/db9_f.stl"); - } - if(dsubsize[0] == 9 && dsubsize[1] == "male") { - translate([8.5,0.4,4.5]) rotate([90,0,0]) import("./stl/db9_m.stl"); - } - } -} - - -// -// nut_holder(nut, style, dia_x, dia_y, height) -// nut = "m2", "m2.5", "m3", "m4" -// style = "default", "sloped", "trap" -// dia_x = top diameter or x size in mm -// dia_y = bottom diameter or y size in mm -// height = holder height in mm -// -module nut_holder(nut, style, dia_x, dia_y, height) { - - -nuts = [[2,4,1.6], // m2 size, diameter, height - [2.5,5,2], // m2.5 size, diameter, height - [3,5.5,2.4], // m3 size, diameter, height - [4,7,3.2]]; // m4 size, diameter, height - -$fn = 180; - - if( style == "default") { - difference() { - cylinder(d=dia_x, h=height); - if(nut == "m2") { - translate([0, 0, -1]) cylinder(d=nuts[0][0]+.25, h=height+2); - translate([0, 0, 2]) cylinder(d=nuts[0][1]*2/sqrt(3), h=height, $fn=6); - } - if(nut == "m2.5") { - translate([0, 0, -1]) cylinder(d=nuts[1][0]+.25, h=height+2); - translate([0, 0, 2]) cylinder(d=nuts[1][1]*2/sqrt(3), h=height, $fn=6); - } - if(nut == "m3") { - translate([0, 0, -1]) cylinder(d=nuts[2][0]+.5, h=height+2); - translate([0, 0, 2]) cylinder(d=nuts[2][1]*2/sqrt(3), h=height, $fn=6); - } - if(nut == "m4") { - translate([0, 0, -1]) cylinder(d=nuts[3][0]+.5, h=height+2); - translate([0, 0, 2]) cylinder(d=nuts[3][1]*2/sqrt(3), h=height, $fn=6); - } - } - } - if( style == "sloped") { - difference() { - cylinder(d2=dia_x, d1=dia_y, h=height); - if(nut == "m2") { - translate([0, 0, -1]) cylinder(d=nuts[0][0]+.25, h=height+2); - translate([0, 0, 2]) cylinder(d=nuts[0][1]*2/sqrt(3), h=height, $fn=6); - } - if(nut == "m2.5") { - translate([0, 0, -1]) cylinder(d=nuts[1][0]+.25, h=height+2); - translate([0, 0, 2]) cylinder(d=nuts[1][1]*2/sqrt(3), h=height, $fn=6); - } - if(nut == "m3") { - translate([0, 0, -1]) cylinder(d=nuts[2][0]+.5, h=height+2); - translate([0, 0, 2]) cylinder(d=nuts[2][1]*2/sqrt(3), h=height, $fn=6); - } - if(nut == "m4") { - translate([0, 0, -1]) cylinder(d=nuts[3][0]+.5, h=height+2); - translate([0, 0, 2]) cylinder(d=nuts[3][1]*2/sqrt(3), h=height, $fn=6); - } - } - } - if( style == "trap") { - if(nut == "m2") { - difference() { - translate([-dia_x/2, -dia_y/2, 0]) cube([dia_x, dia_y, height]); - translate([0, 0, -1]) cylinder(d=nuts[0][0]+.25, h=height+2); - translate([0, 0, 2]) rotate([0,0,30]) cylinder(d=nuts[0][1]*2/sqrt(3), h=nuts[0][2], $fn=6); - translate([-nuts[0][1]/2, 0, 2]) cube([nuts[0][1], dia_x, nuts[0][2]]); - } - } - if(nut == "m2.5") { - difference() { - translate([-dia_x/2, -dia_y/2, 0]) cube([dia_x, dia_y, height]); - translate([0, 0, -1]) cylinder(d=nuts[1][0]+.325, h=height+2); - translate([0, 0, 2]) rotate([0,0,30]) cylinder(d=nuts[1][1]*2/sqrt(3), h=nuts[1][2], $fn=6); - translate([-nuts[1][1]/2, 0, 2]) cube([nuts[1][1], dia_x, nuts[1][2]]); - } - } - if(nut == "m3") { - difference() { - translate([-dia_x/2, -dia_y/2, 0]) cube([dia_x, dia_y, height]); - translate([0, 0, -1]) cylinder(d=nuts[2][0]+.5, h=height+2); - translate([0, 0, 2]) rotate([0,0,30]) cylinder(d=nuts[2][1]*2/sqrt(3), h=nuts[2][2], $fn=6); - translate([-nuts[2][1]/2, 0, 2]) cube([nuts[2][1], dia_x, nuts[2][2]]); - } - } - if(nut == "m4") { - difference() { - translate([-dia_x/2, -dia_y/2, 0]) cube([dia_x, dia_y, height]); - translate([0, 0, -1]) cylinder(d=nuts[3][0]+.5, h=height+2); - translate([0, 0, 2]) rotate([0,0,30]) cylinder(d=nuts[3][1]*2/sqrt(3), h=nuts[3][2], $fn=6); - translate([-nuts[3][1]/2, 0, 2]) cube([nuts[3][1], dia_x, nuts[3][2]]); - } - } - } -} - - -module cableholder_spacer() { - - size = [9.4,16,6]; - $fn = 90; - translate([0,size[2]/2,-5]) rotate([90,0,0]) - difference() { - translate([size[0]/2,size[0]/2,0]) rotate([0,0,90]) slot(size[0],size[1],size[2]); - translate([-1,5,3]) rotate([0,90,0]) cylinder(d=3.2, h=12); - translate([-1,7.5,-1]) cube([2,20,9]); - translate([5,9.5,-1]) rotate([0,0,90]) slot(4.5,11,9); - translate([3,20,-1]) rotate([0,0,45]) cube([2,6,9]); - } -} - - -module hk_m1s_case_holes(type="landscape") { - - if(type == "portrait") { - cylinder(d=3, h=6); - translate([0,107,0]) cylinder(d=3, h=6); - translate([58,0,0]) cylinder(d=3, h=6); - translate([58,107,0]) cylinder(d=3, h=6); - } - else { - cylinder(d=3, h=6); - translate([0,58,0]) cylinder(d=3, h=6); - translate([107,0,0]) cylinder(d=3, h=6); - translate([107,58,0]) cylinder(d=3, h=6); - } -} - - -// hk m1s ups -module hk_m1s_ups() { - - pcb_size = [115,32,1.62]; - - adj = .01; - $fn = 90; - - difference() { - union() { - color("#008066") slab(pcb_size,4); - color("#fee5a6") translate([3.5,3.5,-.1]) cylinder(d=5.5, h=pcb_size[2]+.2); - color("#fee5a6") translate([3.5,pcb_size[1]-3.5,-.1]) cylinder(d=5.5, h=pcb_size[2]+.2); - color("#fee5a6") translate([pcb_size[0]-3.5,3.5,-.1]) cylinder(d=5.5, h=pcb_size[2]+.2); - color("#fee5a6") translate([pcb_size[0]-3.5,pcb_size[1]-3.5,-.1]) cylinder(d=5.5, h=pcb_size[2]+.2); - } - color("#fee5a6") translate([3.5,3.5,-1]) cylinder(d=4, h=4); - color("#fee5a6") translate([3.5,pcb_size[1]-3.5,-1]) cylinder(d=4, h=4); - color("#fee5a6") translate([pcb_size[0]-3.5,3.5,-1]) cylinder(d=4, h=4); - color("#fee5a6") translate([pcb_size[0]-3.5,pcb_size[1]-3.5,-1]) cylinder(d=4, h=4); - } - // battery and clips - color("silver") translate([15,5,pcb_size[2]]) rotate([0,0,270]) battery_clip(); - color("silver") translate([80,16,pcb_size[2]]) rotate([0,0,90]) battery_clip(); - translate([13.25,10.5,pcb_size[2]+10.4]) rotate([0,90,0]) battery("18650_convex"); - - translate([86.75,.5,pcb_size[2]]) momentary45x15(); - translate([97.5,-1,pcb_size[2]]) usbc(); - - translate([35,28,pcb_size[2]]) led("DodgerBlue"); - translate([40,28,pcb_size[2]]) led("DodgerBlue"); - translate([45,28,pcb_size[2]]) led("DodgerBlue"); - translate([50,28,pcb_size[2]]) led("DodgerBlue"); - - translate([113,8,pcb_size[2]]) rotate([0,0,90]) led("green"); - translate([113,16,pcb_size[2]]) rotate([0,0,90]) led(); - translate([113,21,pcb_size[2]]) rotate([0,0,90]) led(); - - translate([78,29,pcb_size[2]]) rotate([0,0,270])header(7); - translate([78,31.5,pcb_size[2]]) rotate([0,0,270])header(7); -} - - -// prototype board, ups footprint -module proto_ups() { - - pcb_size = [115,32,1.62]; - - adj = .01; - $fn = 90; - - union() { - difference() { - union() { - color("#008066") slab(pcb_size,4); - color("#fee5a6") translate([3.5,3.5,-.1]) cylinder(d=5.5, h=pcb_size[2]+.2); - color("#fee5a6") translate([3.5,pcb_size[1]-3.5,-.1]) cylinder(d=5.5, h=pcb_size[2]+.2); - color("#fee5a6") translate([pcb_size[0]-3.5,3.5,-.1]) cylinder(d=5.5, h=pcb_size[2]+.2); - color("#fee5a6") translate([pcb_size[0]-3.5,pcb_size[1]-3.5,-.1]) cylinder(d=5.5, h=pcb_size[2]+.2); - } - color("#fee5a6") translate([3.5,3.5,-1]) cylinder(d=4, h=4); - color("#fee5a6") translate([3.5,pcb_size[1]-3.5,-1]) cylinder(d=4, h=4); - color("#fee5a6") translate([pcb_size[0]-3.5,3.5,-1]) cylinder(d=4, h=4); - color("#fee5a6") translate([pcb_size[0]-3.5,pcb_size[1]-3.5,-1]) cylinder(d=4, h=4); - } - // pads - for(r=[5:2.54:30]) { - translate([10,r,pcb_size[2]+adj]) pcb_pad(38); - } - } -} - - -// prototype board, m1s footprint -module proto_m1s() { - - pcb_size = [90,65,1.62]; - - adj = .01; - $fn = 90; - - union() { - difference() { - union() { - color("#008066") slab(pcb_size,2); - color("#fee5a6") translate([3.5,3.5,-.1]) cylinder(d=4.5, h=pcb_size[2]+.2); - color("#fee5a6") translate([pcb_size[0]-3.5,3.5,-.1]) cylinder(d=4.5, h=pcb_size[2]+.2); - color("#fee5a6") translate([17.5,52.5,-.1]) cylinder(d=4.5, h=pcb_size[2]+.2); - color("#fee5a6") translate([67.5,55.1,-.1]) cylinder(d=4.5, h=pcb_size[2]+.2); - } - color("#fee5a6") translate([3.5,3.5,-1]) cylinder(d=3, h=4); - color("#fee5a6") translate([pcb_size[0]-3.5,3.5,-1]) cylinder(d=3, h=4); - color("#fee5a6") translate([17.5,52.5,-1]) cylinder(d=3, h=4); - color("#fee5a6") translate([67.5,55.1,-1]) cylinder(d=3, h=4); - } - // pads - for(r=[7:2.54:32]) { - translate([10,r,pcb_size[2]+adj]) pcb_pad(28); - } - } -} - -module battery_clip(bat_dia = 18.4) { - - mat = .38; - width = 9.5; - tab = 8.9; - bat_holder = bat_dia+2*mat; - adj = .1; - - translate([-5.5,0,10.5]) { - difference() { - translate([0,width,0]) rotate([90,0,0]) cylinder(d=bat_holder, h=9.5); - translate([0,width+adj,0]) rotate([90,0,0]) cylinder(d=bat_dia, h=10.5); - translate([mat/2-11.1/2,-adj,mat-1.3-bat_dia/2]) cube([11.1-mat,width+2*adj,3]); - translate([0,width+adj,0]) rotate([90,-45,0]) cube([bat_dia,bat_dia,bat_holder]); - } - difference() { - translate([-11.1/2,0,-1.3-bat_dia/2]) cube([11.1,width,3]); - translate([mat-11.1/2,-adj,mat/2-1.3-bat_dia/2]) cube([11.1-2*mat,width+2*adj,3]); - } - difference() { - translate([-(tab/2),-3.5,-1-bat_dia/2]) rotate([-5,0,0]) cube([tab,3.5,10]); - translate([-(tab/2)-adj,-3.5+mat,mat-1-bat_dia/2]) rotate([-5,0,0]) cube([tab+2*adj,3.5+mat,10]); - } - translate([0,-2.225,0]) rotate([85,0,0]) cylinder(d=tab, h=mat); - difference() { - translate([0,-2.75,0]) sphere(d=3); - translate([-5,-2.75,-5]) rotate([85,0,0]) cube([tab,10,10]); - } - } -} - - -module battery(type) { - - adj = .01; - if(type == "18650") { - difference() { - cylinder(d=18.4, h=65); - translate([0,0,65-4]) difference() { - cylinder(d=18.5, h=2); - cylinder(d=17.5, h=3); - } - } - } - if(type == "18650_convex") { - difference() { - cylinder(d=18.4, h=68); - translate([0,0,65-4]) difference() { - cylinder(d=18.5, h=2); - cylinder(d=17.5, h=3); - } - translate([0,0,65-adj]) difference() { - cylinder(d=18.5, h=3+2*adj); - cylinder(d=14.4, h=3+2*adj); - } - } - } - if(type == "21700") { - difference() { - cylinder(d=21, h=70); - translate([0,0,70-4]) difference() { - cylinder(d=21.1, h=2); - cylinder(d=20.1, h=3); - } - } - } -} - - -// single row pcb pad -module pcb_pad(pads = 1, style = "round") { - - adjust = .01; - $fn = 90; - pad_size = 1.25; - size_y = 2.54; - size_x = 2.54 * (pads-1); - union() { - for (i=[0:2.54:size_x]) { - if(style == "round") { - difference() { - 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); - } - } - if(style == "square") { - difference() { - 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); - } - } - } - } -} - - -module led(ledcolor = "red") { - - color(ledcolor) cube([3,1.5,.4]); - color("silver") cube([.5,1.5,.5]); - color("silver") translate([2.5,0,0]) cube([.5,1.5,.5]); -} - - -module m_insert(type="M3", icolor = "#ebdc8b") { //#f4e6c3, #ebdc8b - - odiam = type == "M3" ? 4.2 : 3.5; - idiam = type == "M3" ? 3 : 2.5; - iheight = 4; - - difference() { - color(icolor,.6) cylinder(d=odiam, h=iheight); - color(icolor,.6) translate([0,0,-1]) cylinder(d=idiam, h=iheight+2); - } - for(bearing = [0:10:360]) { - color(icolor) translate([-.25+(odiam/2)*cos(bearing),-.25+(odiam/2)*sin(bearing),iheight-1.5]) - rotate([0,0,0]) cube([.5,.5,1.5]); - } -} - - -module usbc() { - - $fn=90; - adj = .01; - - // usbc horizontal type - - size_x = 9; - size_y = 7; - dia = 3.5; - diam = 3.75; - - rotate([90, 0, 0]) translate([dia/2, dia/2, -size_y]) union() { - difference () { - color("silver") - hull() { - translate([0,0,0]) cylinder(d=dia,h=size_y); - translate([size_x-dia,0,0]) cylinder(d=dia,h=size_y); - } - color("silver") translate([0,0,1]) - hull() { - translate([0,0,0]) cylinder(d=3,h=size_y+.2); - translate([size_x-dia,0,0]) cylinder(d=3,h=size_y+.2); - } - } - color("black") translate([0,-1.2/2,.1]) cube([5.5,1.2,6]); - } - } +include <./lib/access_panel.scad>; +include <./lib/art.scad>; +include <./lib/battery.scad>; +include <./lib/button.scad>; +include <./lib/cable_holder.scad>; +include <./lib/component.scad>; +include <./lib/custom.scad>; +include <./lib/fan.scad>; +include <./lib/fastener.scad>; +include <./lib/feet.scad>; +include <./lib/hd.scad>; +include <./lib/holder.scad>; +include <./lib/keyhole.scad>; +include <./lib/oem_hk.scad>; +include <./lib/pcb_pad.scad>; +include <./lib/shape.scad>; +include <./lib/standoff.scad>; +include <./lib/vent.scad>;