feat(pcb): evaluate PcbBoard to a real centered FR4 solid in the live app#228
Open
ecto wants to merge 1 commit into
Open
feat(pcb): evaluate PcbBoard to a real centered FR4 solid in the live app#228ecto wants to merge 1 commit into
ecto wants to merge 1 commit into
Conversation
… app
The merged board-solid work added PcbBoard evaluation to vcad-eval / the TS
evaluator, but the CRDT materializer still emitted `CsgOp::Empty` for a board
node, so the live app never reached it — boards rendered only via the
`PcbBoardBodies` data-mesh workaround.
- materializer: emit a real `PcbBoard` op (mirroring EmbroideryPattern) so the
kernel extrudes a genuine slab; keep `doc.pcb` for the legacy fallback.
- vcad-eval, vcad-kernel-wasm `evaluate_node`, and TS `evaluate.ts`: center the
extruded slab on z=0 so its top lands at +thickness/2, where PcbScene draws
the copper (layerZ) and where the legacy PcbBoardMesh sat.
- ViewportContent: `PcbScene showBoard={false}` and gut `PcbBoardBodies` to the
doc.pcb-only legacy path, so the kernel part is the single slab (no z-fight).
- materials: resolve the board's `__pcb_fr4__` key to FR4 green (#0d5a2d).
- add a vcad-eval test asserting a board evaluates to a non-empty, centered solid.
Regenerated kernel WASM artifacts.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
What
Makes a PCB board a genuine FR4 solid in the live app path (Task 1 from the modeless-PCB follow-up), not just a data-only placeholder rendered by a workaround.
The merged foundation (#227) added PcbBoard evaluation to
vcad-evaland the TS evaluator, but the CRDT materializer still emittedCsgOp::Emptyfor a board node — so the live app never reached that code, and boards only appeared via thePcbBoardBodiesdata-mesh workaround (and were invisible in STEP export / ray tracing).Changes
crates/vcad-app/materializer.rs— emit a realPcbBoardop (mirroring theEmbroideryPatterncase) so the kernel extrudes a genuine slab.doc.pcbis still set for the legacygetNodePcbfallback. (This is the change that actually activates the board solid in the app.)vcad-eval/evaluate.rs,vcad-kernel-wasmevaluate_node(the requested VCode-path arm, with cutouts noted TODO), and TSengine/evaluate.ts— the kernel extrudes from z=0, so shift the slab down bythickness/2. The top surface now lands at+thickness/2, exactly wherePcbScenedraws the copper (layerZ = thickness/2 + …) and where the legacyPcbBoardMeshsat.ViewportContentrenders<PcbScene showBoard={false} />, andPcbBoardBodiesis gutted to only thedoc.pcb-only legacy path. The kernel part is now the single source of the slab — no z-fighting/doubling, focused or not.data/materials.ts— resolve the board's__pcb_fr4__material key to FR4 green (#0d5a2d); previously unresolved → board rendered default white.vcad-evalunit test asserting a board evaluates to a non-empty solid centered on z=0 (also covers export-non-empty).Verification
Built and run locally. Verified against the running app's actual Three.js scene + evaluated meshes:
z ∈ [-0.8, 0.8]for a 1.6 mm board (was[0, 1.6]); matches the copper plane.rgb(0.051, 0.353, 0.176)=#0d5a2d.PcbBoardBodiesreturning null for real PcbBoard nodes; the ghosted mechanical box stays at opacity 0.16.cargo test --workspace,npm test --workspaces,npm run build -w @vcad/app, andcargo clippy/cargo fmton the changed crates all pass.Note: the only
cargo clippy --workspace -- -D warningsfailures are pre-existingneedless_borrowlints in the untouchedvcad-desktopcrate (newer clippy 1.95.0); my crates are clean. Framed 3D screenshots were unreliable in the headless preview (on-demand frameloop + transparent canvas), so the board appearance was verified by reading the rendered Three.js material/geometry directly rather than by pixel capture.🤖 Generated with Claude Code