Strategy gap: profile-extrude detection does not compose compound shapes into a single body #32

Closed
opened 2026-06-20 20:07:24 +00:00 by Mark · 0 comments
Owner

Profile-extrusion detection is not finding compound shapes

What

pc2cad.py::derive_profile_operations (around line 4317) emits
profile_extrude primitives only when it can pair two parallel
planes
with a polygon on one of them. For a compound shape (e.g. a
prismatic mechanical part with a top, bottom, and side walls), the
planes all exist in the fit, but they are not being composed into a
single profile_extrude primitive that represents the overall
extruded body. Each plane is emitted as its own independent
profile_extrude (post-commit 16404ff's single-plane fallback) or
left unpaired.

The result on the sample_plane_cyl.ply test (and the
Merge_01_pc.ply Revopoint scan): the analytic fit produces a set
of plane primitives and profile_extrude primitives, but no
single primitive represents the overall extruded body of the object.
The build123d export path (pc2cad_profile.py::extract_profile_sketches)
then iterates over the per-plane profile_extrudes and produces a STEP
file that is a stack of independent slabs, not a single coherent
solid with the right topology.

Reproduction

cd ~/Projects/pc2cad
./.venv/bin/python pc2cad_cli.py samples/sample_plane_cyl.ply \
  --out /tmp/test.step --out-format build123d \
  --report /tmp/test_report.json
python -c "
import json
r = json.load(open('/tmp/test_report.json'))
print('primitives:')
for p in r['primitives']:
    print(f'  {p[\"kind\"]} inliers={p[\"inliers\"]} conf={p[\"confidence\"]:.2f}')
"

Expected

For a compound shape with a clear top plane, a bottom plane, and
side walls, the fitter should emit a single profile_extrude
primitive representing the overall extruded body, with the
side-wall planes and other features handled as cuts/booleans on
that body, not as independent profile_extrudes.

Actual

Each plane becomes its own profile_extrude (or is left as a bare
plane). The build123d export produces a stack of independent
slabs. No top-down composition into a single body.

Suggested fix (not for me to implement)

Replace the pairwise-plane-pairing logic in
derive_profile_operations with a top-down strategy: find the
largest overall planar profile, then pair it with a parallel plane
to determine the body depth, then treat the remaining planes as
side walls / feature candidates. See also the related bugs about
the missing feature-detection strategy and the missing "largest
whole shape" decomposition.

  • pc2cad#24 (single-plane profile_extrude regression on
    sample_plane_cyl.ply) — adjacent symptom
  • This is one of the "compound shape" issues called out in the
    2026-06-20 strategy review
# Profile-extrusion detection is not finding compound shapes ## What `pc2cad.py::derive_profile_operations` (around line 4317) emits `profile_extrude` primitives only when it can pair **two parallel planes** with a polygon on one of them. For a compound shape (e.g. a prismatic mechanical part with a top, bottom, and side walls), the planes all exist in the fit, but they are not being composed into a single `profile_extrude` primitive that represents the overall extruded body. Each plane is emitted as its own independent `profile_extrude` (post-commit `16404ff`'s single-plane fallback) or left unpaired. The result on the `sample_plane_cyl.ply` test (and the `Merge_01_pc.ply` Revopoint scan): the analytic fit produces a set of `plane` primitives and `profile_extrude` primitives, but no single primitive represents the overall extruded body of the object. The build123d export path (`pc2cad_profile.py::extract_profile_sketches`) then iterates over the per-plane profile_extrudes and produces a STEP file that is a stack of independent slabs, not a single coherent solid with the right topology. ## Reproduction ```bash cd ~/Projects/pc2cad ./.venv/bin/python pc2cad_cli.py samples/sample_plane_cyl.ply \ --out /tmp/test.step --out-format build123d \ --report /tmp/test_report.json python -c " import json r = json.load(open('/tmp/test_report.json')) print('primitives:') for p in r['primitives']: print(f' {p[\"kind\"]} inliers={p[\"inliers\"]} conf={p[\"confidence\"]:.2f}') " ``` ## Expected For a compound shape with a clear top plane, a bottom plane, and side walls, the fitter should emit a single `profile_extrude` primitive representing the overall extruded body, with the side-wall planes and other features handled as cuts/booleans on that body, not as independent profile_extrudes. ## Actual Each plane becomes its own `profile_extrude` (or is left as a bare `plane`). The build123d export produces a stack of independent slabs. No top-down composition into a single body. ## Suggested fix (not for me to implement) Replace the pairwise-plane-pairing logic in `derive_profile_operations` with a top-down strategy: find the largest overall planar profile, then pair it with a parallel plane to determine the body depth, then treat the remaining planes as side walls / feature candidates. See also the related bugs about the missing feature-detection strategy and the missing "largest whole shape" decomposition. ## Related - pc2cad#24 (single-plane profile_extrude regression on sample_plane_cyl.ply) — adjacent symptom - This is one of the "compound shape" issues called out in the 2026-06-20 strategy review
Mark 2026-06-20 20:07:24 +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#32
No description provided.