Add @vcad/sheet-metal package with unfold/refold and flat-pattern projection#181
Closed
Add @vcad/sheet-metal package with unfold/refold and flat-pattern projection#181
Conversation
Wires the foundation kernel into the app so users can see, select, and inspect a sheet-metal part. Lands the @vcad/sheet-metal TS package mirroring the Rust crate, IR variants for the two foundation ops, engine evaluation that bypasses the Solid pipeline (the WASM kernel doesn't yet need to know about sheet metal), a contextual side view showing panel/bend/area stats with K-factor provenance dots, and a live SVG flat-pattern view (red dashed = bend up, blue dashed = bend down). Includes a "Sheet metal U-channel" example doc that demos a 100×50×1mm aluminum base flange with two 25mm Up flanges. This is tier 1 of the UI plan in docs/design/sheet-metal.md: read-only flat-pattern peer view + property panel surface. Direct-manipulation flange gestures, the contextual Bend Strip, the bend-table editor tab, and bidirectional flat editing land in follow-up tiers. @vcad/sheet-metal mirrors the Rust crate exactly (Panel/Bend/ SheetMetalModel graph, base + edge flange ops, lossless unfold/refold, FlatPattern projection, tessellation). 24 tests pass including the round-trip-is-identity involution proof and the no-drift-under-10-cycles property test — the legendary architecture holds in the browser too. https://claude.ai/code/session_019XYMEQuLaAX45cqDtpyen7
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Vercel deployment failed because the explicit build chains in packages/app/vercel.json, vercel.json, packages/docs/vercel.json, and services/mcp/build.sh built @vcad/engine before @vcad/sheet-metal had been built. In production mode the package's exports map points to ./dist/index.d.ts (only "development" resolves to source), so tsc inside @vcad/engine couldn't find the type declarations: src/sheet-metal.ts(19,8): error TS2307: Cannot find module '@vcad/sheet-metal' or its corresponding type declarations. Insert @vcad/sheet-metal between @vcad/ir and @vcad/engine in all four build chains. Local repro of the Vercel order builds clean. https://claude.ai/code/session_019XYMEQuLaAX45cqDtpyen7
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Introduces a complete sheet-metal modeling kernel as a new
@vcad/sheet-metalpackage, porting the Rustvcad-kernel-sheetcrate to TypeScript. The implementation provides lossless bidirectional unfold/refold operations, flat-pattern projection for manufacturing, and 3D tessellation for rendering.Key Changes
New
@vcad/sheet-metalpackage with core data structures and operations:SheetMetalModel: A panel/bend graph tree structure representing bent sheet-metal partsFrame: 3D pose representation (origin + orthonormal basis) for both bent and flat configurationsPanel: Flat planar regions with outlines, holes, and dual-frame posesBend: Cylindrical connections between panels with angle, radius, and K-factor metadataUnfold/refold operations (
unfold.ts):unfold(): Computes flat-patternframeFlatfor all panels via tree walkrefold(): Reconstructs bentframeBentfrom flat configurationrefold(unfold(m)) == mwithin toleranceflatPatternFromModel(): Projects model into global 2D manufacturing coordinates with crease linestessellate(): Converts model to triangle mesh with bend-region geometry for 3D renderingBase flange operations (
base-flange.ts):baseFlangeRect(): Creates initial sheet-metal model from axis-aligned rectanglebaseFlangePolygon(): Creates model from arbitrary polygon outlineEdge flange operations (
edge-flange.ts):addEdgeFlange(): Extends model by adding flanges off existing panel edgesBend table system (
bend-table.ts):BendTable: Queryable(material, thickness, radius) → (K-factor, provenance)lookupbuiltinBendTable(): Curated defaults (Al-soft, Al-hard, Steel-mild, SS-304)lookupKFactor(): Intelligent fallback to closestR/tratio when exact match unavailableKFactorSource: Tracks provenance (builtin, shop, measured, manual) for UI visualizationEngine integration (
packages/engine/src/sheet-metal.ts):buildSheetMetalModel(): Walks node chain to construct model from IR opssheetMetalToMesh(): Converts model toTriangleMeshfor scene renderingEvaluatedPartfor flat-pattern view and property panel accessUI components (
packages/app/src/components/SheetMetalView.tsx):IR extensions (
packages/ir/src/index.ts):SheetMetalBaseFlangeRectOp: Creates rectangular base flangeSheetMetalEdgeFlangeOp: Adds edge flange to existing panelExample (
packages/app/src/data/examples/sheet-metal-bracket.vcad.ts):Notable Implementation Details
https://claude.ai/code/session_019XYMEQuLaAX45cqDtpyen7