neotrellis-grid/supports.scad

102 lines
3.6 KiB
OpenSCAD
Raw Normal View History

2021-07-20 11:52:35 +00:00
// this SCAD file defines the support structures for the neotrellis grid. (potentially also bottom case)
pcb_size = 60; // the PCB is 60x60mm square
pcb_depth = 7.57; // the PCB is 7.57mm deep, overall (including connector + lEDs)
connector_depth=5.7; // the connector on the bottom of the PCB is 5.8mm thick.
pcb_thickness= 1.7; // the PCB itself (just the board, w/o components) is roughly 1.7mm thick
support_width=5; // width of support structure walls
support_depth=10; // depth of support structure wall
floor_depth = 1; // depth of the bottom floor of the support
wall_height = (pcb_depth-connector_depth)+4; // height of walls above the top of the supports
wall_width = 1; // width of walls above the top of the supports
cutout_width=25; // width of the cutouts in the support structure, for wires etc
cutout_depth=5; // depth of the cutouts in the support structure
pcbs_wide=2; // how many trellis PCBs are in the grid, width-wise
pcbs_long=4; // how many trellis PCBs are in the grid, length-wise
tolerance = 0.4;
// translate everything down relative to the PCB reference
translate([0,0,-support_depth-pcb_thickness]) {
// create basic grid of support units
difference() {
union() {
// create large outer box
translate([-wall_width,-wall_width]) {
difference() {
cube([pcb_size*pcbs_long+wall_width*2,pcb_size*pcbs_wide+wall_width*2,support_depth+wall_height]);
translate([wall_width,wall_width]) {
cube([pcb_size*pcbs_long,pcb_size*pcbs_wide,support_depth+wall_height+0.1]);
}
}
}
for(x=[0:pcbs_long-1]) {
for(y=[0:pcbs_wide-1]) {
translate([pcb_size*x,pcb_size*y,0]) {
support_unit();
}
}
}
}
// add lengthwise internal cutouts
for(x=[0:pcbs_wide-1]) {
translate(
[pcb_size/2,
(pcb_size/2-cutout_width/2)+(pcb_size*x),
support_depth-cutout_depth]) {
cube([(pcb_size*(pcbs_long-1)),cutout_width,cutout_depth+1]);
}
}
// add widthwise internal cutouts
for(x=[0:pcbs_long-1]) {
translate(
[(pcb_size/2-cutout_width/2) + ((pcb_size)*x),
pcb_size/2,
support_depth-cutout_depth]) {
cube([cutout_width, pcb_size*(pcbs_wide-1), cutout_depth+1]);
}
}
// add cutout for USB port
translate(
[pcb_size*(pcbs_long-1)+wall_width+1,
pcb_size/2-cutout_width/2+pcb_size,
support_depth-cutout_depth
]) {
cube([pcb_size, cutout_width, cutout_depth+1]);
}
}
}
// load and position the PCB grid as a reference
rotate([180,0,0]) {
translate([pcb_size/2,-pcb_size/2-pcb_size]) {
for(x=[0:pcbs_long-1]) {
for(y=[0:pcbs_wide-1]) {
translate([pcb_size*x,pcb_size*y,0]) {
%import("pcb-single.stl");
}
}
}
}
}
// a support unit is the individual box underneath one trellis PCB. no cutouts are included in the module as these differ depending on position.
module support_unit() {
// outer box - the size of the overall box
difference() {
cube([pcb_size,pcb_size,support_depth]);
translate([support_width,support_width,floor_depth]) {
// inner box - cuts a hole in the center of the box to create walls+floor
cube(
[pcb_size-(support_width*2),
pcb_size-(support_width*2),
support_depth+1.01]);
}
}
}