add a Makefile to export the cadquery to stl and gcode

This commit is contained in:
Colin 2023-12-28 09:10:09 +00:00
parent 7931abdcb2
commit c3b7ee3c44
3 changed files with 60 additions and 0 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
__pycache__
build/

58
Makefile Normal file
View File

@ -0,0 +1,58 @@
PREFIX=/usr
SHAREDIR=$(PREFIX)/share/models
PRINT_TEMP=220
PRINT_BED_TEMP=40
PRINT_NOZZLE_DIAM=0.2
PRINT_FILA_DIAM=1.75
# settings for Bambu p1p 3d printer
# 50mm/sec w/ raft=2, 0.4diam (wrong!), density 20%: works but causes very rough edges
# 40mm/sec w/ raft=0, 0.4diam (wrong!), density 20%: fails; infill becomes too sparse
# 35mm/sec w/ raft=0, 0.4diam (wrong!), density 50%, honeycomb: works, corners are rough
# 25mm/sec w/ raft=0, 0.2diam, density 75%, rectilinear: fails; detached from bed
# 35mm/sec w/ 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_SPEED=40
PRINT_DENSITY=20
PRINT_RAFT_LAYERS=0
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 0.2 \
--skirts 2
all: build/case.stl build/case.gcode
install:
mkdir -p $(SHAREDIR)
install -m644 build/case.stl $(SHAREDIR)
install -m644 build/case.gcode $(SHAREDIR)
clean:
rm -rf build
build/case.stl: src/*.py
mkdir -p $(shell dirname $@)
./cq_toplevel.py --export-stl $@
%.gcode: %.stl
slic3r $(SLIC3R_FLAGS) $< -o $@
.PHONY: all install clean

View File

@ -14,6 +14,7 @@
buildInputs = [
cqPkgs.cadquery
cqPkgs.cq-editor
pkgs.slic3r
# (pkgs.python37.withPackages (ps: with ps; [ cadquery ]))
];
};