Skip to content

openGrid: add Stack_Output so the interface layers can be exported separately - #137

Open
TheFou wants to merge 1 commit into
AndyLevesque:mainfrom
TheFou:feat/opengrid-stack-output
Open

openGrid: add Stack_Output so the interface layers can be exported separately#137
TheFou wants to merge 1 commit into
AndyLevesque:mainfrom
TheFou:feat/opengrid-stack-output

Conversation

@TheFou

@TheFou TheFou commented Jul 31, 2026

Copy link
Copy Markdown

Interface_Separation defaults to 0.1, which leaves the plates and the interface layers as separate bodies in the export. Setting it to 0 — which is what you want when the interface is meant to be printed directly onto the plate, with no dead layer in between — makes their faces coplanar, so OpenSCAD's implicit top-level union welds the whole stack into a single solid. color() is preview-only and does not survive that. The slicer then receives one body, and there is nothing left to assign a second filament to.

Measured on Full, Stack_Count = 3, STL export:

Interface_Separation Stack_Output Bodies in the export
0 All 1 — welded, unusable for multi-material
0 Plates Only 3
0 Interface Layers Only 2
0.1 All 5 — already separate

Stack_Output lets the two groups be generated separately and loaded back together in the slicer as one object with several parts, which preserves their absolute Z positions.

Why not just rely on lazy-union

On desktop OpenSCAD, exporting 3MF with lazy-union enabled already gives two objects (all the plates, and all the interface layers) even at separation 0, and Stack_Output can stay on All. That is documented in the header note as the preferred desktop route.

But it is not available everywhere, and in particular not on the MakerWorld customizer, which cannot pass OpenSCAD command-line flags. I checked a 3MF actually generated by the site for this model (Full, Stack_Count 2, Interface_Separation 0, Interface_Thickness 0.4):

  • 1 object, 1 part, extruder = 1
  • 1 connected body — the whole stack welded
  • no colour resources and no per-triangle colour attributes in the mesh
  • 2 filaments declared in the slicing profile, including #FF0000FF

So PMM does carry the red of color("red") into the slicing profile palette, but the geometry still comes out as a single part on extruder 1 — the palette follows, the assignment does not. Generating twice is the only route there.

Backwards compatibility

Stack_Output defaults to All, and with that default the output is byte-for-byte identical to main for all three board types at Stack_Count 2 and 3. It also has no effect at Stack_Count = 1.

Also in this change

A header note documenting the whole workflow, including the slicer-side setting people otherwise get stuck on: because the parts touch, the slicer sees no free surface between them and keeps extruding infill straight through the boundary. Enabling interface shells (Print Settings → Multimaterial → Advanced in OrcaSlicer 2.3+) forces solid shells between adjacent materials.

Repro

openscad -o welded.stl -D 'Full_or_Lite="Full"' -D 'Stack_Count=3' -D 'Interface_Separation=0' openGrid/openGrid.scad

On main this is a single connected body. With this change and Stack_Output="Plates Only" / "Interface Layers Only" it is 3 and 2 bodies respectively.

Validation

  • Default output unchanged: byte-for-byte identical to main for Full, Lite and Heavy at Stack_Count 2 and 3, and no effect at Stack_Count = 1.
  • Body counts: the table above, verified by connected-component decomposition.
  • lazy-union 3MF (Full, stack 3, separation 0): two objects, plates at z 0–21.2 and interface layers at z 6.8–14.4.
  • Both backends: --backend=Manifold and --backend=CGAL agree on body count, z ranges and volume for every Stack_Output value.
  • Configuration sweep: 26 configurations (three board types × three Stack_Output values × separation 0 and 0.1, plus Ironing mode, a 1×1 board, and Fill Space) all render without errors and produce non-empty geometry.

Note on merge order

This touches the same if (Stacking_Method == "Interface Layer") lines as #136, so whichever merges second will need a trivial conflict resolution on those few lines. The two changes are otherwise independent and either can be taken alone.

🤖 Generated with Claude Code

…parately

Interface Separation defaults to 0.1, which leaves the plates and the interface
layers as separate bodies. Setting it to 0 - which is what you want when the
interface is meant to be printed directly onto the plate - makes their faces
coplanar, so OpenSCAD's implicit top-level union welds the whole stack into a
single solid. color() is preview-only and does not survive that, so the slicer
receives one body and there is nothing left to assign a second filament to.

Stack_Output lets the two groups be generated separately (Plates Only /
Interface Layers Only) and loaded together in the slicer as one object with
several parts. It defaults to All, and the output is then byte-for-byte
identical to before for every board type and stack count.

This matters most on the MakerWorld customizer, which cannot pass OpenSCAD
command-line flags: a 3MF generated there contains a single object with a single
part on extruder 1 and no colour data in the mesh, so generating twice is the
only route. On desktop OpenSCAD, exporting 3MF with lazy-union enabled already
yields two objects and Stack_Output can stay on All.

Also documents the whole workflow in the file header, including the slicer-side
"interface shells" setting needed to get solid layers at the material boundary.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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