Cut faces: the cut green for uncoloured tools, and keepMinuendColor - #173
Merged
Merged
Conversation
- An uncoloured subtrahend now paints the faces it exposes the reference's cut green (#9DCB51, what its preview shows and its colour-preserving render keeps) instead of the default geometry colour, so a cut through an uncoloured part reads as a cut. Recorded against the tool's runs before the merge; the merge looks even when every operand's colour agrees. - Evaluator::keepMinuendColor (bindings: keep_minuend_color=True) makes difference() paint cut faces with the minuend's colour instead -- the option OpenCSG cannot offer (openscad/openscad#4798). Each minuend part is differenced on its own, its cut-face runs re-minted under fresh IDs carrying that part's colour, then the parts are unioned. A union() built in this mode remembers what it merged (ColoredBody::mergedFrom, carried through transforms, color() and the cache restamp), so a union of coloured parts cuts each in its own colour. Cache keys are prefixed per mode. Off by default. BelfrySCAD #412. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Y9HJERiDZrsAb5tgmwdqU6
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.
Two halves of BelfrySCAD/BelfrySCAD#412's follow-up, both verified against OpenSCAD 2026.02.01.
Parity: uncoloured tools paint the cut green. The reference paints faces exposed by an uncoloured subtrahend its CGAL back-face green (#9DCB51) — in preview, and kept by its colour-preserving render (measured in a 3MF export). We painted them the default geometry yellow, so a cut through an uncoloured part could not be seen as a cut. The green is now recorded against the tool's runs before the merge, and the merge looks even when every operand's own colour agrees. A coloured tool still paints its cut with its own colour.
Evaluator::keepMinuendColor(Evaluator(keep_minuend_color=True)in the bindings):difference()paints its cut faces with the minuend's colour instead. Upstream closed the request (openscad/openscad#4798) because OpenCSG preview is pixels in a frame buffer; we do real CSG and know every triangle's provenance. Since (A ∪ B) − S = (A − S) ∪ (B − S), each minuend part is differenced on its own, its cut-face runs re-minted under fresh IDs carrying that part's colour, then the parts are unioned. Aunion()built in this mode remembers what it merged (ColoredBody::mergedFrom, carried through transforms,color()and the cache restamp), sodifference() { union() { red; blue; } tool }cuts red on the red side and blue on the blue side. Cache keys are prefixed per mode so the two never serve each other's bodies. Off by default: a viewer option, not a language feature.Tests: cut green (three cases), keep mode (single colour, per-part exact colours checked by triangle position, transform/colour carried over the union, cached union restamped with its parts, cache keyed apart), plus a bindings test. Full suite 1257/1257, bindings 42/42.
CLAUDE.mdupdated. 1.19.3 → 1.20.0.🤖 Generated with Claude Code
https://claude.ai/code/session_01Y9HJERiDZrsAb5tgmwdqU6