# Benchtop instrument enclosure

A parametric sheet-metal enclosure for a declared 140 x 90 x 45 mm electronics envelope. The compact body is 220 x 180 x 90 mm; a second configuration increases width to 260 mm. The tray lifts out independently of the front and rear panels.

## Included files

- `model.py`: CadQuery geometry, actual bent shell, panel cutouts and nominal hardware.
- `inputs.json`: dimensions, K factor, manufacturing tolerances and reference interfaces. All geometry uses millimeters.
- `outputs/<configuration>/cad/`: assembled and exploded STEP, assembly STL, individual sheet/post STEP and STL, and separate electronics/connector envelopes.
- `outputs/<configuration>/flat-patterns/`: DXF in millimeters. Only CUT is manufacturing cut geometry; BEND contains bend-center references.
- `outputs/<configuration>/drawings/`: dimensioned SVG flat drawings and orthographic assembly drawing.
- `outputs/<configuration>/cut-coordinates.csv`: exact cutout and hole coordinates from each flat drawing's lower-left datum.
- `outputs/<configuration>/bom.csv`: all 49 modeled solids with reference material and estimated mass.
- `outputs/post-hole-schedule.csv`: corner-post thread positions and nominal blind depths.
- `report.html`: design, development equations, fit results and file links.
- `completion/report.html`: additional manufacturing/service scenarios and rejected alternatives.
- `completion/synthetic-inspection.csv`: 500 explicitly synthetic rows from bounded manufacturing inputs.
- `verification.json`, `completion.json`, `test-results.txt`: executed checks and source hashes.

## Reproduce

Python 3.12 and the package versions in `requirements.txt` were used for the recorded run. A virtual environment is recommended.

```sh
python -m pip install -r requirements.txt
python run.py
python test_project.py
python complete_validation.py
```

`run.py` rebuilds both configurations, checks assembled geometry and exports, runs the regression suite, and updates the main report. `complete_validation.py` runs the independent manufacturing/service scenarios and updates its acceptance record.

For a modified design, copy the input file and use a separate output directory:

```sh
python run.py --inputs my-inputs.json --output my-output
```

This generates CAD, drawings, a BOM, service-sweep CSV and `summary.json` for the alternate inputs. It does not overwrite the included reference reports or present them as validation of the changed design. Negative dimensions, unsupported units, invalid K factors, unsafe configuration names and impossible component envelopes are rejected.

The generated SVG drawings can be opened directly in a browser. STEP is the authoritative solid geometry; STL is a tessellated exchange format. The exploded STEP contains the same physical parts translated for inspection, so it must not be used for fit or overall-dimension checks. The separate reference-envelopes STEP does not contain supplied electronics.

## Design and assembly

1. Cut the five sheet profiles from 1.5 mm stock. The modeled reference material is aluminum with density 2680 kg/m3. The material temper and actual bend tooling are not qualified by this study.
2. Form the U-shell with two 90-degree bends, inside radius 2 mm. The nominal K factor is 0.42. Verify compensation using the actual process before cutting production stock.
3. Install the four machined corner posts, tray spacers and feet. Generic M3 screw and thread envelopes are modeled without helical threads. The post-hole schedule calls out nominal threaded interfaces; drill-point geometry is not represented.
4. Attach the front and rear panels. Install the electronics tray and reference PCB spacers.
5. Fit components only if their envelopes and cable requirements agree with the declared inputs. Close the lid after checking the harness.

For service, disconnect power and the harness, remove the lid, remove four tray-top screws and lift the tray vertically. The base-side spacer screws stay installed. The checked driver diameter is 10 mm; a 24 mm driver collides with the reference electronics envelope. This is a geometric access result, not a tool or service safety qualification.

The separate M3 x 6 tray and base screws have a 1 mm gap between tips in the 10 mm spacer. The PCB spacers are optional reference support hardware; PCB attachment details must come from the actual board drawing. Front/rear apertures are declared reference interfaces, not footprints copied from a vendor part.

## Results and boundaries

- Both configurations rebuild with 49 valid solids and no positive-volume assembly intersections.
- All 26 geometry/export checks passed. The regression suite contains 16 tests.
- All 14 additional manufacturing/service outcomes matched their expectations.
- Compact developed shell width: 391.262389 mm; per-bend allowance: 4.131194 mm.
- Selected horizontal panel-fit lower bound: 0.155752 mm total clearance. Vertical lower bound: 0.25 mm.
- Tray/post lower bound: 0.75 mm per side. Cable-envelope lower bound: 2.7 mm.
- The old post setback, uncalibrated K interval, larger cable bend radius and oversized driver are rejected and retained in the report.

The DXF uses neutral-axis development. The constant-thickness bent CAD and the K-based flat blank have slightly different idealized shell volumes; the main report quantifies that difference. K and all manufacturing tolerances are assumptions. The synthetic inspection samples are not measured process capability.

No physical manufacturing, thread-strength, shock, thermal, electrical, EMC or ingress qualification is claimed. There is no product rating. This package completes the geometry, export, fit and theoretical manufacturing study within the stated reference interfaces.

## Primary references

- SOLIDWORKS K factor and bend allowance: https://help.solidworks.com/2019/English/SolidWorks/sldworks/c_K_Factor.htm
- SOLIDWORKS bend allowance definitions: https://help.solidworks.com/2020/english/SolidWorks/sldworks/c_bend_allowance_and_bend_deduction.htm
- CadQuery import/export: https://cadquery.readthedocs.io/en/latest/importexport.html
