Remove mesh output paths (out of scope for pc2cad) #9

Closed
opened 2026-06-17 16:48:58 +00:00 by Mark · 2 comments
Owner

pc2cad is a point-cloud → editable CAD solid pipeline. The output is STEP/FCStd + JSON report. Mesh export (.stl/.ply) and freeform mesh reconstruction are OUT OF SCOPE — that is a separate pipeline (point cloud → STL). This tool only outputs CAD primitives.

Scope

Remove from pc2cad_cli.py

  • --mode flag's hybrid choice (keep only analytic)
  • All --freeform* flags (--freeform, --freeform-poisson-depth, --freeform-density-trim, --freeform-bpa-radius-scale, --freeform-alpha)
  • --out-residual flag
  • stl and gltf choices from --out-format (keep step, brep)
  • The temp-STL bridge block in the build123d export branch (it does b.import_stl(tmp_stl) and includes a Compound([prim_solids + [residual_solid]]) — that is mesh in CAD, remove it)
  • The if args.out_residual is not None ... call site at the end of main()
  • freeform_method and freeform_* kwargs from the FitConfig(...) constructor call

Remove from pc2cad.py

  • residual_mesh: Optional[o3d.geometry.TriangleMesh] = None field from FitResult dataclass
  • The residual_mesh = None; if config.freeform_method: residual_mesh, freeform_report = _reconstruct_freeform_mesh(...) block — replace with a simple residual stats report ({"remaining_points": ..., "total_points": ..., "residual_ratio": ...}) under the residual key in the report dict (rename key from freeform to residual)
  • The residual_mesh=residual_mesh kwarg from the FitResult constructor call site
  • The export_residual_mesh() function at the bottom of pc2cad.py (around lines 3142-3151)
  • Add field to the dataclasses import and add report: Dict[str, object] = field(default_factory=dict) as a default on FitResult
  • The freeform_method field on FitConfig — only if no caller references it after your edits

Update PLAN.md

  • Remove or scope-down the "Hybrid fallback: freeform surface patches on residuals" line under MVP Scope
  • Remove Milestone 5 (Freeform Hybrid) — move to a "Future" section that explicitly states mesh-based and freeform surface output are out of scope; output is analytic primitives only
  • Reword the "5) Freeform Surface Fitting (Hybrid)" backlog item to either remove or note it is deferred

DO NOT touch

  • The mesh INPUT path (loading .stl/.obj point clouds via load_point_cloud with --use-vertices) — that is a valid entry point (mesh in, CAD out). The input concern is fine.
  • The --use-vertices flag and mesh_samples argument
  • pointcloud_to_cad_converter.py — already clean per grep
  • build123d_converter_generator.py — separate file, leave alone unless it references removed symbols
  • scripts/ and tests/ — only update to match the new surface; do not rewrite

Acceptance

  • python -m pytest tests/ -x passes
  • CLI rejects --mode hybrid, --out-residual, --out-format stl, --out-format gltf as unknown
  • pc2cad.py no longer has residual_mesh or export_residual_mesh symbols
  • pc2cad_cli.py no longer references freeform / mesh output paths
  • Commit on branch remove-mesh-output in Mark/pc2cad
  • Do not push

Background

The user already tried implementing this directly and got stuck mid-edit. The working tree has partially-applied broken edits across pc2cad.py, pc2cad_cli.py, and pointcloud_to_cad_converter.py. Kilo quickfix should clean up: either finish them or revert and reimplement cleanly, whichever is faster.

Use the systematic-debugging skill to investigate before fixing. Use the shell-scripting skill for any shell commands. Commit on the branch as instructed. Report back when done.

pc2cad is a point-cloud → editable CAD solid pipeline. The output is STEP/FCStd + JSON report. Mesh export (.stl/.ply) and freeform mesh reconstruction are OUT OF SCOPE — that is a separate pipeline (point cloud → STL). This tool only outputs CAD primitives. ## Scope ### Remove from pc2cad_cli.py - `--mode` flag's `hybrid` choice (keep only `analytic`) - All `--freeform*` flags (`--freeform`, `--freeform-poisson-depth`, `--freeform-density-trim`, `--freeform-bpa-radius-scale`, `--freeform-alpha`) - `--out-residual` flag - `stl` and `gltf` choices from `--out-format` (keep `step`, `brep`) - The temp-STL bridge block in the build123d export branch (it does `b.import_stl(tmp_stl)` and includes a `Compound([prim_solids + [residual_solid]])` — that is mesh in CAD, remove it) - The `if args.out_residual is not None ...` call site at the end of main() - `freeform_method` and `freeform_*` kwargs from the `FitConfig(...)` constructor call ### Remove from pc2cad.py - `residual_mesh: Optional[o3d.geometry.TriangleMesh] = None` field from `FitResult` dataclass - The `residual_mesh = None; if config.freeform_method: residual_mesh, freeform_report = _reconstruct_freeform_mesh(...)` block — replace with a simple residual stats report (`{"remaining_points": ..., "total_points": ..., "residual_ratio": ...}`) under the `residual` key in the report dict (rename key from `freeform` to `residual`) - The `residual_mesh=residual_mesh` kwarg from the FitResult constructor call site - The `export_residual_mesh()` function at the bottom of pc2cad.py (around lines 3142-3151) - Add `field` to the dataclasses import and add `report: Dict[str, object] = field(default_factory=dict)` as a default on FitResult - The `freeform_method` field on FitConfig — only if no caller references it after your edits ### Update PLAN.md - Remove or scope-down the "Hybrid fallback: freeform surface patches on residuals" line under MVP Scope - Remove Milestone 5 (Freeform Hybrid) — move to a "Future" section that explicitly states mesh-based and freeform surface output are out of scope; output is analytic primitives only - Reword the "5) Freeform Surface Fitting (Hybrid)" backlog item to either remove or note it is deferred ### DO NOT touch - The mesh INPUT path (loading .stl/.obj point clouds via `load_point_cloud` with `--use-vertices`) — that is a valid entry point (mesh in, CAD out). The input concern is fine. - The `--use-vertices` flag and `mesh_samples` argument - `pointcloud_to_cad_converter.py` — already clean per grep - `build123d_converter_generator.py` — separate file, leave alone unless it references removed symbols - `scripts/` and `tests/` — only update to match the new surface; do not rewrite ## Acceptance - `python -m pytest tests/ -x` passes - CLI rejects `--mode hybrid`, `--out-residual`, `--out-format stl`, `--out-format gltf` as unknown - `pc2cad.py` no longer has `residual_mesh` or `export_residual_mesh` symbols - `pc2cad_cli.py` no longer references freeform / mesh output paths - Commit on branch `remove-mesh-output` in `Mark/pc2cad` - Do not push ## Background The user already tried implementing this directly and got stuck mid-edit. The working tree has partially-applied broken edits across pc2cad.py, pc2cad_cli.py, and pointcloud_to_cad_converter.py. Kilo quickfix should clean up: either finish them or revert and reimplement cleanly, whichever is faster. Use the systematic-debugging skill to investigate before fixing. Use the shell-scripting skill for any shell commands. Commit on the branch as instructed. Report back when done.
Author
Owner

Overseer cleanup: quickfix session idle-killed at 10min. Partial work left in working tree (pc2cad.py: 2 ins / 3 del — dataclass report field switched to field(default_factory=dict), residual_mesh removed from FitResult).

Refactor in .tmp_tests/REMOVE_MESH_EXPORT.md is far from complete. Still TODO:

  • Drop the residual_mesh = None; ... _reconstruct_freeform_mesh(...) block in fit_primitives (line ~1964) and replace with residual_report: Dict[str, object] = {"remaining_points":..., "total_points":..., "residual_ratio":...}. Rename report key freeform -> residual (line 1992).
  • Remove residual_mesh, ... = _reconstruct_freeform_mesh(...) call site (line ~1985).
  • Remove freeform_method=... and all freeform_* kwargs from FitConfig(...) constructor in pc2cad_cli.py.
  • Drop stl, gltf from --out-format choices in CLI; remove --out-residual and --mode hybrid flags.
  • Update any tests referencing removed symbols (residual_mesh, export_residual_mesh, --out-residual, user-facing freeform_method).
  • Run cd /home/b/Projects/pc2cad && python -m pytest tests/ -x — all tests must pass.
  • Clean commit on working branch (no push).

Work has NOT been verified or committed. Recommend manual hand-off or re-dispatch with explicit scoping.

Overseer cleanup: quickfix session idle-killed at 10min. Partial work left in working tree (pc2cad.py: 2 ins / 3 del — dataclass `report` field switched to `field(default_factory=dict)`, `residual_mesh` removed from FitResult). Refactor in `.tmp_tests/REMOVE_MESH_EXPORT.md` is far from complete. Still TODO: - Drop the `residual_mesh = None; ... _reconstruct_freeform_mesh(...)` block in `fit_primitives` (line ~1964) and replace with `residual_report: Dict[str, object] = {"remaining_points":..., "total_points":..., "residual_ratio":...}`. Rename report key `freeform` -> `residual` (line 1992). - Remove `residual_mesh, ... = _reconstruct_freeform_mesh(...)` call site (line ~1985). - Remove `freeform_method=...` and all `freeform_*` kwargs from `FitConfig(...)` constructor in `pc2cad_cli.py`. - Drop `stl`, `gltf` from `--out-format` choices in CLI; remove `--out-residual` and `--mode hybrid` flags. - Update any tests referencing removed symbols (`residual_mesh`, `export_residual_mesh`, `--out-residual`, user-facing `freeform_method`). - Run `cd /home/b/Projects/pc2cad && python -m pytest tests/ -x` — all tests must pass. - Clean commit on working branch (no push). Work has NOT been verified or committed. Recommend manual hand-off or re-dispatch with explicit scoping.
Author
Owner

Closing as superseded. The half-broken state this issue was opened to address has been resolved by reverting the working tree to clean HEAD. The pc2cad.py FitResult dataclass is back to its original form. The original mesh-removal scope is still a valid refactor but should be re-scoped as a fresh ticket rather than fixing prior in-flight work.

Closing as superseded. The half-broken state this issue was opened to address has been resolved by reverting the working tree to clean HEAD. The pc2cad.py FitResult dataclass is back to its original form. The original mesh-removal scope is still a valid refactor but should be re-scoped as a fresh ticket rather than fixing prior in-flight work.
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#9
No description provided.