Child of #17: auto-extract 2D profile from segmented planar/axial point regions (prismatic + turned parts) #22
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#22
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?
Parent
Child of #17 (mechanical reconstruction path, the core path of pc2cad). This issue scopes the profile extraction step that the existing reconstruction must perform before any
Sketch + extrudeorSketch + revolvecomposition can happen.Context
pc2cad's mechanical path needs to produce editable CAD solids from a point scan, not a triangle soup. For the dominant class of mechanical parts — milled/turned/cast pieces — the natural CAD representation is:
extrude()for prismatic 2.5D parts,revolve()for turned/rotational partsbuild123d and FreeCAD both expose this
Sketch + Location + extrude/revolveworkflow natively. The current pipeline already does primitive RANSAC fitting (plane, cylinder, sphere) and has some profile derivation inpc2cad.py, but the derivation is driven from cross-sections the user effectively supplies implicitly (or from primitives the user already has). For a scanning app — where the user has no CAD, only points — the profile must be recovered from the scan itself.What's missing
The gap between "I have a point cloud" and "I have a build123d
Sketchready to extrude/revolve":Profile detection on a planar segment. Given a set of points lying on (or very near) a plane — output of #11's hardened RANSAC — extract the closed 2D boundary of the region as a polygon or as a set of line/arc segments that map to a build123d
Sketch. This is the cross-section analysis step, but driven entirely by the points, not by a user cross-section.Axis detection for revolved parts. For turned parts (shafts, bosses, pulleys, lathe stock), the part is rotationally symmetric. Detect the axis of symmetry from the point cloud, then extract the meridional profile (a 2D curve in the plane containing the axis). This is the input to
revolve().Profile classification: prismatic vs revolved. Decide which sweep operation to emit. Heuristic: a part is revolved iff its point set is approximately axisymmetric (low variance of radial distance at each axial position, constant cross-section shape under rotation). Otherwise extrude.
Tolerance / underdetermined boundary handling. Real scans have noise, missing regions, and density variation (#12). The extracted profile must degrade gracefully: an open polyline, or a polygon with confidence intervals on each edge, not a brittle exact-curve fit that explodes on the first noisy scan.
Composition. Hand the recovered
Sketch+Location(plane for extrude, or axis for revolve) to the same exporter path that #6 unblocks for STEP/FCStd. The exporter must know whether to callextrude()orrevolve()based on the classification above.Out of scope (handled by siblings)
User-supplied sketches are explicitly out of scope: this is a scanning app. If the user already had the CAD, the workflow would be different.
Acceptance
pc2cad.py(or extracted to a sibling module) that, given a segmented planar/axial point region, returns: a build123dSketch, aLocation(plane for extrude, or axis + plane for revolve), and asweep_opfield ∈ {extrude,revolve}.Sketch + extrudefeature.Sketch + revolvefeature.pc2cad.pyend-to-end → STEP file opens in FreeCAD and shows a solid with one feature.tests/covering the three cases above.pointcloud-to-cad-guide.mddescribing the profile extraction step in the pipeline.Why this matters
The mechanical reconstruction path (#17) is the product. Without profile extraction, the path is stuck at "list of RANSAC primitives" — which is a description of a part, not an editable CAD model. Profiles + sweep operations are the bridge from description to editable solid. This issue is the missing link between the existing primitive fitter and the export path that #6 unblocks.
_freecad_import, prove no FreeCAD in export paths #46