|
@@ -0,0 +1,53 @@
|
|
1
|
+#!/bin/bash
|
|
2
|
+
|
|
3
|
+# ----------------------------------------------------------------------------
|
|
4
|
+# Copyright (c) 2023 Kauzerei (openautolab@kauzerei.de)
|
|
5
|
+# Copyright (c) 2023 Thomas Buck (thomas@xythobuz.de)
|
|
6
|
+#
|
|
7
|
+# This program is free software: you can redistribute it and/or modify
|
|
8
|
+# it under the terms of the GNU General Public License as published by
|
|
9
|
+# the Free Software Foundation, either version 3 of the License, or
|
|
10
|
+# (at your option) any later version.
|
|
11
|
+#
|
|
12
|
+# This program is distributed in the hope that it will be useful,
|
|
13
|
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14
|
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15
|
+# GNU General Public License for more details.
|
|
16
|
+#
|
|
17
|
+# See <http://www.gnu.org/licenses/>.
|
|
18
|
+# ----------------------------------------------------------------------------
|
|
19
|
+
|
|
20
|
+# space separated list of scad files (without extension)
|
|
21
|
+MODULES="actuator beam enclosure tamb_mount"
|
|
22
|
+OUTDIR="stl"
|
|
23
|
+
|
|
24
|
+# enter directory of script (case)
|
|
25
|
+cd "$(dirname "$0")"
|
|
26
|
+
|
|
27
|
+# Detect OS
|
|
28
|
+if [[ "$OSTYPE" == "darwin"* ]]; then
|
|
29
|
+ echo "Mac OS X detected"
|
|
30
|
+ SCAD="open -n -a OpenSCAD --args"
|
|
31
|
+else
|
|
32
|
+ echo "Linux detected"
|
|
33
|
+ SCAD="openscad"
|
|
34
|
+fi
|
|
35
|
+
|
|
36
|
+echo "deleting previous build output"
|
|
37
|
+rm -rf $OUTDIR
|
|
38
|
+mkdir -p $OUTDIR
|
|
39
|
+
|
|
40
|
+for MODULE in $MODULES
|
|
41
|
+do
|
|
42
|
+ PARTS=$(grep -o "part.*//.*\[.*]" ${MODULE}.scad | sed 's/,/ /g' | sed 's/.*\[\([^]]*\)\].*/\1/g')
|
|
43
|
+ echo "generating from ${MODULE}"
|
|
44
|
+
|
|
45
|
+ for PART in ${PARTS}
|
|
46
|
+ do
|
|
47
|
+ if [[ "${PART}" != "OPT_"* ]]; then
|
|
48
|
+ echo ${PART}
|
|
49
|
+ FILENAME=$(echo $OUTDIR/${MODULE}_${PART}.stl | tr '[:upper:]' '[:lower:]')
|
|
50
|
+ $SCAD $(pwd)/${MODULE}.scad --D part=\"${PART}\" --o $(pwd)/${FILENAME}
|
|
51
|
+ fi
|
|
52
|
+ done
|
|
53
|
+done
|