Everything resolves relative to the script's own folder, so copy
display_enclosure_cadquery/ anywhere and it runs.
Built and tested on CadQuery 2.7.0, Python 3.10.
Conda is the reliable route (CadQuery pulls in the OpenCascade kernel, which pip sometimes struggles with on Windows):
conda create -n encl python=3.10
conda activate encl
conda install -c conda-forge cadquery
pip install trimesh numpy matplotlib
Or pip only:
python -m venv .venv
.venv\Scripts\activate # Windows
pip install cadquery trimesh numpy matplotlib
cadquery is required to build. trimesh, numpy and matplotlib are only
needed for the verification and preview scripts.
python build_enclosure_cq.py # writes enclosure.step + enclosure.stl
python place_parts.py # writes the three *_placed.step bodies
build_enclosure_cq.py takes a couple of minutes - it is a long boolean chain
plus a shape-healing pass and a STEP round-trip.
Source - keep these:
build_enclosure_cq.py the entire model. Every dimension lives in the P{} dict at the top.
place_parts.py places the reference bodies into the build frame
DESIGN_LOG.md full decision history, every measurement and every bug found
Reference bodies - required inputs, do not delete:
10_1-DSI-TOUCH-A-20250702.stp the display (Waveshare)
Radial-Cooling-Fan-5015-DC12V.STEP the 5015 blower
speaker_unibody.step the speaker
Generated - safe to delete, they rebuild:
enclosure.step / .stl
display_placed.step / speaker_placed.step / fan_placed.step / fan_placed.stl
every *.png preview
All dimensions are parameters in the P dictionary at the top of
build_enclosure_cq.py. The build carries asserts that fail loudly rather than
silently producing a bad part - for example changing P['front']['bezel']
re-derives the whole shell, and if that pushed the duct into the speaker or into
the screwdriver's path the build stops with a message naming the clash.
Two switches worth knowing:
P['speaker']['boss']['mode'] 'heat_insert' or 'self_tap'
P['fan']['boss']['mode'] 'heat_insert' or 'self_tap'
The build prints its own guard values. Expect:
post-roundtrip-fix: solids: 1 valid: True
final bbox: 247.0 x 85.6 x 177.0 mm
duct guards ok: +0.75mm over the speaker, +0.74mm under the O9 corridor
If solids is not 1, or valid is False, the boolean chain has broken - do not
export that STL.