Skip to content

3D-printing support: print-ready export + validation #85

Description

@krazyjakee

Background

MoGen's geometry is already fundamentally print-friendly: CSG output is watertight by construction (Manifold + clean_csg_output weld/degenerate-cull in crates/mogen-geom/src/cleanup.rs), and length units normalize to metres at parse time with mm/cm/m/km/in/ft/yd suffixes (crates/mogen-dsl/src/parser.rs), so millimetre-accurate authoring works today.

But the pipeline stops short of guaranteeing or producing a print-ready file. This issue tracks the optional features that would close that gap.

Gaps

  • Open primitivesplane, disc, curved_plane, spline_ribbon are non-manifold by design (fine for game assets, unprintable as a solid).
  • No print export format — GLB/FBX only; STL/3MF require external conversion.
  • No manifold validationvalidate_graph covers skinning/connectivity topology but never verifies the final mesh is watertight/manifold. is_closed_manifold() / is_csg_manifold() (crates/mogen-geom/src/csg.rs:146) exist but only gate the merge pass.
  • No wall-thickness check — thin features below a printer's nozzle minimum silently fail.
  • No self-intersection detection — Manifold avoids it for CSG, but pre-CSG sibling meshes can still overlap.

Proposed features (rough priority order)

  1. STL / 3MF exporter in mogen-export. STL is trivial (triangle soup); 3MF is the modern choice (units, colour, multi-object). Biggest single unlock.
  2. mogen check --print validation mode — surface non-manifold edges (edge shared by ≠2 tris), open boundaries, zero-area tris, and disconnected shells as diagnostics. Reuses existing manifold helpers instead of only gating merge.
  3. Minimum wall-thickness check — warn on thin features given a target nozzle diameter (SDF/ray-sampling heuristic).
  4. Print export mode that forces a single watertight shell — extend the existing merge_sibling_meshes CSG-union pass across the whole tree rather than scoped to same-material siblings.
  5. Open-primitive guard — error early when a print target uses plane/disc/etc. as visible surfaces.

Suggested first step

Feature (2) reuses existing diagnostic infrastructure and manifold helpers, and tells users why a model won't print before investing in the exporter (1).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions