mirror of
https://github.com/correl/digitalaudioswitch.git
synced 2024-12-04 19:09:59 +00:00
Add multiple export options to the case design
This commit is contained in:
parent
986c9f00d2
commit
f84cf9727c
2 changed files with 39 additions and 25 deletions
|
@ -1,12 +1,12 @@
|
||||||
.PHONY: all clean
|
.PHONY: all clean
|
||||||
|
|
||||||
all: case.stl
|
all: case.stl mounting_bracket.stl
|
||||||
|
|
||||||
pcb_dimensions.scad: generate.py ../kicad/Digital\ Audio\ Switch.kicad_pcb
|
pcb_dimensions.scad: generate.py ../kicad/Digital\ Audio\ Switch.kicad_pcb
|
||||||
python3 $< > $@
|
python3 $< > $@
|
||||||
|
|
||||||
case.stl: case.scad pcb_dimensions.scad
|
%.stl: case.scad pcb_dimensions.scad
|
||||||
openscad -o $@ case.scad
|
openscad -o $@ -D MODE=\"$(basename $@)\" $<
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f case.stl pcb_dimensions.scad
|
rm -f case.stl pcb_dimensions.scad
|
||||||
|
|
|
@ -2,6 +2,7 @@ $fn = 50;
|
||||||
|
|
||||||
include <pcb_mount.scad>;
|
include <pcb_mount.scad>;
|
||||||
|
|
||||||
|
MODE = "all"; // ["all", mounting_bracket", "case"]
|
||||||
TOLERANCE=0.5;
|
TOLERANCE=0.5;
|
||||||
|
|
||||||
wall_width = 3;
|
wall_width = 3;
|
||||||
|
@ -14,18 +15,6 @@ pcb_thickness = 1.6;
|
||||||
|
|
||||||
inside_offset = [wall_width + TOLERANCE + side_padding,wall_width + TOLERANCE,wall_width];
|
inside_offset = [wall_width + TOLERANCE + side_padding,wall_width + TOLERANCE,wall_width];
|
||||||
|
|
||||||
color("purple")
|
|
||||||
translate(inside_offset)
|
|
||||||
pcb_mount(w=wall_width,h=pcb_spacing);
|
|
||||||
|
|
||||||
color("green", 0.5)
|
|
||||||
translate(inside_offset + [0,0,pcb_spacing]) {
|
|
||||||
difference() {
|
|
||||||
cube([pcb_width, pcb_height, pcb_thickness]);
|
|
||||||
translate([0,0,-0.5])
|
|
||||||
drill_hole_cutouts(h=pcb_thickness + 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
module rounded_box(box, r) {
|
module rounded_box(box, r) {
|
||||||
hull() {
|
hull() {
|
||||||
cylinder(r=r,h=box.z);
|
cylinder(r=r,h=box.z);
|
||||||
|
@ -38,15 +27,40 @@ module rounded_box(box, r) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
difference() {
|
module case() {
|
||||||
rounded_box(box=[case_width, case_depth, bottom_height], r=wall_width);
|
difference() {
|
||||||
translate([wall_width,wall_width,wall_width + 1])
|
rounded_box(box=[case_width, case_depth, bottom_height], r=wall_width);
|
||||||
rounded_box(box=[pcb_width + (TOLERANCE * 2) + (side_padding * 2),
|
translate([wall_width,wall_width,wall_width + 1])
|
||||||
pcb_height + (TOLERANCE * 2),
|
rounded_box(box=[pcb_width + (TOLERANCE * 2) + (side_padding * 2),
|
||||||
bottom_height],
|
pcb_height + (TOLERANCE * 2),
|
||||||
r=wall_width);
|
bottom_height],
|
||||||
translate(inside_offset - [0,0,wall_width + 0.5]) {
|
r=wall_width);
|
||||||
drill_hole_cutouts(h=pcb_spacing);
|
translate(inside_offset - [0,0,wall_width + 0.5]) {
|
||||||
posts(w=wall_width, h=wall_width/2 + 0.5);
|
drill_hole_cutouts(h=pcb_spacing);
|
||||||
|
posts(w=wall_width, h=wall_width/2 + 0.5);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (MODE == "mounting_bracket") {
|
||||||
|
color("purple")
|
||||||
|
translate(inside_offset)
|
||||||
|
pcb_mount(w=wall_width,h=pcb_spacing);
|
||||||
|
} else if (MODE == "case" || MODE == "all") {
|
||||||
|
case();
|
||||||
|
if (MODE == "all") {
|
||||||
|
color("purple")
|
||||||
|
translate(inside_offset)
|
||||||
|
pcb_mount(w=wall_width,h=pcb_spacing);
|
||||||
|
|
||||||
|
color("green", 0.5)
|
||||||
|
translate(inside_offset + [0,0,pcb_spacing]) {
|
||||||
|
difference() {
|
||||||
|
cube([pcb_width, pcb_height, pcb_thickness]);
|
||||||
|
translate([0,0,-0.5])
|
||||||
|
drill_hole_cutouts(h=pcb_thickness + 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue