phone-case-cq/Makefile

111 lines
3.9 KiB
Makefile

PREFIX=/usr
SHAREDIR=$(PREFIX)/share/models
PRINT_NOZZLE_DIAM=0.2
PRINT_FILA_DIAM=1.75
# settings for Bambu p1p 3d printer, TPU
# takeaways:
# - bed-temp: 65C
# - first-layer-height: 0.2mm
# - GLUE THE BED AGGRESSIVELY
# - body length: 160mm is too short
# - overhang: 3.0/3.5/6.0mm is too much
#
# runs/data:
# - bed-temp 65C, first-layer-height 0.2mm, 40mm/s, gluestick the bed: print adheres
# - printbed-layer fillets are messy, less messy when turned into chamfers, but still imperfect.
# - bed-temp 40C, first-layer-height 0.2mm, 40mm/s: first layer strings
# - bed-temp 40C, first-layer-height 0.2mm, 40mm/s, light gluestick the bed: first layer strings, then detaches
# - bed-temp 60C, first-layer-height 0.15mm, 40mm/s: first layer doesn't even extrude
# - 50mm/sec w/ bed=65C, raft=2, 0.4diam (wrong!), density 20%: works but causes very rough edges
# - 40mm/sec w/ bed=65C, raft=0, 0.4diam (wrong!), density 20%: fails; infill becomes too sparse
# - 35mm/sec w/ bed=65C, raft=0, 0.4diam (wrong!), density 50%, honeycomb: works, corners are rough
# - 25mm/sec w/ bed=65C, raft=0, 0.2diam, density 75%, rectilinear: fails; detached from bed
# - 35mm/sec w/ bed=65C, raft=0, 0.2diam, density 75%, rectilinear, first-layer 0.2: works, but takes like 6 hours to print
# - 2.5mm thickness => needlessly thick; stiff
# - 160mm length => too short
# - 3/3.5/6.0mm screen overhang => too much (that amount of overhang can't be printed reliably)
# - port cutouts => should extend into more z
PRINT_TEMP=220
PRINT_BED_TEMP=65
PRINT_SPEED=40
PRINT_DENSITY=20
PRINT_FIRST_LAYER_H=0.2
PRINT_RAFT_LAYERS=0
# fill options:
# - <https://manual.slic3r.org/expert-mode/print-settings>
# - line
# - rectilinear
# - honeycomb
# - concentric
# - hilbert
# - archimedes
PRINT_FILL_PATTERN=honeycomb
# XXX: Slic3r doesn't always set the bed temperature correctly. fix by specifying it also for the first layer.
SLIC3R_FLAGS=\
--temperature $(PRINT_TEMP) \
--first-layer-temperature $(PRINT_TEMP) \
--bed-temperature $(PRINT_BED_TEMP) \
--first-layer-bed-temperature $(PRINT_BED_TEMP) \
--nozzle-diameter $(PRINT_NOZZLE_DIAM) \
--filament-diameter $(PRINT_FILA_DIAM) \
--solid-infill-speed $(PRINT_SPEED) \
--first-layer-speed $(PRINT_SPEED) \
--infill-speed $(PRINT_SPEED) \
--raft-layers $(PRINT_RAFT_LAYERS) \
--fill-density $(PRINT_DENSITY) \
--fill-pattern $(PRINT_FILL_PATTERN) \
--use-firmware-retraction \
--first-layer-height $(PRINT_FIRST_LAYER_H) \
--skirts 3
# --brim-width 10 #< combine with raft, if first layer fails to adhere well
all: build/case.stl build/case.gcode
install:
mkdir -p $(SHAREDIR)
install -m644 build/case.stl $(SHAREDIR)
install -m644 build/case.gcode $(SHAREDIR)
%/pinephone_case.vtk %/pinephone_case.vtk.js: main.py src/*.py
mkdir -p "$(@D)"
./main.py --export-vtk $*/pinephone_case.vtk
%/pinephone_phone.vtk %/pinephone_phone.vtk.js: main.py src/*.py
mkdir -p "$(@D)"
./main.py --render-phone-only --export-vtk $*/pinephone_phone.vtk
build/web-viewer/vtk.js: doc.in/vtk.js
mkdir -p build/web-viewer
cp $< $@
build/web-viewer/renderWindow.js: doc.in/renderWindow.js
mkdir -p build/web-viewer
cp $< $@
build/web-viewer/index.html: doc.in/index.html build/web-viewer/vtk.js build/web-viewer/renderWindow.js build/web-viewer/pinephone_case.vtk.js build/web-viewer/pinephone_phone.vtk.js
mkdir -p build/web-viewer
cp $< $@
%_case.png: main.py src/*.py
mkdir -p "$(@D)"
./main.py --export-png $@
%_case_with_phone.png: main.py src/*.py
mkdir -p "$(@D)"
./main.py --render-phone --export-png $@
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
doc: readme build/web-viewer/index.html
clean:
rm -rf build
build/case.stl: main.py src/*.py
mkdir -p "$(@D)"
./main.py --export-stl $@
%.gcode: %.stl
mkdir -p $(shell dirname $@)
slic3r $(SLIC3R_FLAGS) $< -o $@
.PHONY: all install readme doc clean