-
Notifications
You must be signed in to change notification settings - Fork 0
/
eurorack.scad
83 lines (75 loc) · 2.77 KB
/
eurorack.scad
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
// Copyright (c) 2019 Damien Miller
//
// Permission to use, copy, modify, and distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
// Parametric model for Eurorack front panels.
$fn=60;
// Generates cylinders at each corner of a cuboid for rounding via CSG.
module corner_rounds(x, y, z, r) {
translate([r, r, 0]) cylinder(h=z, r=r, center=false);
translate([x-r, r, 0]) cylinder(h=z, r=r, center=false);
translate([r, y-r, 0]) cylinder(h=z, r=r, center=false);
translate([x-r, y-r, 0]) cylinder(h=z, r=r, center=false);
}
// Generates a triangular prism at the origin of the specified dimensions.
module triprism(l, w, h) {
points = [
[ 0, 0, 0 ], [ l, 0, 0 ], [ l, w, 0 ],
[ 0, 0, h ], [ l, 0, h ], [ l, w, h ],
];
faces = [
[ 0, 1, 2 ], // bottom
[ 0, 3, 4, 1], // front
[ 1, 4, 5, 2 ], // right
[ 2, 5, 3, 0 ], // left
[ 5, 4, 3 ], // top
];
polyhedron(points, faces, convexity=2);
}
// Generates triangular prism at the corners of a cuboid. Used to cut the
// square corners off so they can be replaced with corner_rounds()
module corner_cuts(x, y, z, r) {
translate([0, r, 0]) rotate([0, 0, 270]) triprism(r, r, z);
translate([r, y, 0]) rotate([0, 0, 180]) triprism(r, r, z);
translate([x, y-r, 0]) rotate([0, 0, 90]) triprism(r, r, z);
translate([x-r, 0, 0]) rotate([0, 0, 0]) triprism(r, r, z);
}
// Generates a cuboid with the X/Y corners rounded to the specified radius.
module rounded_flat(x, y, z, r) {
union() {
difference() {
cube([x,y,z]);
corner_cuts(x, y, z, r);
}
corner_rounds(x, y, z, r);
}
}
// Generates a blank Eurorack panel of the specified HP width and with the
// requested corner rounding.
module eurorack_panel(hp = 8, hole_dia = 3.2, r = 0.3) {
width = 5.08 * hp;
height = 128.5;
depth = 2;
difference() {
rounded_flat(width, height, depth, r);
// cut screw holes.
translate([7.5, 3.0, 0])
cylinder(h=depth, r=hole_dia / 2, center=false);
translate([7.5, 125.5, 0])
cylinder(h=depth, r=hole_dia / 2, center=false);
translate([width-7.5, 3.0, 0])
cylinder(h=depth, r=hole_dia / 2, center=false);
translate([width-7.5, 125.5, 0])
cylinder(h=depth, r=hole_dia / 2, center=false);
}
}
eurorack_panel();