Skip to content

feat: add Loft primitive that morphs between two 2D cross-sections - #58

Open
hbehrensj wants to merge 2 commits into
Formsmith746:mainfrom
hbehrensj:feature/loft-shape
Open

feat: add Loft primitive that morphs between two 2D cross-sections#58
hbehrensj wants to merge 2 commits into
Formsmith746:mainfrom
hbehrensj:feature/loft-shape

Conversation

@hbehrensj

@hbehrensj hbehrensj commented Aug 12, 2026

Copy link
Copy Markdown

Summary

I built loftmorph as a standalone tool for lofting a
solid between two 2D cross-sections. Found SketchForge and wanted that as a real, parametric
primitive in the editor rather than an import-a-static-STL workaround — so this ports the
algorithm in as a new "Loft" shape next to Box/Cylinder/Gear.

Oval/Rectangle/Triangle/Pentagon/Hexagon on each end, independent size + rotation (top mirrors
how cone's Top Radius works independently of its base). Wired into every place "gear" touches.

Affects: storage (new loft* fields in .skf), export (STL/OBJ/STEP via the existing
boolean/export pipeline), and undo/redo (new fields added to the shape-equality check that backs
history dedup). No changes to grouping/import mechanics themselves.

Testing

  • npm run typecheck + test suite (new loftGeometry.test.ts, including a
    rotational-symmetry check that caught a real centering bug during development)
  • Manually tested: place, edit every property live, resize via gizmo, duplicate, undo/redo,
    use as a boolean hole, export STL and re-import it, save a project and reload the page

Notes

  • Known limitation: a strongly-rotated, non-round end whose top/bottom sizes differ can extend
    slightly past its nominal bounding box, so the resize gizmo won't always hug the mesh exactly
    in that combination. Cosmetic only — doesn't affect the generated geometry.
  • The toolbar icon is a placeholder.
  • I'm the author of both loftmorph and this port, so no licensing conflict contributing under AGPL.
  • Everything in my contribution was generated with Claude Code.

hbehrensj and others added 2 commits August 12, 2026 11:33
Ports the loft/morph algorithm from hbehrensj/loftmorph as a native
parametric shape, mirroring the existing "gear" shape's integration
pattern (toolbar entry, geometry builder, viewport render + boolean/
export dispatch, inspector panel, .skf format validation).

Bottom and top ends are each independently configurable: shape (Oval/
Rectangle/Triangle/Pentagon/Hexagon), size (bottom follows the shape's
own width/depth like every other primitive; top has its own absolute
width/depth, mirroring how cone's topRadius works independently of its
base), and rotation. Corner-anchored angle sampling keeps polygon
corners crisp regardless of segment count or which two shapes are
morphing between each other.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
gearGeometry.ts (the direct template for this file) has zero comments
across 240 lines; keep only the ones that prevent a real regression
(axis-swap/winding, why polygon ends aren't bbox-centered, and the
buildAngles corner-anchoring summary) and tighten those to a line or
two, per CONTRIBUTING.md's "keep comments short and useful".

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@hbehrensj hbehrensj changed the title feat: add Loft primitive that morphs between two 2D cross-sectionsFeature/loft shape feat: add Loft primitive that morphs between two 2D cross-sections Aug 12, 2026
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