Much improvement case build process

This commit is contained in:
William Toohey
2017-10-06 15:43:08 +10:00
parent 94a111d499
commit c4cea45b40
17 changed files with 9325 additions and 232681 deletions
File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 7.7 MiB

-3
View File
@@ -1,3 +0,0 @@
use <case.scad>;
bottom_plate_outline();
-6
View File
@@ -1,6 +0,0 @@
use <case.scad>;
difference() {
bottom_ring_outline();
mcu_hole();
}
+99
View File
@@ -0,0 +1,99 @@
use <case.scad>;
$fn=128;
// to easily automate exports
produce = 0;
if(produce == 0)
render();
else if(produce == 1)
bottom_padding();
else if(produce == 2)
mainCuts();
else if(produce == 3)
padding();
knobOffset = 74;
knobY = -83;
main_thickness = 37.5;
bottom_thickness = 5;
padding_thickness = 12;
encoders = [[-64,0.4],
[ 64,0.4]];
encoderShaftHole = 5.5;
finger = 20;
fingerX = -75;
fingerY = -25;
squeeze = 0; // so things are held tight
gap = 1; // for the top cover
size = [180, 140];
module mainCuts() {
difference() {
translate([0,-30])
square(size, center = true);
offset(delta = -squeeze)
board();
translate([-knobOffset, knobY])
circle(d = 25 - squeeze);
translate([knobOffset,knobY])
circle(d = 25 - squeeze);
translate([0, 15])
square([80, 3], center = true);
translate([0, 28])
square([100, 13], center = true);
translate([fingerX,fingerY])
circle(d=finger);
translate([-fingerX,fingerY])
circle(d=finger);
}
}
module padding() {
difference() {
offset(delta = -gap)
board();
for(e = encoders) {
translate(e)
circle(d=encoderShaftHole);
}
}
}
module bottom_padding() {
square(size, center = true);
}
module render() {
full_stack(false);
color([0.3,0.3,0.3,0.9])
linear_extrude(main_thickness)
mainCuts();
color([0.3,0.3,0.3,0.9])
// extra 1 for visualisation purposes
translate([0,-30,-bottom_thickness-1])
linear_extrude(bottom_thickness)
bottom_padding();
color([0.3,0.3,0.3,0.9])
translate([0, 0, 25.5])
linear_extrude(padding_thickness)
padding();
translate([-knobOffset, knobY])
encoder_knob();
translate([knobOffset,knobY])
encoder_knob();
}
-7
View File
@@ -1,7 +0,0 @@
@echo off
SET scad="C:\Program Files\OpenSCAD\openscad.exe"
SET folder=outputs
for %%i in (bottom_plate,bottom_ring,top_plate,top_plate_holes,top_plate_outline,top_ring,holes_internal,holes_surface) DO (
%scad% -o "%folder%\%%i.dxf" "%%i.scad"
)
+9
View File
@@ -0,0 +1,9 @@
@echo off
SET scad="C:\Program Files\OpenSCAD\openscad.exe"
SET folder=outputs
@echo on
%scad% -o "%folder%\layer0_5mm_box_bottom.dxf" "box.scad" -D produce=1
%scad% -o "%folder%\layer1_37.5mm_box_middle.dxf" "box.scad" -D produce=2
%scad% -o "%folder%\layer1.5_12mm_box_insert.dxf" "box.scad" -D produce=3
pause
+17
View File
@@ -0,0 +1,17 @@
@echo off
SET scad="C:\Program Files\OpenSCAD\openscad.exe"
SET folder=outputs
REM fiducials are for stacking layers - my software centers the piece,
REM which results in imperfect alignment. Delete them afterwards
REM set to 0 if your software can handle coords properly
SET fiducials=1
for %%i in (bottom_plate,bottom_spacer,top_spacer,top_spacer_engrave,top_plate,top_plate_engrave) DO (
@echo on
%scad% -o "%folder%\%%i.dxf" "case.scad" -D enable_fiducials=%fiducials% -D "build=\"%%i\""
)
%scad% -o "%folder%\render.png" "case.scad" -D "build=\"render\"" --imgsize=1920,1080 --camera=-9.47,-33.79,17.17,40.30,0.00,313.60,400 --projection=p
REM pause
+94 -17
View File
@@ -17,7 +17,8 @@ bolts = [[30.025, 6.65],
[71, 16.5],
[42.732, -82.791],
// Middle hole, remove if not needed
[0, -37.592]];
//[0, -37.592]
];
// Not the encoders themselves, but the circle that surrounds them
encoders = [[-64,0.4],
[ 64,0.4]];
@@ -25,11 +26,11 @@ encoderRadius = 13;
// encoder solder points hit the case unless we cut these out
// x, y, hole size
encoderHoles = [[-8, 0, 3],
[ 8, 0, 3]];
encoderHoles = [[-8, 0, 4],
[ 8, 0, 4]];
// the 3 A/B/Gnd connections + room for their decoupling caps
// x (mirrored), y, hole size
encoderHull = [5, -11, 5];
encoderHull = [5, -11.2, 5];
// x, y, rotation
leds = [[-26.475, -13.625, 35],
@@ -181,19 +182,37 @@ module encoder_holes() {
}
}
module encoder_model() {
module encoder_knob() {
color([0.7,0.7,0.7])
cylinder(20, d = 25);
}
module encoder_model(knob = true) {
translate([0,0,5.5])
rotate([90,0,0])
import("imports/PEC16.stl");
translate([0,0,13])
cylinder(20, d = 25);
// Shaft
encoderShaft = 6;
encoderFlat = 4.5;
translate([0,0,6.5])
linear_extrude(20)
intersection() {
circle(d = encoderShaft);
translate([0, (encoderShaft-encoderFlat)/2])
square([encoderShaft, encoderFlat], center = true);
}
if(knob) {
translate([0,0,13.5])
encoder_knob();
}
}
module encoder_model_full() {
module encoder_model_full(knob = true) {
for(enc = encoders) {
translate([enc[0], enc[1]])
encoder_model();
encoder_model(knob);
}
}
@@ -295,6 +314,22 @@ module top_ring_outline() {
board_encoderhole();
}
// go in intervals of 2 to avoid final implicit union()
// start at 0.3 because laser kerf
module top_ring_engrave() {
engraveInterval = 0.05;
wallOverlap = 1;
for(i = [0.3:engraveInterval*2:wallOverlap+engraveInterval]) {
difference() {
offset(delta=-i)
top_ring_outline();
offset(delta=-(i+engraveInterval))
top_ring_outline();
}
}
}
module top_ring() {
difference() {
top_ring_outline();
@@ -329,9 +364,9 @@ module mcu_hole() {
polygon([[-13.3, 3.9],
[-13.3, -8],
[-20.15, -17],
[-33.65, -17],
[-40.5, -8],
[-40.5, 3.9]]);
[-28.65, -17],
[-35.5, -8],
[-35.5, 3.9]]);
}
module bottom_ring() {
@@ -367,7 +402,7 @@ module art_trimmed() {
}
// This is kinda disgusting
module full_stack() {
module full_stack(knobs = true) {
// quadratic ease out
t = $t -1;
boom = -explodeFactor * (t*t*t*t - 1);
@@ -376,7 +411,7 @@ module full_stack() {
linear_extrude(plate_thickness[0])
bottom_plate();
translate([0, 0, plate_thickness[0] + boom]) {
color([1, 1, 1, 0.4])
color([0.8, 0.8, 0.8, 0.4])
linear_extrude(plate_thickness[1])
bottom_ring();
translate([0, 0, plate_thickness[1] + boom]) {
@@ -392,7 +427,7 @@ module full_stack() {
// pretty models of stuff
translate([0, 0, boom*2]) {
color([0.8,0.8,0.8,1])
encoder_model_full();
encoder_model_full(knobs);
switch_models();
switch_keycaps();
@@ -421,13 +456,55 @@ module full_stack() {
}
//board();
full_stack();
fiducialPoints = [
[-80, -100],
[80, -100],
[-80, 50],
[80, 50]
];
module fiducials() {
for(f = fiducialPoints) {
translate(f)
square(5, center=true);
}
}
// override in commandline
build = "render";
enable_fiducials = 0;
if(build == "render") {
full_stack();
} else if(build == "bottom_plate") {
bottom_plate();
} else if(build == "bottom_spacer") {
bottom_ring();
} else if(build == "top_spacer") {
if(enable_fiducials)
fiducials();
top_ring();
} else if(build == "top_spacer_engrave") {
if(enable_fiducials)
fiducials();
top_ring_engrave();
} else if(build == "top_plate") {
if(enable_fiducials)
fiducials();
top_plate();
} else if(build == "top_plate_engrave") {
if(enable_fiducials)
fiducials();
art_trimmed();
}
// for inspecting individual plates
//linear_extrude(plate_thickness[0])
// bottom_plate();
//linear_extrude(plate_thickness[1])
// bottom_ring();
//linear_extrude(plate_thickness[3])
// top_ring();
//translate([0,0,plate_thickness[3]])
//linear_extrude(1)
// top_ring_engrave();
//linear_extrude(plate_thickness[4])
// top_plate();
-3
View File
@@ -1,3 +0,0 @@
use <case.scad>;
bolt_spacers();
-3
View File
@@ -1,3 +0,0 @@
use <case.scad>;
bolts();
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
-3
View File
@@ -1,3 +0,0 @@
use <case.scad>;
top_plate();
-3
View File
@@ -1,3 +0,0 @@
use <case.scad>;
top_plate_holes();
-3
View File
@@ -1,3 +0,0 @@
use <case.scad>;
top_plate_outline();
-3
View File
@@ -1,3 +0,0 @@
use <case.scad>;
top_ring_outline();