maybe fix tolerances idk

This commit is contained in:
Nico 2021-07-21 22:13:05 +01:00
parent c264b54a84
commit 9e7412dcb2
3 changed files with 67 additions and 45 deletions

View File

@ -1,6 +1,9 @@
use <supports.scad>;
use <plate.scad>;
// TODO make supports and plate file match
// TODO update tolerances to match supports.scad
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.
@ -12,7 +15,7 @@ pcbs_wide = 2;
wall_width = 5; // width of walls above the top of the supports
support_depth=10; // depth of support structure wall
tolerance = 0.4;
tolerance = 4; // TODO update to reflect supports.scad so cuts work properly
wall_height = (pcb_depth-connector_depth)+4; // height of walls above the top of the supports
@ -30,7 +33,7 @@ rotate([180,0,0]) {
intersection() {
translate([-wall_width-tolerance,-wall_width-tolerance,0])
cube([wall_width+tolerance+(pcb_size/4),wall_width+tolerance+(pcb_size/4),50]);
cube([wall_width+tolerance+pcb_size*2,(wall_width+tolerance)*2+pcb_size*2,50]);
union() {
box();
translate([0,0,wall_height+support_depth]) {

View File

@ -2,6 +2,8 @@
// the file is designed to be parametric, for easier testing.
// first, we declare some parameters, that will be useful to tweak while testing the model:
// TODO apply correct tolerances in the correct places
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.
@ -28,7 +30,11 @@ button_size = 10;
// Spacing between buttons (in mm)
spacing = 5;
// Tolerance for button holes (how much larger they are than a button)
tolerance = 0.4;
button_tolerance = 1;
// Tolerance for pegs (how much smaller they are than the holes)
peg_tolerance = 0.4;
// PCB tolerance (tolerance for the size of the PCB)
pcb_tolerance = 4;
// outer spacing - spacing between the edge of the silicon part and the buttons
outer_spacing = 2.5;
@ -37,10 +43,10 @@ plate_thickness = 4;
// module for the entire plate
module plate() {
difference() {
translate([-(wall_width+tolerance),-(wall_width+tolerance)]) {
translate([-(wall_width+pcb_tolerance),-(wall_width+pcb_tolerance)]) {
cube(
[pcb_size*pcbs_long+(wall_width+tolerance)*2,
pcb_size*pcbs_wide+(wall_width+tolerance)*2,
[pcb_size*pcbs_long+(wall_width+pcb_tolerance)*2,
pcb_size*pcbs_wide+(wall_width+pcb_tolerance)*2,
plate_thickness]);
}
for(x=[0:pcbs_long-1]){
@ -50,29 +56,42 @@ module plate() {
}
}
}
// mounting pegs
translate([-wall_width/2,-wall_width/2,-plate_thickness]){
cube([hole_size-tolerance,hole_size-tolerance,hole_depth], center=true);
// mounting holes for plate
translate(
[-wall_width/2-pcb_tolerance/2,
-wall_width/2-pcb_tolerance/2,
-plate_thickness]){
cube([hole_size-peg_tolerance,hole_size-peg_tolerance,hole_depth], center=true);
}
translate([wall_width/2+(pcbs_long*pcb_size),-wall_width/2,-plate_thickness]){
cube([hole_size-tolerance,hole_size-tolerance,hole_depth], center=true);
translate(
[wall_width/2+(pcbs_long*pcb_size)+pcb_tolerance/2,
-wall_width/2-pcb_tolerance/2,
-plate_thickness]){
cube([hole_size-peg_tolerance,hole_size-peg_tolerance,hole_depth], center=true);
}
translate([wall_width/2+(pcbs_long*pcb_size),wall_width/2+(pcbs_wide*pcb_size),-plate_thickness]){
cube([hole_size-tolerance,hole_size-tolerance,hole_depth], center=true);
translate(
[wall_width/2+(pcbs_long*pcb_size)+pcb_tolerance/2,
wall_width/2+(pcbs_wide*pcb_size)+pcb_tolerance/2,
-plate_thickness]){
cube([hole_size-peg_tolerance,hole_size-peg_tolerance,hole_depth], center=true);
}
translate([-wall_width/2,wall_width/2+(pcbs_wide*pcb_size),-plate_thickness]){
cube([hole_size-tolerance,hole_size-tolerance,hole_depth], center=true);
translate(
[-wall_width/2-pcb_tolerance/2,
wall_width/2+(pcbs_wide*pcb_size)+pcb_tolerance/2,
-plate_thickness]){
cube([hole_size-peg_tolerance,hole_size-peg_tolerance,hole_depth], center=true);
}
}
// module for the holes in a 4x4 unit of the top plate.
// TODO rewrite this using center()?
module plate4x4(thickness) {
for(x=[0:3]) {
for(y=[0:3]) {
translate(
[outer_spacing-(tolerance/2)+((button_size+spacing)*x),
outer_spacing-(tolerance/2)+((button_size+spacing)*y),
[outer_spacing-(button_tolerance/2)+((button_size+spacing)*x),
outer_spacing-(button_tolerance/2)+((button_size+spacing)*y),
-0.5])
cube([button_size+tolerance,button_size+tolerance,thickness+1]);
cube([button_size+button_tolerance,button_size+button_tolerance,thickness+1]);
}
}
}

View File

@ -1,6 +1,5 @@
// this SCAD file defines the support structures for the neotrellis grid. (potentially also bottom case)
// TODO add holes for pegs in corners
// TODO test prints
// TODO fix mounting hole positions
pcb_size = 60; // the PCB is 60x60mm square
@ -13,7 +12,8 @@ support_depth=10; // depth of support structure wall
floor_depth = 1; // depth of the bottom floor of the support
tolerance = 0.4;
tolerance = 0.4; // general tolerance
pcb_tolerance = 4; // tolerance for the size of the PCB
wall_height = (pcb_depth-connector_depth)+4; // height of walls above the top of the supports
wall_width = 5; // width of walls above the top of the supports
@ -67,18 +67,18 @@ module box() {
difference() {
union() {
// create large outer box
translate([-(wall_width+tolerance),-(wall_width+tolerance)]) {
translate([-(wall_width+pcb_tolerance),-(wall_width+pcb_tolerance)]) {
difference() {
// outer cube
cube(
[pcb_size*pcbs_long+(wall_width+tolerance)*2,
pcb_size*pcbs_wide+(wall_width+tolerance)*2,
[pcb_size*pcbs_long+(wall_width+pcb_tolerance)*2,
pcb_size*pcbs_wide+(wall_width+pcb_tolerance)*2,
support_depth+wall_height]);
// cutout to make it into a box
translate([wall_width+tolerance/2,wall_width+tolerance/2]) {
translate([wall_width+pcb_tolerance/2,wall_width+pcb_tolerance/2]) {
cube(
[pcb_size*pcbs_long+tolerance,
pcb_size*pcbs_wide+tolerance,
[pcb_size*pcbs_long+pcb_tolerance,
pcb_size*pcbs_wide+pcb_tolerance,
support_depth+wall_height+0.1]);
}
}
@ -96,16 +96,16 @@ module box() {
// there is likely a better way to do this, but I don't know it.
// this is a bodge so I can move onto the next thing and hey,
// it hopefully works well enough.
translate([-tolerance,0,0]) {
translate([-pcb_tolerance,0,0]) {
// widthwise
cube([tolerance+1,pcbs_wide*pcb_size, support_depth]);
translate([pcbs_long*pcb_size+tolerance,0,0])
cube([tolerance+1, pcbs_wide*pcb_size+tolerance, support_depth]);
cube([pcb_tolerance+1,pcbs_wide*pcb_size, support_depth]);
translate([pcbs_long*pcb_size+pcb_tolerance,0,0])
cube([pcb_tolerance+1, pcbs_wide*pcb_size+pcb_tolerance, support_depth]);
// lengthwise
translate([0,-tolerance,0])
cube([pcbs_long*pcb_size+tolerance*2, tolerance+1, support_depth]);
translate([0,pcbs_wide*pcb_size-tolerance,0])
cube([pcbs_long*pcb_size+tolerance*2, tolerance+1, support_depth]);
translate([0,-pcb_tolerance,0])
cube([pcbs_long*pcb_size+pcb_tolerance*2, pcb_tolerance+1, support_depth]);
translate([0,(pcbs_wide*pcb_size),0])
cube([pcbs_long*pcb_size+pcb_tolerance*2, pcb_tolerance+1, support_depth]);
}
}
}
@ -129,34 +129,34 @@ module box() {
}
// add cutout for USB port
translate(
[pcb_size*(pcbs_long-1)+wall_width+1,
[pcb_size*(pcbs_long-1)+wall_width+1+pcb_tolerance,
pcb_size/2-cutout_width/2+pcb_size,
support_depth-cutout_depth
]) {
cube([pcb_size, cutout_width, cutout_depth+1]);
cube([pcb_size, cutout_width, wall_width+pcb_tolerance]);
}
// mounting holes for plate
translate(
[-wall_width/2,
-wall_width/2,
[-wall_width/2-pcb_tolerance/2,
-wall_width/2-pcb_tolerance/2,
wall_height+support_depth-hole_depth/2]){
cube([hole_size,hole_size,hole_depth+0.01], center=true);
}
translate(
[wall_width/2+(pcbs_long*pcb_size),
-wall_width/2,
[wall_width/2+(pcbs_long*pcb_size)+pcb_tolerance/2,
-wall_width/2-pcb_tolerance/2,
wall_height+support_depth-hole_depth/2]){
cube([hole_size,hole_size,hole_depth+0.01], center=true);
}
translate(
[wall_width/2+(pcbs_long*pcb_size),
wall_width/2+(pcbs_wide*pcb_size),
[wall_width/2+(pcbs_long*pcb_size)+pcb_tolerance/2,
wall_width/2+(pcbs_wide*pcb_size)+pcb_tolerance/2,
wall_height+support_depth-hole_depth/2]){
cube([hole_size,hole_size,hole_depth+0.01], center=true);
}
translate(
[-wall_width/2,
wall_width/2+(pcbs_wide*pcb_size),
[-wall_width/2-pcb_tolerance/2,
wall_width/2+(pcbs_wide*pcb_size)+pcb_tolerance/2,
wall_height+support_depth-hole_depth/2]){
cube([hole_size,hole_size,hole_depth+0.01], center=true);
}