Pipeline does not persist the freeform mesh to disk; downstream tools cannot load it #29

Closed
opened 2026-06-20 20:04:18 +00:00 by Mark · 0 comments
Owner

Pipeline does not persist the freeform mesh to disk; render tool cannot use it

What

pc2cad.py::_reconstruct_freeform_mesh (around line 423) returns an
o3d.geometry.TriangleMesh and a report dict, but neither the
report nor any side-artifact file on disk contains the mesh's
vertices / faces. The report only stores triangles and vertices
as integer counts:

report = {
    "status": "ok",
    "method": method,
    "vertices": int(len(mesh.vertices)),
    "triangles": int(len(mesh.triangles)),
}

As a result, any downstream tool that wants to visualise the actual
mesh pc2cad produced (rather than re-running the same algorithm
itself) cannot — it has to re-run Poisson / alpha-shapes / BPA
externally with the same parameters to get a renderable mesh file.

Reproduction

cd ~/Projects/pc2cad
./.venv/bin/python pc2cad_cli.py tests/fixtures/Merge_01_pc.ply \
  --out /tmp/test.brep --mode hybrid --freeform poisson --freeform-poisson-depth 8 \
  --report /tmp/test_report.json
python -c "import json; r = json.load(open('/tmp/test_report.json')); \
  print(r['freeform']); print(list(r['freeform'].keys()))"

Expected

The freeform section of the report should either embed the mesh
data (vertices + triangle indices as nested lists) or the pipeline
should write a side-file like <output>_freeform.ply so downstream
tools can load the actual mesh pc2cad produced.

Actual

{'method': 'poisson', 'status': 'ok', 'vertices': 8486, 'triangles': 16802}

Only counts. No geometry on disk. Render tools that want to compare
input vs. pc2cad's reconstruction have to re-run Poisson
externally and hope the parameters match.

Suggested fix (not for me to implement)

Either:

  • Add the vertices/faces arrays to the freeform report section, or
  • Write a <out>_freeform.ply side-file when the freeform method
    is run, so the mesh is loadable as o3d.io.read_triangle_mesh(...).

The render script /tmp/render_organic.py currently re-runs Poisson
externally with the same parameters as a workaround. That workaround
gives near-identical output for healthy inputs but is a different
code path
from what pc2cad actually executed — they will diverge on
edge cases (different default normal estimation, different density
trim quantile, different octree parameters).

Filed as part of the 2026-06-20 assessment cycle that produced
pc2cad#24, #26.

# Pipeline does not persist the freeform mesh to disk; render tool cannot use it ## What `pc2cad.py::_reconstruct_freeform_mesh` (around line 423) returns an `o3d.geometry.TriangleMesh` and a `report` dict, but neither the report nor any side-artifact file on disk contains the mesh's vertices / faces. The report only stores `triangles` and `vertices` as integer counts: ```python report = { "status": "ok", "method": method, "vertices": int(len(mesh.vertices)), "triangles": int(len(mesh.triangles)), } ``` As a result, any downstream tool that wants to visualise the actual mesh pc2cad produced (rather than re-running the same algorithm itself) cannot — it has to re-run Poisson / alpha-shapes / BPA externally with the same parameters to get a renderable mesh file. ## Reproduction ```bash cd ~/Projects/pc2cad ./.venv/bin/python pc2cad_cli.py tests/fixtures/Merge_01_pc.ply \ --out /tmp/test.brep --mode hybrid --freeform poisson --freeform-poisson-depth 8 \ --report /tmp/test_report.json python -c "import json; r = json.load(open('/tmp/test_report.json')); \ print(r['freeform']); print(list(r['freeform'].keys()))" ``` ## Expected The freeform section of the report should either embed the mesh data (vertices + triangle indices as nested lists) or the pipeline should write a side-file like `<output>_freeform.ply` so downstream tools can load the actual mesh pc2cad produced. ## Actual ```python {'method': 'poisson', 'status': 'ok', 'vertices': 8486, 'triangles': 16802} ``` Only counts. No geometry on disk. Render tools that want to compare input vs. *pc2cad's* reconstruction have to re-run Poisson externally and hope the parameters match. ## Suggested fix (not for me to implement) Either: - Add the vertices/faces arrays to the freeform report section, or - Write a `<out>_freeform.ply` side-file when the freeform method is run, so the mesh is loadable as `o3d.io.read_triangle_mesh(...)`. The render script `/tmp/render_organic.py` currently re-runs Poisson externally with the same parameters as a workaround. That workaround gives near-identical output for healthy inputs but is a *different code path* from what pc2cad actually executed — they will diverge on edge cases (different default normal estimation, different density trim quantile, different octree parameters). ## Related Filed as part of the 2026-06-20 assessment cycle that produced pc2cad#24, #26.
Mark 2026-06-21 16:36:14 +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#29
No description provided.