Repository navigation
feat(model): 3MF export + experimental 3D-print options - #43
Merged
Merged
Conversation
- assets::threemf: GLB triangles (stl::glb_mesh, transforms baked, Z-up) as a core-spec 3MF in metres; vertices shared by exact f32 equality, degenerate triangles left out; XML streamed into a deflated zip. - assets::print: write_meshes writes the STL and/or 3MF next to the GLB from one triangle read; ModelDone reports them as `meshes`. - three_mf in ModelOptions (not part of the cache key) and AssetExportModelRequest (serde default) in the real/mock backends and TS mirror/mock; samples regenerated. - CLI `dev export-model --3mf` (experimental), refused with --preset full. - Export dialog: "Also write a 3MF (experimental)" switch with badge, "Save as…" button, a line saying where the STL/3MF go. - zip 9 (deflate via flate2/zlib-rs only) in starorg-data. - Docs: user guide and addendum.
…/3MF - assets::print is a module: PrintOptions (scale none|fit-mm|ratio, bed, shrink to bed, drop small, solid + resolution, thicken, hollow + drain, pegs, split, multicolor, simplify, no weapons; all off by default, serde defaults, validate with needs-solid/needs-split checks) and the fixed pipeline apply() -> PrintOutput (parts with group labels, unit, layout, notes); write_meshes keeps working and always sits the model on the bed. - Shared Mesh (shared vertices, optional per-triangle group from the GLB node path), stl::glb_labeled_triangles, VoxelGrid API, Cut/Part types. - One file per feature with final signatures: scale.rs (factor, scale, sit_on_bed done; drop_tiny, bed_check stubs), voxel.rs, split.rs, color.rs (layout done), simplify.rs; model::strip_weapons stub. - threemf writes several objects as build items or one assembly, with display colours, in millimetre or metre units. - no_weapons is in ModelOptions::key (-noweapons); ModelDone carries notes. - Contract: one nested `print` object (serde default) on AssetExportModelRequest in the real and mock backends, TS mirror and mock; print notes in the export note; samples regenerated. - CLI: print flags on dev export-model (experimental, exit 2 when they do not go together or need --preset print / --stl / --3mf) and `dev print-glb <GLB> --out DIR` to run the pipeline on a GLB. - Export dialog: collapsible "3D print (experimental)" section with every control badged, bed size remembered, Save as disabled on a problem. - Spec docs/plans/specs/model-print.md (active), indexes, todo, guide.
strip_weapons drops gun mounts, guns, mining lasers, tractor beams, missile racks, missiles and bombs from the loadout before StarBreaker assembles the GLB; turret bodies, countermeasures, thrusters and paint stay. The export notes how many loadout parts were left out. The types come from the LIVE loadouts of 15 ships; real_weapons checks four.
…rimental) sit_on_bed centres x/y as well as putting the bottom at z = 0. bed_check turns a scaled model 90 degrees about Z when only that fits, shrinks it with shrink-to-bed (turned when that keeps it larger) or notes that it does not fit; real size in metres is not checked. drop_tiny welds corners, finds loose parts and leaves out those whose bounding-box diagonal at print size is under the limit. The pipeline now measures a fit size after small parts are dropped.
Garland-Heckbert QEM in pure Rust: link condition, no flips or slivers, open edges and group borders held by border planes, non-manifold vertices fixed, small open pieces never erased. Closed parts stay closed; parts within budget are unchanged.
- voxelize: conservative triangle/box rasterisation per z-slab (rayon), outside flood fill on bitsets after a 2-voxel closing, then ray-stabbing votes (seen along >= 3 of 6 axis directions) so hulls with openings fill instead of leaking into a thin shell; per-cell group labels (closest triangle); grids above 2^29 cells coarsen with a note. - extract / extract_where: well-composed fix-up (no edge/corner-only contacts), voxel faces on shared corners, clamped Laplacian smoothing that never flips a triangle: closed, outward, 2-manifold by construction. - thicken: opening residue away from rounded edges, dilated by t/2. - hollow: erosion by the wall, cavities under 1 mm3 kept solid, drain holes from each cavity's lowest point down through the bottom wall. - peg: holes across each cut at the most solid point of the cut face and a stand hole in the underside near the centre of mass, clamped so they never break through, with notes. - Bits helpers (dilate/erode/flood/components) for the split and colour steps; pipeline notes the coarsened voxel size (one line in mod.rs).
Cut the voxel solid with whole-grid axis-aligned planes into the fewest pieces that each fit the bed (fewest pieces, then fewest slivers, then least cut area; every plan scored when few, else per axis order), add 2 mm alignment pin holes 4 mm into each side of every cut when --peg is not given, name the pieces part1, part2, ... and lay them out side by side for the 3MF's separate build items.
…olour Classify Print shell triangles into hull, engine and glass from their GLB node paths (materials are only material_NN with MaterialMode::None). Without Make solid each group is its own 3MF part; with it, outer-surface voxels keep their group, glass and engine reach 1.2 mm in (glass > engine > hull) and each group is extracted as its own closed mesh. The 3MF stays one object of components with basematerials colours; the STL stays one mesh.
# Conflicts: # docs/plans/specs/model-print.md
# Conflicts: # docs/plans/specs/model-print.md
# Conflicts: # docs/plans/specs/model-print.md
- Split pieces keep their side-by-side layout: after scale's x/y centring each piece was centred alone (stacked at the origin). Each piece, with its colour parts, is now lowered on its own and the layout centred. - --peg without --split is accepted (stand hole only), in Rust, TS, UI and CLI help. - A note when simplify cannot reach its triangle budget. - Drop-small and split wording: bounding-box diagonal, alignment pins. - User guide model export section and spec status with real-data runs.
…rint cached GLBs in the worker
…f the bar; keep long job labels clear of Stop
…er; resizable finder panes
# Conflicts: # app/src/lib/contract/mock-dev.gen.json
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.
Summary
--3mf,--fit-mm,--scale-ratio,--bed,--solid,--hollow,--split, …) +dev print-glb.docs/plans/specs/model-print.md.Real runs
Known limits
Test plan