Delete the unused openscad design
This commit is contained in:
parent
1c85769c5d
commit
ab5d91f1da
6 changed files with 0 additions and 198 deletions
2
openscad/.gitignore
vendored
2
openscad/.gitignore
vendored
|
@ -1,2 +0,0 @@
|
|||
*.stl
|
||||
pcb_dimensions.scad
|
|
@ -1,12 +0,0 @@
|
|||
.PHONY: all clean
|
||||
|
||||
all: case.stl mounting_bracket.stl
|
||||
|
||||
pcb_dimensions.scad: generate.py ../kicad/Digital\ Audio\ Switch.kicad_pcb
|
||||
python3 $< > $@
|
||||
|
||||
%.stl: case.scad pcb_dimensions.scad
|
||||
openscad -o $@ -D MODE=\"$(basename $@)\" $<
|
||||
|
||||
clean:
|
||||
rm -f case.stl pcb_dimensions.scad
|
|
@ -1,66 +0,0 @@
|
|||
$fn = 50;
|
||||
|
||||
include <pcb_mount.scad>;
|
||||
|
||||
MODE = "all"; // ["all", mounting_bracket", "case"]
|
||||
TOLERANCE=0.5;
|
||||
|
||||
wall_width = 3;
|
||||
side_padding = 10;
|
||||
case_width = pcb_width + (wall_width * 2) + (TOLERANCE * 2) + (side_padding * 2);
|
||||
case_depth = pcb_height + (wall_width * 2) + (TOLERANCE * 2);
|
||||
bottom_height = 30;
|
||||
pcb_spacing = 10;
|
||||
pcb_thickness = 1.6;
|
||||
|
||||
inside_offset = [wall_width + TOLERANCE + side_padding,wall_width + TOLERANCE,wall_width];
|
||||
|
||||
module rounded_box(box, r) {
|
||||
hull() {
|
||||
cylinder(r=r,h=box.z);
|
||||
translate([0,box.y])
|
||||
cylinder(r=r,h=box.z);
|
||||
translate([box.x,0])
|
||||
cylinder(r=r,h=box.z);
|
||||
translate([box.x, box.y])
|
||||
cylinder(r=r,h=box.z);
|
||||
}
|
||||
}
|
||||
|
||||
module case() {
|
||||
difference() {
|
||||
rounded_box(box=[case_width, case_depth, bottom_height], r=wall_width);
|
||||
translate([wall_width,wall_width,wall_width + 1])
|
||||
rounded_box(box=[pcb_width + (TOLERANCE * 2) + (side_padding * 2),
|
||||
pcb_height + (TOLERANCE * 2),
|
||||
bottom_height],
|
||||
r=wall_width);
|
||||
translate(inside_offset - [0,0,wall_width + 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,60 +0,0 @@
|
|||
import sexpdata as s
|
||||
|
||||
TOLERANCE = 0.2
|
||||
|
||||
|
||||
def cadr(x):
|
||||
return s.car(s.cdr(x))
|
||||
|
||||
|
||||
def cddr(x):
|
||||
return s.cdr(s.cdr(x))
|
||||
|
||||
|
||||
with open("../kicad/Digital Audio Switch.kicad_pcb", "r") as f:
|
||||
kicad_pcb = s.load(f)
|
||||
|
||||
|
||||
# Assumes the board is cut out with a single rectangle
|
||||
[rect] = [
|
||||
s.cdr(x)
|
||||
for x in kicad_pcb
|
||||
if s.car(x) == s.Symbol("gr_rect") and [s.Symbol("layer"), "Edge.Cuts"] in s.cdr(x)
|
||||
]
|
||||
[[start_x, start_y]] = [s.cdr(x) for x in rect if s.car(x) == s.Symbol("start")]
|
||||
[[end_x, end_y]] = [s.cdr(x) for x in rect if s.car(x) == s.Symbol("end")]
|
||||
[start_x, start_y, end_x, end_y] = [
|
||||
min(start_x, end_x),
|
||||
min(start_y, end_y),
|
||||
max(start_x, end_x),
|
||||
max(start_y, end_y),
|
||||
]
|
||||
width = end_x - start_x
|
||||
height = end_y - start_y
|
||||
print(
|
||||
f"""
|
||||
pcb_width = {width};
|
||||
pcb_height = {height};
|
||||
""".strip()
|
||||
)
|
||||
|
||||
footprints = [
|
||||
s.cdr(x)
|
||||
for x in kicad_pcb
|
||||
if s.car(x) == s.Symbol("footprint") and s.car(s.cdr(x)).startswith("MountingHole:")
|
||||
]
|
||||
|
||||
holes = []
|
||||
for hole in footprints:
|
||||
[[hole_x, hole_y]] = [s.cdr(x) for x in hole if s.car(x) == s.Symbol("at")]
|
||||
pads = [cddr(x) for x in hole if s.car(x) == s.Symbol("pad")]
|
||||
for pad in pads:
|
||||
[[pad_x, pad_y]] = [s.cdr(x) for x in pad if s.car(x) == s.Symbol("at")]
|
||||
drills = [cadr(x) for x in pad if s.car(x) == s.Symbol("drill")]
|
||||
for diameter in drills:
|
||||
pos_x = (hole_x + pad_x) - start_x
|
||||
pos_y = (hole_y + pad_y) - start_y
|
||||
holes.append([pos_x, pos_y, diameter])
|
||||
|
||||
# Y coordinates are inverted between KiCad and OpenSCAD
|
||||
print(f"drill_holes = {[[[x, -y + height], r] for x, y, r in holes]};")
|
|
@ -1,57 +0,0 @@
|
|||
include <pcb_dimensions.scad>;
|
||||
|
||||
TOLERANCE=0.2;
|
||||
|
||||
h=10;
|
||||
w=3;
|
||||
|
||||
module pcb_mount(w=w,h=h) {
|
||||
difference() {
|
||||
union() {
|
||||
posts(w=w,h=h);
|
||||
frame(w=w);
|
||||
}
|
||||
drill_hole_cutouts(h=h);
|
||||
}
|
||||
}
|
||||
|
||||
module drill_hole_cutouts(h=h) {
|
||||
for (hole=drill_holes) {
|
||||
pos = hole[0];
|
||||
diameter = hole[1] + TOLERANCE;
|
||||
translate([pos.x, pos.y, -0.5]) {
|
||||
cylinder(d=diameter,h=h + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module posts(w=w,h=h) {
|
||||
// Posts
|
||||
for (hole=drill_holes) {
|
||||
pos = hole[0];
|
||||
diameter = hole[1] + TOLERANCE;
|
||||
translate(pos) {
|
||||
difference() {
|
||||
cylinder(d=diameter + (w * 2), h=h);
|
||||
translate([0,0,-0.5])
|
||||
cylinder(d=diameter,h=h + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module frame(w=w) {
|
||||
min_x = min([for (hole=drill_holes) hole[0].x]);
|
||||
min_y = min([for (hole=drill_holes) hole[0].y]);
|
||||
max_x = max([for (hole=drill_holes) hole[0].x]);
|
||||
max_y = max([for (hole=drill_holes) hole[0].y]);
|
||||
max_diameter = max([for (hole=drill_holes) hole[1]]);
|
||||
|
||||
translate([min_x - (w / 2), min_y - (w / 2)]) {
|
||||
difference() {
|
||||
cube([max_x - min_x + w, max_y - min_y + w, w]);
|
||||
translate([w, w, -0.5])
|
||||
cube([max_x - min_x - w, max_y - min_y - w, w + 1]);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
sexpdata
|
Loading…
Reference in a new issue