76 lines
2.3 KiB
OpenSCAD
76 lines
2.3 KiB
OpenSCAD
|
// unit: mm
|
||
|
// cannot be used standalone
|
||
|
// create a new .scad file, defined the following variables and include this file:
|
||
|
|
||
|
/*
|
||
|
pcb_width=85;
|
||
|
pcb_length=36;
|
||
|
pcb_hole_left=2.5;
|
||
|
pcb_hole_top=2.5;
|
||
|
plate_pcb_left=6;
|
||
|
plate_pcb_top=6;
|
||
|
plate_height=3;
|
||
|
standoff_height=30;
|
||
|
standoff_hole=2.5;
|
||
|
standoff_wall=1.5;
|
||
|
mounting_hole_left=25;
|
||
|
mounting_hole_top=10;
|
||
|
mounting_hole_dia=3;
|
||
|
mounting_hole_depth=1.5;
|
||
|
mounting_hole_angle=45;
|
||
|
*/
|
||
|
|
||
|
epsilon=.1;
|
||
|
|
||
|
standoff_radius=standoff_hole/2+standoff_wall;
|
||
|
standoff_hole_radius=standoff_hole/2;
|
||
|
plate_width=pcb_width+2*plate_pcb_left;
|
||
|
plate_length=pcb_length+2*plate_pcb_top;
|
||
|
standoff_xpos=pcb_width/2-pcb_hole_left;
|
||
|
standoff_ypos=pcb_length/2-pcb_hole_top;
|
||
|
mounting_hole_xpos=plate_width/2-mounting_hole_left;
|
||
|
mounting_hole_ypos=plate_length/2-mounting_hole_top;
|
||
|
mounting_hole_offset=tan(mounting_hole_angle)*mounting_hole_dia/2;
|
||
|
mounting_hole_aperture=tan(mounting_hole_angle)*(plate_height-mounting_hole_depth+mounting_hole_offset);
|
||
|
mounting_hole_radius=mounting_hole_dia/2;
|
||
|
|
||
|
echo(str(
|
||
|
"standoff_radius: ", standoff_radius, "\n",
|
||
|
"standoff_hole_radius: ", standoff_hole_radius, "\n",
|
||
|
"plate_width: ", plate_width, "\n",
|
||
|
"plate_length: ", plate_length, "\n",
|
||
|
"standoff_xpos: ", standoff_xpos, "\n",
|
||
|
"standoff_ypos: ", standoff_ypos, "\n",
|
||
|
"mounting_hole_xpos: ", mounting_hole_xpos, "\n",
|
||
|
"mounting_hole_ypos: ", mounting_hole_ypos, "\n",
|
||
|
"mounting_hole_offset: ", mounting_hole_offset, "\n",
|
||
|
"mounting_hole_aperture: ", mounting_hole_aperture, "\n",
|
||
|
"mounting_hole_radius: ", mounting_hole_radius
|
||
|
));
|
||
|
|
||
|
union() {
|
||
|
for (x = [-1, 1], y = [-1, 1]) {
|
||
|
translate([standoff_xpos*x, standoff_ypos*y, plate_height]) {
|
||
|
difference() {
|
||
|
cylinder(standoff_height, standoff_radius, standoff_radius);
|
||
|
translate([0,0,-epsilon]) {
|
||
|
cylinder(standoff_height+2*epsilon, standoff_hole_radius, standoff_hole_radius);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
difference() {
|
||
|
translate([-plate_width/2,-plate_length/2,0]) {
|
||
|
cube([plate_width,plate_length,plate_height]);
|
||
|
}
|
||
|
for (xy = [-1, 1]) {
|
||
|
translate([mounting_hole_xpos*xy, mounting_hole_ypos*xy, -epsilon]) {
|
||
|
cylinder(plate_height+epsilon, mounting_hole_radius, mounting_hole_radius);
|
||
|
}
|
||
|
translate([mounting_hole_xpos*xy, mounting_hole_ypos*xy, mounting_hole_depth]) {
|
||
|
cylinder(plate_height-mounting_hole_depth+epsilon, mounting_hole_radius, mounting_hole_aperture);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|