use a makefile with simpler (cross-section only) presets
This commit is contained in:
parent
ea2304d898
commit
3a8a6cdca6
21
Makefile
Normal file
21
Makefile
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
basedir := $(dir $(realpath $(lastword $(MAKEFILE_LIST))))
|
||||
OPENSCAD = openscad
|
||||
OPENSCAD_FLATPAK = flatpak run --filesystem=$(basedir) org.openscad.OpenSCAD
|
||||
|
||||
ifdef USE_FLATPAK
|
||||
OPENSCAD = $(OPENSCAD_FLATPAK)
|
||||
endif
|
||||
|
||||
BASENAME = mini-tube
|
||||
SOURCE_FILE = $(BASENAME).scad
|
||||
PRESET_FILE = $(BASENAME).json
|
||||
PRESETS = 1ml-50mm2 1ml-100mm2 2ml-50mm2 2ml-100mm2 2ml-200mm2 5ml-100mm2 5ml-200mm2 5ml-333mm2 10ml-333mm2
|
||||
|
||||
default: $(foreach preset,$(PRESETS),$(BASENAME)-$(preset).3mf)
|
||||
.PHONY: default
|
||||
|
||||
$(BASENAME)-%.3mf: params = $(subst -, ,$*)
|
||||
$(BASENAME)-%.3mf: volume_ml = $(patsubst %ml,%,$(word 1,$(params)))
|
||||
$(BASENAME)-%.3mf: preset = $(word 2,$(params))
|
||||
$(BASENAME)-%.3mf: $(SOURCE_FILE) $(PRESET_FILE)
|
||||
$(OPENSCAD) -o $@ -p $(PRESET_FILE) -P $(preset) -D volume_ml=$(volume_ml) $(SOURCE_FILE)
|
||||
|
|
@ -1,60 +1,23 @@
|
|||
{
|
||||
"parameterSets":
|
||||
{
|
||||
"1ml-50mm2": {
|
||||
"volume_ml": "1",
|
||||
"50mm2": {
|
||||
"cross_section_mm2": "50",
|
||||
"marks_small_ml": "0.1",
|
||||
"marks_medium_ml": "0.5",
|
||||
"text_size_mm": "3"
|
||||
},
|
||||
"1ml-100mm2": {
|
||||
"volume_ml": "1",
|
||||
"cross_section_mm2": "100",
|
||||
"marks_small_ml": "0.2",
|
||||
"text_size_mm": "3"
|
||||
},
|
||||
"2ml-50mm2": {
|
||||
"volume_ml": "2",
|
||||
"cross_section_mm2": "50",
|
||||
"marks_small_ml": "0.1",
|
||||
"marks_medium_ml": "0.5",
|
||||
"text_size_mm": "3"
|
||||
},
|
||||
"2ml-100mm2": {
|
||||
"volume_ml": "2",
|
||||
"100mm2": {
|
||||
"cross_section_mm2": "100",
|
||||
"marks_small_ml": "0.2",
|
||||
"text_size_mm": "5"
|
||||
},
|
||||
"2ml-200mm2": {
|
||||
"volume_ml": "2",
|
||||
"200mm2": {
|
||||
"cross_section_mm2": "200",
|
||||
"marks_small_ml": "0.2",
|
||||
"text_size_mm": "5"
|
||||
"text_size_mm": "6"
|
||||
},
|
||||
"5ml-100mm2": {
|
||||
"volume_ml": "5",
|
||||
"cross_section_mm2": "100",
|
||||
"marks_small_ml": "0.2",
|
||||
"text_size_mm": "5"
|
||||
},
|
||||
"5ml-200mm2": {
|
||||
"volume_ml": "5",
|
||||
"cross_section_mm2": "200",
|
||||
"marks_small_ml": "0.2",
|
||||
"text_size_mm": "5"
|
||||
},
|
||||
"5ml-333mm2": {
|
||||
"volume_ml": "5",
|
||||
"cross_section_mm2": "333",
|
||||
"marks_small_ml": "0.5",
|
||||
"marks_medium_ml": "1",
|
||||
"marks_large_ml": "5",
|
||||
"text_size_mm": "7"
|
||||
},
|
||||
"10ml-333mm2": {
|
||||
"volume_ml": "10",
|
||||
"333mm2": {
|
||||
"cross_section_mm2": "333",
|
||||
"marks_small_ml": "0.5",
|
||||
"marks_medium_ml": "1",
|
||||
|
|
|
|||
11
mini-tube.sh
11
mini-tube.sh
|
|
@ -1,11 +0,0 @@
|
|||
#!/bin/zsh
|
||||
|
||||
cd ${0%/*}
|
||||
|
||||
if command -v openscad >/dev/null 2>&1; then
|
||||
openscad=openscad
|
||||
else
|
||||
openscad=(flatpak run --filesystem=$PWD org.openscad.OpenSCAD)
|
||||
fi
|
||||
|
||||
<mini-tube.json jq --raw-output '.parameterSets | keys.[]' | xargs -P$(nproc) -I@ -- $openscad -o mini-tube-@.3mf -p mini-tube.json -P @ mini-tube.scad
|
||||
Loading…
Reference in New Issue
Block a user