Add STL output format as first-class export option #10

Closed
opened 2026-06-17 18:14:01 +00:00 by Mark · 0 comments
Owner

Context

Earlier this morning we removed --out-format stl (and gltf) from pc2cad_cli.py because mesh-format output was deemed out of scope for pc2cad (the tool's job is point cloud → editable CAD solid, not point cloud → mesh). The user has since reconsidered: mesh export IS a legitimate use case for this tool, just not as a substitute for CAD output — users may want both, or may want a fast STL preview while the analytic reconstruction runs.

Scope

Re-introduce stl (and optionally gltf) as --out-format choices, but with a clear semantic distinction from the CAD path:

  1. --mode analytic --out-format stl — produce an STL mesh from the fitted analytic primitives (tessellate the analytic B-Rep, NOT from the residual point cloud). This gives users a faithful preview of the analytic reconstruction.
  2. The hybrid/freeform path that mesh-tessellates the Poisson/BPA surface should remain out of scope — that's what pointcloud_to_cad_converter.py and other point-cloud → STL tools already do well.

Concrete changes

  • pc2cad_cli.py: re-add stl (and possibly gltf) to --out-format choices with documentation noting the difference from the analytic-CAD path.
  • pc2cad.py: ensure the CAD exporter can tessellate analytic solids into mesh format (build123d has b.export_stl for Solids/Compounds; the FreeCAD backend would need Part.Shape.tessellate() + STL writer).
  • Document the scope distinction in PLAN.md and pointcloud-to-cad-guide.md.

Acceptance

  • pc2cad_cli.py accepts --out-format step|brep|stl (gltf optional).
  • stl output is generated from analytic primitives, not from a Poisson mesh of residuals.
  • Docs explain when to use stl vs step.
  • Tests cover STL round-trip (input primitives → STL → load → confirm face count).

Why this matters

Users scanning parts often want a quick visual preview without round-tripping through STEP into a CAD app. STL from analytic primitives is faithful (no Poisson artifacts) and fast.

## Context Earlier this morning we removed `--out-format stl` (and `gltf`) from `pc2cad_cli.py` because mesh-format output was deemed out of scope for pc2cad (the tool's job is point cloud → editable CAD solid, not point cloud → mesh). The user has since reconsidered: mesh export IS a legitimate use case for this tool, just not as a substitute for CAD output — users may want both, or may want a fast STL preview while the analytic reconstruction runs. ## Scope Re-introduce `stl` (and optionally `gltf`) as `--out-format` choices, but with a clear semantic distinction from the CAD path: 1. **`--mode analytic --out-format stl`** — produce an STL mesh from the fitted analytic primitives (tessellate the analytic B-Rep, NOT from the residual point cloud). This gives users a faithful preview of the analytic reconstruction. 2. The hybrid/freeform path that mesh-tessellates the Poisson/BPA surface should remain out of scope — that's what `pointcloud_to_cad_converter.py` and other point-cloud → STL tools already do well. ### Concrete changes - `pc2cad_cli.py`: re-add `stl` (and possibly `gltf`) to `--out-format` choices with documentation noting the difference from the analytic-CAD path. - `pc2cad.py`: ensure the CAD exporter can tessellate analytic solids into mesh format (build123d has `b.export_stl` for Solids/Compounds; the FreeCAD backend would need `Part.Shape.tessellate()` + STL writer). - Document the scope distinction in `PLAN.md` and `pointcloud-to-cad-guide.md`. ## Acceptance - `pc2cad_cli.py` accepts `--out-format step|brep|stl` (gltf optional). - `stl` output is generated from analytic primitives, not from a Poisson mesh of residuals. - Docs explain when to use `stl` vs `step`. - Tests cover STL round-trip (input primitives → STL → load → confirm face count). ## Why this matters Users scanning parts often want a quick visual preview without round-tripping through STEP into a CAD app. STL from analytic primitives is faithful (no Poisson artifacts) and fast.
Mark closed this issue 2026-06-19 23:30:02 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Mark/pc2cad#10
No description provided.