Repository navigation
Expose explicit results for unsupported PCB folds - #6
Merged
Merged
Conversation
This was referenced Oct 1, 2026
Merged
Collaborator
|
Thank you for your contribution! 🎉 PR Rating: ⭐⭐⭐ Track your contributions and see the leaderboard at: tscircuit Contribution Tracker |
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.
Unsupported PCB folds and rigid placements in bend zones are expected geometry limitations, but consumers currently have to catch arbitrary exceptions to keep a design renderable. Add explicit shared folding results so renderers can retain flat geometry only for known limitations while unexpected failures still reject.
PcbFoldIssue,PcbFoldError, andPcbFoldResult<T>, with stable issue codes and optional bend IDs. Existing strict APIs preserve their error messages.tryCreatePcbFoldandtryFoldSurfaceMesh, including legacy full-cross-section validation that occurs during surface deformation.foldRigidMesh/tryFoldRigidMesh. Validate an optional PCB mount separately from model extents, so CAD offsets cannot conceal an invalid mount.tryFoldStiffenerMeshfor already-created flat meshes, preserving the original outline-average anchor without duplicate extrusion.Supports the explicit fallback implementation in tscircuit/circuit-json-to-gltf#230 for tscircuit/tscircuit#5277. Consumers can choose their rendering/reporting policy; flex-utils does not log or automatically select flat geometry.
Validation:
bun testpasses all 24 tests (1,329 assertions); typecheck and build pass. Tests cover structured diagnostics, unexpected-error propagation, legacy surface failures, separately validated offset CAD mounts, rigid positions/normals/metadata, unchanged input geometry, and stiffener reuse. The new commontoMatchPngSnapshot/PoppyGL snapshot shows a valid board and blue CAD folded together while the invalid red bend-zone placement stays flat; the image was visually inspected. Existing snapshots remain unchanged.