Skip to content

feat(microscope-slide-hyperobject): explicit scale_comp parameters behind the legacy material injection - #108

Merged
aldoruizluna merged 2 commits into
mainfrom
feat/explicit-fit-params-microscope-slide-hyperobject
Oct 2, 2026
Merged

aldoruizluna merged 2 commits into
mainfrom
feat/explicit-fit-params-microscope-slide-hyperobject

Conversation

@aldoruizluna

@aldoruizluna aldoruizluna commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

What changed

Digital Twins MES, Phase 2 wave 2, lane W2-MAT. Owner ruling: "flag now, flip later". This PR is the commons side that lets yantra4d turn RENDER_MATERIAL_INJECTION off without losing function.

  • slide.scad: new explicit inputs scale_comp_x, scale_comp_y and scale_comp_z (unitless, default 1.0) drive the scale() around the slide body. The legacy mat_shrinkage_* and mat_clear_slide are now undef unless the platform injects them with -D. An injected value wins (_legacy_or()), so every render made with the flag on is unchanged. The legacy branch is commented REMOVE AT THE FLIP.
  • The library function slide_slot_width() gets the same precedence for fit_clearance_slide (mm, default 0) over mat_clear_slide. This cartridge renders no slot, so its manifest does not declare fit_clearance_slide. microscope-slide-holder declares it in its own PR.
  • mat_clear_press and mat_clear_loose were declared here but never read, so they are no longer declared.
  • slide.py (CadQuery twin) reads scale_comp_*, so both kernels agree for any explicit value. It never read mat_* and still does not, so its output with injection on is unchanged.
  • project.json: declares scale_comp_x, scale_comp_y and scale_comp_z (slider 0.9 to 1.1, step 0.001, labels in en/es/fr/pt, advanced visibility). README.md documents them.

GOC-1 mapping

  • The new ids pass the GOC-1 variables denylist; I checked them against generator-output.schema.json (exact list plus the prefixes mat_shrinkage_, mat_clear_ and thermo_). After the flip, shrinkage reaches this cartridge only as a geometry-named number in variables, and nothing is recorded in legacy_physical_inputs.
  • The manifest defaults equal the source literals: scale_comp_* = 1.0. With RENDER_INJECT_FULL_PARAMS on, the injected defaults leave the geometry unchanged (row A4 below).

Evidence

I rendered locally with OpenSCAD 2026.02.13 and --backend=Manifold. Geometry was compared as volume, AABB, body count and the sha256 of the sorted unique vertex set rounded to 1e-4, never as STL bytes. The rows cover slide_standard 0 to 4 (all 5 values; the cartridge has no presets):

Row Render Expected Result
A0 after, no material = before, no material 5/5 identical
A4 after, explicit defaults (scale_comp_*=1.0) = before, no material 5/5 identical
A1 after, bambu-tpu-95a injected (the full mat_*/thermo_* set, as yantra4d sends it) = before, TPU injected 5/5 identical
A5 after, sinterit-pa12-smooth injected = before, PA12 injected 5/5 identical
A2 after, explicit scale_comp=1.012/1.012/1.018 with no injection = before, TPU injected 5/5 identical (the explicit parameter carries the function)
A3 after, TPU injected plus explicit scale_comp=0.95 = before, TPU injected 5/5 identical (the injected value wins)

CadQuery twin, before vs after: identical at all 5 standards, with and without injected mat_*. The explicit scale_comp in CQ matches the SCAD TPU render (for example, standard 0 gives a volume of 2060.1353 mm³ and a bbox of ±38.456 × ±13.156 × ±0.509 mm in both).

y4d-spec check ./microscope-slide-hyperobject --render --require-openscad --parity --openscad-path libs --openscad-path .:

  • at the CI pin 3ff3736: cartridges=1 failures=0 notes=0 geometry=verified renders=2 presets=0 skipped=0 parity=1/1 ok
  • at the P2-S head (510efba, with the default-drift rule): the same, notes=0

CI status

Green on Linux CI (own runners) at the time of writing: manifest conformance (all cartridges) passed in 45s, render scope passed, and render (cartridges changed in this PR: microscope-slide-hyperobject) passed in 1m22s.

Deviations / notes

  • target_material is untouched; this cartridge never declared it. Removing it is the flip, which is the owner's decision.
  • Finding, out of scope here: the vendored copy of this library in microscope-slide-holder/libs/ already carries a single-polyhedron rib fix (a coincident-face union under Manifold) that this upstream slide_retention_rib() lacks.

🤖 Generated with Claude Code

aldoruizluna and others added 2 commits October 2, 2026 15:19
…hind the legacy material injection

Declare scale_comp_x/y/z (unitless, default 1.0) and read them in both
kernels. While yantra4d RENDER_MATERIAL_INJECTION is on, an injected
mat_shrinkage_* value still wins, so today's geometry is unchanged; the
legacy branch is marked for removal at the flip. The library function
slide_slot_width() gains the same precedence for fit_clearance_slide over
mat_clear_slide. mat_clear_press and mat_clear_loose were never read and
are no longer declared.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Aldo Ruiz Luna <aldo.ruiz.luna@gmail.com>
…sation parameters

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Aldo Ruiz Luna <aldo.ruiz.luna@gmail.com>
@aldoruizluna
aldoruizluna marked this pull request as ready for review October 2, 2026 22:26
@aldoruizluna
aldoruizluna merged commit aa06c71 into main Oct 2, 2026
6 checks passed
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