Move the build process from build.sh to a Makefile. Requires parseVars.sh but now all editing and additional modules can be added within takeup.scad.
This commit is contained in:
parent
ce505d83c6
commit
a08924bee4
|
@ -0,0 +1,57 @@
|
||||||
|
###################
|
||||||
|
#
|
||||||
|
# takeup module OpenSCAD Makefile
|
||||||
|
#
|
||||||
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
# of this software and associated documentation files (the "Software"), to deal
|
||||||
|
# in the Software without restriction, including without limitation the rights
|
||||||
|
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
# copies of the Software, and to permit persons to whom the Software is
|
||||||
|
# furnished to do so, subject to the following conditions:
|
||||||
|
#
|
||||||
|
# The above copyright notice and this permission notice shall be included in all
|
||||||
|
# copies or substantial portions of the Software.
|
||||||
|
#
|
||||||
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
# SOFTWARE.
|
||||||
|
#
|
||||||
|
###################
|
||||||
|
|
||||||
|
PREFIX=takeup
|
||||||
|
|
||||||
|
OPENSCAD=openscad
|
||||||
|
OPENSCAD_OPTIONS=-D VERBOSE=false
|
||||||
|
OPENSCAD_IMAGE_OPTIONS=--imgsize=1024,1024 --colorscheme=DeepOcean
|
||||||
|
|
||||||
|
STL=./stl
|
||||||
|
IMG=./img
|
||||||
|
MODELS=$(shell bash ./parseVars.sh PART)
|
||||||
|
|
||||||
|
all: directories models
|
||||||
|
|
||||||
|
directories:
|
||||||
|
mkdir -p $(STL)
|
||||||
|
|
||||||
|
models: directories $(MODELS) moveall
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f $(STL)/$(PREFIX)_*
|
||||||
|
rm -f $(IMG)/$(PREFIX)_*
|
||||||
|
|
||||||
|
cleanall:
|
||||||
|
rm -rf $(STL)
|
||||||
|
rm -rf $(IMG)
|
||||||
|
|
||||||
|
moveall:
|
||||||
|
mv ./*.png ./img/
|
||||||
|
|
||||||
|
# Dependencies for models
|
||||||
|
|
||||||
|
$(MODELS) : $(STL)/$(PREFIX)_%.stl : $(PREFIX).scad
|
||||||
|
$(OPENSCAD) $(OPENSCAD_OPTIONS) -o $@ -D PART=\"$(subst $(PREFIX)_,,$(subst .stl,,$(@F)))\" $<
|
||||||
|
$(OPENSCAD) $(OPENSCAD_OPTIONS) $(OPENSCAD_IMAGE_OPTIONS) -o $(subst $(STL),$(IMG)},$(subst .stl,.png,$(@F))) -D PART=\"$(subst $(PREFIX)_,,$(subst .stl,,$(@F)))\" $<
|
22
build.sh
22
build.sh
|
@ -1,22 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
mkdir -p stl
|
|
||||||
mkdir -p img
|
|
||||||
|
|
||||||
SCAD="./takeup.scad"
|
|
||||||
PARTS=(
|
|
||||||
"slip_coupling"
|
|
||||||
"magnetic_coupling"
|
|
||||||
"mount_plate"
|
|
||||||
"daylight_spool_insert"
|
|
||||||
)
|
|
||||||
|
|
||||||
for part in "${PARTS[@]}"
|
|
||||||
do
|
|
||||||
stl="./stl/takeup_${part}.stl"
|
|
||||||
png="./img/takeup_${part}.png"
|
|
||||||
openscad -o "${stl}" -D "PART=\"${part}\";" "${SCAD}"
|
|
||||||
openscad -o "${png}" -D "PART=\"${part}\";" --imgsize=1024,1024 --colorscheme=DeepOcean "${SCAD}"
|
|
||||||
done
|
|
||||||
|
|
||||||
openscad --preview -o debug.png -D "PART=\"preview\";" "${SCAD}"
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
STOPWORD="${1}"
|
||||||
|
FILE=$(mktemp)
|
||||||
|
TMPFILE=$(mktemp)
|
||||||
|
|
||||||
|
cat takeup.scad | grep -e "${STOPWORD} ==" | awk -F'== "' '{print $2}' | awk -F'"' '{print $1}' > ${TMPFILE}
|
||||||
|
cat ${TMPFILE} | sed 's/^/.\/stl\/takeup_/' | sed 's/$/.stl/' > ${FILE}
|
||||||
|
|
||||||
|
rm -f ${TMPFILE}
|
||||||
|
cat ${FILE} | tr '\n' ' '
|
||||||
|
rm -f ${FILE}
|
Loading…
Reference in New Issue