Skip to content

Commit 49494db

Browse files
committed
logo-case-generator: Add makefile, unify OpenSCAD scripts
1 parent 326616b commit 49494db

12 files changed

Lines changed: 123 additions & 153 deletions

File tree

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "MainCase/VerticalCase_JSN-AJ/logo-case-generator/BOSL2"]
2+
path = MainCase/VerticalCase_JSN-AJ/logo-case-generator/BOSL2
3+
url = https://github.com/revarbat/BOSL2
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*/*.stl
Submodule BOSL2 added at e062549
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/bin/bash
2+
3+
## normal mode (inverted=false)
4+
LOGO_DEPTH=0.4
5+
FOLDER=obs-logo
6+
7+
${FOLDER}: ${FOLDER}/lid_inverted_main.stl ${FOLDER}/lid_inverted_inner.stl ${FOLDER}/maincase_inverted_main.stl ${FOLDER}/maincase_inverted_inner.stl ${FOLDER}/lid_normal_main.stl ${FOLDER}/lid_normal_inner.stl ${FOLDER}/maincase_normal_main.stl ${FOLDER}/maincase_normal_inner.stl
8+
9+
${FOLDER}/lid_inverted_main.stl:
10+
openscad -D 'mode="main"' -D 'folder="${FOLDER}"' -D "logo_depth=${LOGO_DEPTH}" -D 'part="lid"' -D "inverted=true" combine.scad -o $@
11+
12+
${FOLDER}/lid_inverted_inner.stl:
13+
openscad -D 'mode="inner"' -D 'folder="${FOLDER}"' -D "logo_depth=${LOGO_DEPTH}" -D 'part="lid"' -D "inverted=true" combine.scad -o $@
14+
15+
${FOLDER}/maincase_inverted_main.stl:
16+
openscad -D 'mode="main"' -D 'folder="${FOLDER}"' -D "logo_depth=${LOGO_DEPTH}" -D 'part="maincase"' -D "inverted=true" combine.scad -o $@
17+
18+
${FOLDER}/maincase_inverted_inner.stl:
19+
openscad -D 'mode="inner"' -D 'folder="${FOLDER}"' -D "logo_depth=${LOGO_DEPTH}" -D 'part="maincase"' -D "inverted=true" combine.scad -o $@
20+
21+
${FOLDER}/lid_normal_main.stl:
22+
openscad -D 'mode="main"' -D 'folder="${FOLDER}"' -D "logo_depth=${LOGO_DEPTH}" -D 'part="lid"' -D "inverted=false" combine.scad -o $@
23+
24+
${FOLDER}/lid_normal_inner.stl:
25+
openscad -D 'mode="inner"' -D 'folder="${FOLDER}"' -D "logo_depth=${LOGO_DEPTH}" -D 'part="lid"' -D "inverted=false" combine.scad -o $@
26+
27+
${FOLDER}/maincase_normal_main.stl:
28+
openscad -D 'mode="main"' -D 'folder="${FOLDER}"' -D "logo_depth=${LOGO_DEPTH}" -D 'part="maincase"' -D "inverted=false" combine.scad -o $@
29+
30+
${FOLDER}/maincase_normal_inner.stl:
31+
openscad -D 'mode="inner"' -D 'folder="${FOLDER}"' -D "logo_depth=${LOGO_DEPTH}" -D 'part="maincase"' -D "inverted=false" combine.scad -o $@
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
include <BOSL2/std.scad>
2+
3+
// Build settings
4+
logo_depth = 0.4;
5+
folder = "obs-logo";
6+
part = "lid"; // "maincase" or "lid"
7+
mode = "main"; // "main" or "inner"
8+
inverted = true;
9+
10+
// Advanced settings
11+
logo_convexity = 10;
12+
13+
14+
// Derived variables
15+
logo_file = str_format("{}/{}.svg", [folder, part]);
16+
17+
18+
module main() {
19+
color([1.0, 0, 0]) {
20+
if (part == "maincase") {
21+
import("../OBS-MainCase-A-001_MainCase_without_logo_v0.1.4.stl");
22+
} else {
23+
union() {
24+
25+
// TODO: Proper placement of input file should eliminate the need to
26+
// translate and rotate it here.
27+
translate([108, 72, -47.1]) {
28+
rotate([0,-90,0]) {
29+
import("../OBS-MainCase-A-002_Lid_v0.1.0.stl");
30+
};
31+
};
32+
33+
// Fill the existing logo in the imported STL file, so we can cut out our own logo.
34+
// TODO: Export the original without a logo in it.
35+
translate([33, 2, -0.5]) {
36+
cube([66, 68, 0.5]);
37+
};
38+
39+
};
40+
}
41+
};
42+
};
43+
44+
module slice() {
45+
translate([0, 0, part == "maincase" ? 0 : -logo_depth]) {
46+
cube([1000, 1000, logo_depth]);
47+
}
48+
}
49+
50+
module inner(inverted=false) {
51+
if (inverted) {
52+
difference() {
53+
intersection() {
54+
main();
55+
slice();
56+
}
57+
inner(inverted=false);
58+
}
59+
} else {
60+
color([0, 1.0, 0]) {
61+
mirror([part == "maincase" ? 1 : 0, 0, 0]) {
62+
translate([0, 0, part == "maincase" ? 0 : -logo_depth]) {
63+
linear_extrude(height = logo_depth, center=false, convexity = logo_convexity) {
64+
import(file = logo_file);
65+
};
66+
}
67+
}
68+
};
69+
}
70+
}
71+
72+
rotate([0, part == "maincase" ? 0 : 180, 0]) {
73+
if (mode == "main" && inverted) {
74+
difference() {
75+
main();
76+
slice();
77+
}
78+
inner(inverted=false);
79+
} else if (mode == "main") {
80+
difference() {
81+
main();
82+
inner();
83+
}
84+
} else if (mode == "inner") {
85+
inner(inverted=inverted);
86+
}
87+
}

MainCase/VerticalCase_JSN-AJ/logo-case-generator/generate_logos_maincase.sh

Lines changed: 0 additions & 22 deletions
This file was deleted.

MainCase/VerticalCase_JSN-AJ/logo-case-generator/logo-lid.scad

Lines changed: 0 additions & 70 deletions
This file was deleted.

MainCase/VerticalCase_JSN-AJ/logo-case-generator/logo-maincase.scad

Lines changed: 0 additions & 61 deletions
This file was deleted.

MainCase/VerticalCase_JSN-AJ/logo-case-generator/obs-framed-lid.svg renamed to MainCase/VerticalCase_JSN-AJ/logo-case-generator/obs-logo/lid.svg

File renamed without changes.

MainCase/VerticalCase_JSN-AJ/logo-case-generator/obs-framed-maincase.svg renamed to MainCase/VerticalCase_JSN-AJ/logo-case-generator/obs-logo/maincase.svg

File renamed without changes.

0 commit comments

Comments
 (0)