Add hole detection (blind and through) for mechanical parts #14
Labels
No labels
blocked:needs-decision
blocked:preflight
bug
in-progress
in-progress
lint-cleanup
needs-decompose
quickfix
triage-approved
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Mark/pc2cad#14
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Context
The user's primary use case for pc2cad is mechanical parts: scan → editable CAD. Mechanical parts almost always have holes (through-holes for fasteners, blind holes for tapped threads, counterbored holes for socket heads, countersinks for flat-head screws).
The current pipeline detects cylinders but doesn't reason about whether a cylinder is a hole (negative feature, subtracts material) or a boss/shaft (positive feature, adds material). Without that reasoning, the output CAD is missing one of the most common features.
The PLAN.md mentions feature detection in Milestone 2:
This issue is just the hole part of that milestone. Slots/pockets/bosses/fillets are separate issues.
Scope
Detection criteria
A fitted cylinder is a hole if:
r + epsilonfrom the axis lies inside the convex hull of the model — the hole is in the middle of material, not at an edge.A hole is through if both end-faces are flat AND the cylinder length equals the part thickness (within tolerance).
A hole is blind if only one end-face is flat AND the other end is open (no planar region).
A hole is counterbored if a second concentric cylinder with larger radius and shorter length is fitted nearby.
A hole is countersunk if a second concentric cone is fitted at one end.
CAD reconstruction
Once detected, holes must be applied as boolean cuts to the analytic solid, not just listed in the report:
Output
report["features"]["holes"]: list of{type: "through"|"blind"|"counterbored"|"countersunk", center, axis, radius, depth, ...}Acceptance
Shape.isValid())--detect-holes {off,auto,strict}defaulting toauto--hole-radius-min,--hole-radius-maxto constrain detectionWhy this matters
The user's primary workflow is "find the holes in this scanned part." Without hole detection, the analytic reconstruction is missing the most defining feature of a mechanical part. The user has explicitly said this — the scan in question has a counterbored through-hole that the current pipeline doesn't reconstruct.