Skip to content

Commit 977749a

Browse files
committed
default inverted=false
1 parent b2bf432 commit 977749a

1 file changed

Lines changed: 70 additions & 0 deletions

File tree

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
logo_depth = 0.4;
2+
logo_convexity = 10;
3+
logo_file = "obs-framed-lid.svg";
4+
5+
mode = "main"; // or "inner"
6+
inverted = false;
7+
8+
module main() {
9+
color([1.0, 0, 0]) {
10+
union() {
11+
// TODO: Proper placement of input file should eliminate the need to
12+
// translate and rotate it here.
13+
translate([108, 72, -47.1]) {
14+
rotate([0,-90,0]) {
15+
import("../OBS-C-002 v32.stl");
16+
};
17+
};
18+
// Fill the existing logo in the imported STL file, so we can cut out our own logo.
19+
// TODO: Export the original without a logo in it.
20+
translate([33, 2, -0.5]) {
21+
cube([66, 68, 0.5]);
22+
};
23+
};
24+
};
25+
};
26+
27+
module slice() {
28+
translate([0, 0, -logo_depth]) {
29+
cube([1000, 1000, logo_depth]);
30+
}
31+
}
32+
33+
module inner(inverted=false) {
34+
if (inverted) {
35+
difference() {
36+
intersection() {
37+
main();
38+
slice();
39+
}
40+
inner(inverted=false);
41+
}
42+
} else {
43+
color([0, 1.0, 0]) {
44+
mirror([0, 0, 0]) {
45+
translate([0, 0, -logo_depth]) {
46+
linear_extrude(height = logo_depth, center=false, convexity = logo_convexity) {
47+
import(file = logo_file);
48+
};
49+
}
50+
}
51+
};
52+
}
53+
}
54+
55+
rotate([0, 180, 0]) {
56+
if (mode == "main" && inverted) {
57+
difference() {
58+
main();
59+
slice();
60+
}
61+
inner(inverted=false);
62+
} else if (mode == "main") {
63+
difference() {
64+
main();
65+
inner();
66+
}
67+
} else if (mode == "inner") {
68+
inner(inverted=inverted);
69+
}
70+
}

0 commit comments

Comments
 (0)