add mounting holes for plate, smol refactors

This commit is contained in:
Nico 2021-07-20 18:35:03 +01:00
parent 5756e7ca2c
commit df9d0ac92e
2 changed files with 56 additions and 33 deletions

View File

@ -1,8 +1,10 @@
include <supports.scad>;
include <plate.scad>;
use <supports.scad>;
use <plate.scad>;
for(x=[0:3]) {
for(y=[0:1])
translate([60*x,60*y,0])
plate4x4(thickness=4);
}
}
box();

View File

@ -24,9 +24,46 @@ 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
hole_size = 4; // size of the holes in which the top plate pegs sit
hole_depth = 15; // depth of the holes in which the top plate pegs sit
// 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");
}
}
}
}
}
// translate everything down relative to the PCB reference
translate([0,0,-support_depth-pcb_thickness]) {
// create basic grid of support units
box();
}
// a support unit is the individual box underneath one trellis PCB. no cutouts are included in the module as these differ depending on position.
// if outer is true, an extra tolerance is added
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]);
}
}
}
// the whole box. Made into a module for importing into an assembly later, maybe?
module box() {
// create basic grid of support units
difference() {
union() {
// create large outer box
@ -98,35 +135,19 @@ translate([0,0,-support_depth-pcb_thickness]) {
]) {
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.
// if outer is true, an extra tolerance is added
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]);
}
// mounting holes for plate
translate([-tolerance-wall_width/2,-tolerance-wall_width/2,wall_height+support_depth-hole_depth/2]){
cube([hole_size,hole_size,hole_depth+0.01], center=true);
}
translate([tolerance+wall_width/2+(pcbs_long*pcb_size),-tolerance-wall_width/2,wall_height+support_depth-hole_depth/2]){
cube([hole_size,hole_size,hole_depth+0.01], center=true);
}
translate([tolerance+wall_width/2+(pcbs_long*pcb_size),tolerance+wall_width/2+(pcbs_wide*pcb_size),wall_height+support_depth-hole_depth/2]){
cube([hole_size,hole_size,hole_depth+0.01], center=true);
}
translate([-tolerance-wall_width/2,tolerance+wall_width/2+(pcbs_wide*pcb_size),wall_height+support_depth-hole_depth/2]){
cube([hole_size,hole_size,hole_depth+0.01], center=true);
}
}
}