diff --git a/Makefile b/Makefile index 5d0fa02..6d7dde9 100644 --- a/Makefile +++ b/Makefile @@ -67,12 +67,12 @@ install: install -m644 build/case.stl $(SHAREDIR) install -m644 build/case.gcode $(SHAREDIR) -%/pinephone_case.vtk %/pinephone_case.vtk.js: cq_toplevel.py src/*.py +%/pinephone_case.vtk %/pinephone_case.vtk.js: main.py src/*.py mkdir -p "$(@D)" - ./cq_toplevel.py --export-vtk $*/pinephone_case.vtk -%/pinephone_phone.vtk %/pinephone_phone.vtk.js: cq_toplevel.py src/*.py + ./main.py --export-vtk $*/pinephone_case.vtk +%/pinephone_phone.vtk %/pinephone_phone.vtk.js: main.py src/*.py mkdir -p "$(@D)" - ./cq_toplevel.py --render-phone-only --export-vtk $*/pinephone_phone.vtk + ./main.py --render-phone-only --export-vtk $*/pinephone_phone.vtk build/web-viewer/vtk.js: doc.in/vtk.js mkdir -p build/web-viewer @@ -84,12 +84,12 @@ build/web-viewer/index.html: doc.in/index.html build/web-viewer/vtk.js build/web mkdir -p build/web-viewer cp $< $@ -%_case.png: cq_toplevel.py src/*.py +%_case.png: main.py src/*.py mkdir -p "$(@D)" - ./cq_toplevel.py --export-png $@ -%_case_with_phone.png: cq_toplevel.py src/*.py + ./main.py --export-png $@ +%_case_with_phone.png: main.py src/*.py mkdir -p "$(@D)" - ./cq_toplevel.py --render-phone --export-png $@ + ./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 @@ -98,9 +98,9 @@ doc: readme build/web-viewer/index.html clean: rm -rf build -build/case.stl: cq_toplevel.py src/*.py +build/case.stl: main.py src/*.py mkdir -p "$(@D)" - ./cq_toplevel.py --export-stl $@ + ./main.py --export-stl $@ %.gcode: %.stl mkdir -p $(shell dirname $@) diff --git a/README.md b/README.md index 11718a5..5b5b35c 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ this is a 3d-printable case designed for the PinePhone, but implemented with an eye towards generalizing beyond just that model and supporting future phones/preferences alongside this first model. -as an example, the default case (pictured below) includes a pouch for carrying an external battery, but if you don't want the pouch then you can build with `CASE_BATTERY=none make` (or edit with `CASE_BATTERY=none cq-toplevel.py --editor`, etc). +as an example, the default case (pictured below) includes a pouch for carrying an external battery, but if you don't want the pouch then you can build with `CASE_BATTERY=none make` (or edit with `CASE_BATTERY=none main.py --editor`, etc). the battery pouch is the defining feature of this case though. it's a quick solution to achieve all-day battery life without any special requirements from the OS, and it requires no supports to print: it's a simple mesh which prints flat with the rest of the case, but deforms to fit the battery upon installation. @@ -30,10 +30,10 @@ you'll need a browser which supports webGL (e.g. chromium). ## Building -- `./cq_toplevel.py --export-stl model.stl` +- `./main.py --export-stl model.stl` ## Development -- `./cq_toplevel.py --editor` or `cq-editor ./cq_toplevel.py` to load an interactive GUI +- `./main.py --editor` or `cq-editor ./main.py` to load an interactive GUI - press the green play button to render the model - call with `--render-phone` to see how the phone would fit inside the case diff --git a/cq_toplevel.py b/main.py similarity index 87% rename from cq_toplevel.py rename to main.py index a671707..ec67554 100755 --- a/cq_toplevel.py +++ b/main.py @@ -1,10 +1,18 @@ #!/usr/bin/env python3 """ -toplevel file used for interactive modeling. +toplevel file used for interactive modeling and also data exports. -- `cq-editor ./cq_toplevel.py` -- then press green play button to render -- edit files externally, and press render again to refresh the view +use like: +- `main.py --editor` => to edit the case interactively + - then press green play button to render + - edit files externally, and press render again to refresh the view + - this is shorthand for `cq-editor ./main.py` +- `main.py --export-stl build/case.stl` => to export the case as stl + +every operation works over a parameterized model. you can control this parameterization with environment variables (or flags -- see extended --help): +- CASE_RENDER_PHONE=1 => render not just the case, but also what it would look like with the phone inside +- CASE_RENDER_PHONE_ONLY=1 => render ONLY the phone, no case +- CASE_BATTERY= => design the case to fit a specific battery model, or "none". """ import cadquery as cq