add a 3-column battery mesh variant

This commit is contained in:
2025-04-11 16:50:35 +00:00
parent 52023436e1
commit 46d614f5f8
3 changed files with 28 additions and 24 deletions

View File

@@ -2,16 +2,17 @@ PREFIX=/usr
SHAREDIR=$(PREFIX)/share/models
# all: build/case.stl build/case.gcode build/case.sl1 build/case.ctb build/case.goo build/pinephone_case.png build/pinephone_case_with_phone.png
# all: build/case.stl build/case.gcode build/case.sl1 build/case.goo build/pinephone_case.png build/pinephone_case_with_phone.png
all: \
build/elegoo_saturn_4_tenacious_flex/pinephone/case.goo \
build/generic/pinephone/case.png \
build/generic/pinephone/case.stl \
build/generic/pinephone/case_with_phone.png \
build/jlc_stretch1/pinephone/case.stl \
build/jlc_stretch2/pinephone/case.stl \
build/tpu_bambu_p1p/pinephone/case.gcode \
build/elegoo_saturn_4_tenacious_flex/pinephone/battery_mesh/case.goo \
build/elegoo_saturn_4_tenacious_flex/pinephone/battery_mesh_3_column/case.goo \
build/generic/pinephone/battery_mesh/case.png \
build/generic/pinephone/battery_mesh/case.stl \
build/generic/pinephone/battery_mesh/case_with_phone.png \
build/generic/pinephone/battery_mesh_3_column/case.png \
build/generic/pinephone/battery_mesh_3_column/case.stl \
build/jlc_stretch1/pinephone/battery_mesh/case.stl \
build/jlc_stretch2/pinephone/battery_mesh/case.stl \
build/tpu_bambu_p1p/pinephone/battery_mesh/case.gcode \
build/web-viewer/index.html
install:
@@ -21,10 +22,10 @@ install:
%/case.vtk %/case.vtk.js: %/config main.py src/*.py
mkdir -p "$(@D)"
bash -c 'source $*/config && ./main.py --export-vtk $*/case.vtk'
bash -c 'source $*/config; ./main.py --export-vtk $*/case.vtk'
%/phone.vtk %/phone.vtk.js: %/config main.py src/*.py
mkdir -p "$(@D)"
bash -c 'source $*/config && ./main.py --render-phone-only --export-vtk $*/phone.vtk'
bash -c 'source $*/config; ./main.py --render-phone-only --export-vtk $*/phone.vtk'
build/web-viewer/vtk.js: doc.in/vtk.js
mkdir -p "$(@D)"
@@ -32,47 +33,49 @@ build/web-viewer/vtk.js: doc.in/vtk.js
build/web-viewer/renderWindow.js: doc.in/renderWindow.js
mkdir -p "$(@D)"
cp $< $@
build/web-viewer/index.html: doc.in/index.html build/web-viewer/vtk.js build/web-viewer/renderWindow.js build/generic/pinephone/case.vtk.js build/generic/pinephone/phone.vtk.js
build/web-viewer/index.html: doc.in/index.html build/web-viewer/vtk.js build/web-viewer/renderWindow.js build/generic/pinephone/battery_mesh/case.vtk.js build/generic/pinephone/battery_mesh/phone.vtk.js
mkdir -p "$(@D)"
cp build/generic/pinephone/case.vtk.js "$(@D)"/pinephone_case.vtk.js
cp build/generic/pinephone/phone.vtk.js "$(@D)"/pinephone_phone.vtk.js
cp build/generic/pinephone/battery_mesh/case.vtk.js "$(@D)"/pinephone_case.vtk.js
cp build/generic/pinephone/battery_mesh/phone.vtk.js "$(@D)"/pinephone_phone.vtk.js
cp doc.in/index.html $@
%/case.png: %/config main.py src/*.py
mkdir -p "$(@D)"
bash -c 'source $*/config && ./main.py --export-png $@'
bash -c 'source $*/config; ./main.py --export-png $@'
%/case_with_phone.png: %/config main.py src/*.py
mkdir -p "$(@D)"
bash -c 'source $*/config && ./main.py --render-phone --export-png $@'
bash -c 'source $*/config; ./main.py --render-phone --export-png $@'
%/case.stl: %/config main.py src/*.py
mkdir -p "$(@D)"
bash -c 'source $*/config && ./main.py --export-stl $@'
bash -c 'source $*/config; ./main.py --export-stl $@'
# e.g. build/tpu_bambu_p1p/pinephone.config
# e.g. build/tpu_bambu_p1p/pinephone/battery_mesh_3_column/config
# TODO: the dependencies here are overly broad
build/%/config: profile/model/*.env profile/print/*.env
mkdir -p "$(@D)"
# e.g. `cat profile/model/pinephone.env profile/print/tpu_bambu_p1p`
cat profile/model/$(shell basename $*).env profile/print/$(shell basename $(shell dirname $*)).env > $@
# e.g. `cat profile/model/pinephone.env profile/variant/battery_mesh_3_column.env profile/print/tpu_bambu_p1p.env`
cat profile/model/$(shell basename $(shell dirname $*)).env \
profile/variant/$(shell basename $*).env \
profile/print/$(shell basename $(shell dirname $(shell dirname $*))).env > $@
# .gcode: for FDM printers
%/case.gcode: %/config %/case.stl
mkdir -p $(shell dirname $@)
bash -c 'source $*/config && slic3r $${SLIC3R_FLAGS[@]} $*/case.stl -o $@'
bash -c 'source $*/config; slic3r $${SLIC3R_FLAGS[@]} $*/case.stl -o $@'
# .sl1: for prusa resin-based printers
%/case.sl1: %/config %/case.stl
bash -c 'source $*/config && prusa-slicer --export-sla $*/case.stl'
bash -c 'source $*/config; prusa-slicer --export-sla $*/case.stl'
# .ctb: for Gen 3 Elegoo printers (requires `uvtools` package)
%/case.ctb: %/config %/case.sl1
# XXX: UVtoolsCmd exits `1` on success ?? (what does it exit on failure? bleh)
bash -c 'source $*/config && UVtoolsCmd convert $< Chitubox $@ || test -f $@/
bash -c 'source $*/config; UVtoolsCmd convert $< Chitubox $@ || test -f $@/
# .goo: for Gen 4+ Elegoo printers (requires `mslicer` package)
%/case.goo: %/config %/case.stl
bash -c 'source $*/config && slicer --mesh $*/case.stl $${MSLICER_FLAGS[@]} $@'
bash -c 'source $*/config; slicer --mesh $*/case.stl $${MSLICER_FLAGS[@]} $@'
readme: readme_files/pinephone_front_case_with_phone.png readme_files/pinephone_back_case_with_phone.png readme_files/pinephone_side_case_with_phone.png

View File

View File

@@ -0,0 +1 @@
export CASE_BATTERY_HARNESS_SHELL_COLUMNS=3