Skip to content

Add spherical bosses (domes) and seats (sockets) - #13

Merged
MasoudMiM merged 1 commit into
mainfrom
feature/spheres
Oct 30, 2026
Merged

MasoudMiM merged 1 commit into
mainfrom
feature/spheres

Conversation

@MasoudMiM

Copy link
Copy Markdown
Owner

Detect a full-revolution spherical CAP and rebuild it as editable PartDesign history. A convex cap standing on a face is a spherical boss (dome), a concave cap cut into a face is a spherical seat (socket). PartDesign has no sphere primitive, so the executor revolve-builds the cap: a circular-arc profile sketched on a vertical plane through the axis, spun 360 deg as a PartDesign::Revolution (additive dome) or PartDesign::Groove (subtractive seat), the apex placed exactly.

Scope: smooth domes, truncated (flat-topped) domes, and smooth sockets. Full spheres and flat-bottomed sockets are out of scope (left unassigned, per the unplanned doctrine).

Pole-cap tessellation artifact (the FreeCAD socket regression): the apex is read off the patch's high-elevation end (r_hi ~ 0 => the smooth pole, a real r_hi => a flat truncation). FreeCAD's tessellator peels a boolean-cut socket's pole off as a separate tiny cone cap, so the sphere patch stops just short of the pole and reads a small nonzero r_hi — previously misclassified as a flat-bottom socket and dropped. The pole cap (a cone whose apex sits at the sphere's geometric pole, opening back toward the rim) is now recognized so the socket is still detected and rebuilt smooth. A truncated dome's flat top, when the segmentation keeps it as a separate plane, is recorded as provenance and excluded from the base extent (like the cylindrical boss cap).

Changes

  • core/features.py — the sphere_boss / sphere_seat detection rule (+ _is_concave_sphere, _plane_hole_loops_on_sphere, _outer_loop_is_disk_on_sphere, pole-cap recognition).
  • core/history.py — the SphereOp plan op, dispatch, and the sphere-boss base-extent exclusion.
  • build.py — the _add_sphere revolve executor branch (Revolution / Groove).
  • core/solidify.py — the headless _sphere_cap (truncation-capable).
  • tests/test_sphere.py — 26 new tests (detection / planning / round-trip).
  • scripts/freecad_smoke_test.py — dome + socket smoke cases.
  • Docs: README (capabilities + limitations), CHANGELOG (Unreleased), ROADMAP (Phase 2 item 2 -> done).

Verification

  • Headless suite: 551 passed, 1 xfail (no regressions).
  • FreeCAD smoke test: ALL CHECKS PASSED — dome via Revolution (20435.62 vs 20435.63), socket via Groove (19564.38 vs 19564.37).

Closes Phase 2 item 2 (spheres) of the roadmap.

…ution spherical cap and rebuild it as editable PartDesign history.

A convex cap standing on a face is a spherical BOSS (dome), a concave cap cut into a face is a spherical SEAT (socket). PartDesign has no sphere primitive, so the executor revolve-builds the cap: a circular-arc profile sketched on a vertical plane through the axis, spun 360 deg as a PartDesign::Revolution (additive dome) or PartDesign::Groove (subtractive seat), the apex placed exactly. Smooth domes, truncated (flat-topped) domes, and smooth sockets are supported; full spheres and flat-bottomed sockets are out of scope.

The apex is read off the patch's high-elevation end (r_hi ~ 0 => the smooth pole, a real r_hi => a flat truncation). FreeCAD's tessellator peels a boolean-cut socket's pole off as a separate tiny cone cap, so the sphere patch stops just short of the pole and reads a small nonzero r_hi; that pole cap (a cone whose apex sits at the sphere's geometric pole, opening back toward the rim) is recognized so the socket is still detected and rebuilt smooth. A truncated dome's flat top, when the segmentation keeps it as a separate plane, is recorded as provenance and excluded from the base extent (like the cylindrical boss cap), so the base pad is not inflated to the top of the dome.

New: the sphere detection rule in features.py, the SphereOp plan op in history.py, the _add_sphere revolve executor branch in build.py, the headless _sphere_cap in solidify.py, 26 test_sphere.py tests (detection/planning/round-trip), and dome + socket smoke cases. Headless suite 551 passed; FreeCAD smoke test green.
@MasoudMiM
MasoudMiM merged commit 16b55f8 into main Oct 30, 2026
4 checks passed
@MasoudMiM
MasoudMiM deleted the feature/spheres branch October 31, 2026 01:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant