diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..9f31f51 --- /dev/null +++ b/Makefile @@ -0,0 +1,16 @@ +PARAMSETS != cat params.json | jq -r '.parameterSets | keys[] | select(length > 0)' +OUTPUTS = $(PARAMSETS:%=%.3mf) + +all: $(OUTPUTS) + +clean: + rm -f $(OUTPUTS) *.bare.3mf *.log + +targets: + @for i in $(PARAMSETS); do echo $$i.3mf; done + +%.bare.3mf %.log: temp-tower.scad params.json + openscad -o $*.bare.3mf -P $* -p params.json temp-tower.scad 2>$*.log + +%.3mf: %.bare.3mf %.log postprocess.sh + ./postprocess.sh $@ $*.bare.3mf $*.log diff --git a/README.md b/README.md index f0f8eb6..ae0ef32 100644 --- a/README.md +++ b/README.md @@ -4,14 +4,31 @@ A Tiny Temperature Tower This is a tiny temperature tower. I made it because I suspected my printer's hotend thermistor was reporting too cold. -`build.sh` generates `.3mf` files -with extra code to make PrusaSlicer change temperatures automatically. +(I think I was right.) -Defining A New Model -====================== -You can add a new set of model parameters to `params.json`. +Building +---------- + +This uses make(1). +If you've never used make(1) before, +here's a quick introduction: + + make all # Build everything + make clean # Remove build files + make targets # List everything you can build + + +Building A New Model +--------------------------- + +You can add a new set of model parameters to [params.json](params.json). Let's say you named your new parameters `my-new-parameters`. -`build.sh my-new-parameters` will generate `my-new-parameters.3mf`, -with PrusaSlicer temperature changes and ponies and everything. + + make my-new-parameters.3mf # Build only your model + +The resulting 3mf file will have +temperature changes for PrusaSlicer +and ponies +and everything! diff --git a/build.sh b/build.sh deleted file mode 100755 index 9d4506a..0000000 --- a/build.sh +++ /dev/null @@ -1,69 +0,0 @@ -#! /bin/sh - -set -e - -# paramsets contains the location of the OpenSCAD parameter sets. -# see https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Customizer#Saving_Parameters_value_in_JSON_file -paramsets=params.json - -# run executes a program after printing the commandline to stdout. -run () { - echo "=== $*" - "$@" -} - -# render turns OpenSCAD echo into 3mf temperature changes. -# -# It does this by kludging together a PrusaSlicer-specific Metadata file. -render () { - basename=$1; shift - logfile=$basename.log - run openscad -o $basename "$@" temp-tower.scad 2>&1 | tee $logfile - - rm -rf Metadata - mkdir -p Metadata - cat $logfile | while IFS=# read _ _ custom type path text _; do - [ "$custom#$type" = "CUSTOM#3mf" ] || continue - echo $text >> $path - done - - run zip $basename $custom - - rm $custom $logfile - rmdir Metadata -} - -# paramsets lists all defined parameter sets, one per line. -paramsets () { - cat $paramsets | jq -r '.parameterSets | keys[] | select(length > 0)' -} - -case "$1" in - -h|-help|--help) - cat <> $tmpdir/$path +done + +(cd $tmpdir && zip -r $outfile .)