Strategy gap: no top-down decomposition into body + features (largest whole shape, then features) #33

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

Missing top-down strategy: find the largest whole shape first, then decompose into features

What

pc2cad.py currently runs a purely bottom-up analytic fit: it
segments the point cloud, fits primitives to each segment, and
emits a flat list of plane / cylinder / cone / sphere
primitives plus per-plane profile_extrude fallbacks. There is no
top-down pass that asks "what is the overall shape of this object?"

The user-facing impact: for any compound shape (a prismatic part, a
turned part, a housing with a boss and a counterbore), the output
is a list of independent primitives that don't compose into a
coherent solid. There's no concept of "this is the main body"
versus "these are the features cut into the body." The build123d
export path then has no body to subtract features from, so it
falls back to either dropping the features or producing a stack of
independent slabs.

The pipeline has pieces of a top-down strategy scattered through
the code (detect_planar_pockets, detect_chamfers,
detect_fillets, slot detection, hole detection), but they're
applied as independent bottom-up passes on the primitive list
rather than as steps in a single coherent body-then-features
workflow.

Reproduction

Run the pipeline on any compound mechanical sample (e.g.
samples/sample_plane_cyl.ply, the Merge_01_pc.ply Revopoint
scan) and inspect the report's primitive list. The list is a flat
set of independent primitives; the report has no body /
features structure.

Expected

The fitter should produce a report with at least:

  • One body primitive (or small set) representing the overall
    solid(s) of the object.
  • A features list representing the cuts / additions on each body
    (holes, counterbores, pockets, slots, chamfers, fillets).
  • The build123d export should then build the body, then cut the
    features into it.

Actual

Flat primitive list, no body/features structure, export produces
a stack of independent slabs or a freeform mesh with no feature
hierarchy.

Suggested fix (not for me to implement)

Add a top-down pass to pc2cad.py that runs after the analytic
fit:

  1. Find the largest single-body primitive (the one that explains
    the most inliers and is the most "enclosing" shape — a plane
    slab, a cylinder, etc.).
  2. Tag it as the body.
  3. Re-classify remaining primitives as feature candidates based on
    adjacency, inlier-count ratio, and intersection patterns with
    the body.
  4. Pass the body + features to the build123d export path, which
    already has extrude / revolve for the body and the boolean
    ops (cut, fuse) for the features.
  • pc2cad#24 (single-plane extrude regression — adjacent symptom)
  • pc2cad#28-31 (render-tooling bugs from the same assessment cycle)
  • This is the strategy gap the user called out on 2026-06-20: "we
    need a strategy in order, to find the largest planar profile
    extrusions, find the largest whole shapes, detect holes, gouges,
    counterbores etc."
# Missing top-down strategy: find the largest whole shape first, then decompose into features ## What `pc2cad.py` currently runs a purely bottom-up analytic fit: it segments the point cloud, fits primitives to each segment, and emits a flat list of `plane` / `cylinder` / `cone` / `sphere` primitives plus per-plane `profile_extrude` fallbacks. There is no top-down pass that asks "what is the overall shape of this object?" The user-facing impact: for any compound shape (a prismatic part, a turned part, a housing with a boss and a counterbore), the output is a list of independent primitives that don't compose into a coherent solid. There's no concept of "this is the main body" versus "these are the features cut into the body." The build123d export path then has no body to subtract features from, so it falls back to either dropping the features or producing a stack of independent slabs. The pipeline has pieces of a top-down strategy scattered through the code (`detect_planar_pockets`, `detect_chamfers`, `detect_fillets`, slot detection, hole detection), but they're applied as independent bottom-up passes on the primitive list rather than as steps in a single coherent body-then-features workflow. ## Reproduction Run the pipeline on any compound mechanical sample (e.g. `samples/sample_plane_cyl.ply`, the `Merge_01_pc.ply` Revopoint scan) and inspect the report's primitive list. The list is a flat set of independent primitives; the report has no `body` / `features` structure. ## Expected The fitter should produce a report with at least: - One `body` primitive (or small set) representing the overall solid(s) of the object. - A `features` list representing the cuts / additions on each body (holes, counterbores, pockets, slots, chamfers, fillets). - The build123d export should then build the body, then cut the features into it. ## Actual Flat primitive list, no body/features structure, export produces a stack of independent slabs or a freeform mesh with no feature hierarchy. ## Suggested fix (not for me to implement) Add a top-down pass to `pc2cad.py` that runs after the analytic fit: 1. Find the largest single-body primitive (the one that explains the most inliers and is the most "enclosing" shape — a plane slab, a cylinder, etc.). 2. Tag it as the `body`. 3. Re-classify remaining primitives as feature candidates based on adjacency, inlier-count ratio, and intersection patterns with the body. 4. Pass the body + features to the build123d export path, which already has `extrude` / `revolve` for the body and the boolean ops (`cut`, `fuse`) for the features. ## Related - pc2cad#24 (single-plane extrude regression — adjacent symptom) - pc2cad#28-31 (render-tooling bugs from the same assessment cycle) - This is the strategy gap the user called out on 2026-06-20: "we need a strategy in order, to find the largest planar profile extrusions, find the largest whole shapes, detect holes, gouges, counterbores etc."
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#33
No description provided.