FEA-driven infill for FDM prints (formerly "Smart Infill Generator").
Web tool: load a 3D-printable model, define loads and constraints by picking surfaces, run a structural analysis and density optimization entirely in the browser, and export an OrcaSlicer/Bambu Studio project 3MF where each region of the part gets the infill density the loads actually demand.
- docs/ — technical documentation: Theory & Engineering Reference and Verification & Validation Manual
- DESIGN.md — full design decisions and build plan
- PHASE1_RESULTS.md — solver engine benchmarks/validation
cd web
npm install # first time only
npm run dev # opens on http://localhost:5173The app is laid out like an instrument ("Werkbank" design): a top bar with the part chip and Settings, a numbered step rail (the orange carriage marks where you are), a panel showing only the active step, the viewport (view modes top-center, result controls riding on the view itself, section plane bottom-left), a results dock on the right after an optimization, and a status strip with live solver telemetry.
Workflow in the app:
- Model — drop an STL or 3MF (units mm). Coarse tessellations are subdivided internally (~1/60 of the diagonal, 160k-triangle budget) so deformed shapes can actually show curvature; exports always carry the original mesh. Adjust the surface-detection angle if patches come out too coarse/fine. An axis gizmo (bottom-right) shows the orientation; supports are marked with classic FEA triangles. Parallel projection throughout.
- Boundary conditions — add Fixed / Elastic / Slide / Force / Pressure conditions, then arm Pick surface or Brush (below the condition list) to assign surfaces to the highlighted one. Orbiting is always active; Esc or clicking another step disarms the tool. Elastic is a Winkler foundation (bedding modulus k in N/mm³, σ = k·u — foam ~0.1, rubber pad ~2, printed-plastic mount ~50–500, bolted steel ≥ 5000): use it instead of Fixed when the real mount is compliant — a rigid Fixed patch artificially stiffens the part and concentrates stress at the patch edges. (Self-weight exists in the engine but is hidden in the UI — negligible for desktop plastic prints.)
- Properties — material presets (editable in ⚙ Settings, persisted per
browser) plus the print settings the WHOLE analysis shares: perimeters ×
line width (the solid skin; the perimeter count is also written into the
exported 3MF as
wall_loops), infill pattern, and the uniform infill % "as printed". Analysis resolution lives here too, with voxel snapping: the cell size snaps to wall/k so the printed skin is resolved by an exact integer number of cell layers (the panel shows the resulting h and k, and warns when the skin is only one cell). TheMeshview shows the actual voxel grid the solver runs on — its legend can tint the skin cells, and with the Section on, the mesh view drops WHOLE cells on the far side of the plane (voxel-true cut) so the interior cells and the modeled skin thickness stay inspectable instead of a hollow planar slice. - Verify —
Check setupanimates any remaining rigid-body freedom.Solve onceanalyzes either As printed — skin solid, interior at the uniform infill through the calibrated E(ρ) curve; this turns the tool into a general FDM-FEA: mass at the print settings, max deflection and the min safety factor (worst of material vs layer adhesion, the dock states which one governs) land in the results dock — or Solid material (fully dense E₀, the CAD-ideal reference: run both to see what printing costs you). Either way the run lands in the Results view, where review happens on the viewport itself: the result field picker sits right under the view tabs (displacement, three safety factors — material σₜ/σᵥM, layer adhesion σₜᶻ vs tension across the layers, and the worst-case min of both; graded infill's allowables scale with the same E(ρ) law as its stiffness, inverted colormap so red marks the critical low —, stress von Mises / principal σ₁σ₂σ₃ / σxx/σyy/σzz / τxy/τyz/τzx in MPa, strain equivalent + components; cell-center values mapped to the surface), ▶ Play deflection (0→max loop) bottom-center, and the legend carries the click-to-edit color scale, a mark min/max toggle, and the click-to-edit exaggeration factor. A section plane (gizmo to move/rotate, Flip, X/Y/Z presets) cuts through any view with stencil-filled caps, so the part and the analysis mesh read as solid at the cut. - Optimize infill — pick a goal: Stiffest at budget (classic — max
stiffness at a given mean infill) or Match uniform stiffness (the
dual: the LIGHTEST design as stiff as a uniform X% print — a few
warm-started passes search the needed budget; the card then leads with
"same stiffness as X% uniform: −N% weight"). Then choose Graded
(several discrete densities) or Binary (hollow/solid): in binary mode the interior is either the
printability floor (default 5%) or 100% solid — the optimizer runs
SIMP-penalized (p=3) so the design converges black/white, the dense
regions slice as solid fill (optionally pinned to rectilinear or
concentric via the modifiers'
sparse_infill_pattern), and the comparison still uses the calibrated pattern curve. Then pick an infill budget (the target MEAN interior density — same scale as your slicer's uniform infill setting; walls/shells come on top — initialized from the Properties infill so the flow reads "here's your print, now beat it"), region smoothing, and number of density levels; skin and pattern come from Properties (step 3). Levels are auto-placed from the optimized field: the bottom one is pinned at the printability floor ("just so it prints"), the load-bearing ones land high (the convex E(ρ) law makes dense infill stiffer per gram), and the assignment re-meets your mass budget after quantization. Floor, cap, and a fixed manual level list (use the densities you have calibration data for) are editable in ⚙ Settings. The evolving dense-core shape is shown live each iteration; the loop stops on a design-stationarity criterion (iteration cap is only a safety net). The card reports the headline comparison — "vs X% uniform infill at the same weight: +Y% stiffer" — plus stiffness vs solid, mass, and max deflection. The run lands in the Density view with a 25% cutaway by default; the slider sweeps the threshold, and the Regions view has a per-region visibility list. - Export —
.3mfproject (part + nested modifier volumes withsparse_infill_densityset; the object carries the base density and thewall_loopscount the analysis assumed — modifiers override ONLY density, so walls inherit cleanly) for OrcaSlicer/Bambu Studio, or a.zipof modifier STLs for any slicer.
A "Log for nerds" drawer (toggle in the status strip) streams the raw telemetry: voxel grid stats, RBM check results, MGCG iterations/residuals, and one line per optimizer iteration (compliance, mean infill, design change, inner CG effort) — with live convergence charts for compliance, design change vs the 0.005 stationarity threshold, inner CG iterations, and the solver residual curve.
crates/filasim-core Rust engine: STL/3MF I/O, winding-number voxelization,
segmentation, matrix-free multigrid FEA (mixed precision),
BC attachment, RBM checks, SIMP optimizer, bins, marching
tetrahedra, zip + Orca/Bambu 3MF writer
crates/filasim-wasm wasm-bindgen API consumed by the web worker
web/ Vite + React + three.js app
Prereqs: Rust (GNU host works on Windows), Node 18+, wasm-pack.
cargo test -p filasim-core # 24 tests
cargo run --release --bin bench # native numbers
wasm-pack build crates/filasim-wasm --target web --out-dir ../../web/src/wasm
node smoke-wasm.mjs # full-pipeline smoke
cd web && npm run build # production buildRun before a major push — one command, one green/red verdict:
node scripts/preflight.mjs # cargo test + regbench --check + wasm smoke (+ fmt/clippy advisory)Hard gates (fail the run): cargo test, regbench --check, the wasm smoke test.
Advisory (reported, never block): cargo fmt --check, cargo clippy.
regbench is the physics-and-speed regression harness (crates/filasim-core/src/bin/regbench.rs). It runs the voxelizer, a Timoshenko cantilever, the SIMP optimizer, and the beam suite — a 64×8×4 mm cantilever in tension, bending, and 6-mode modal, as solid and uniform 30 % infill, at two mesh sizes. Its QUALITY metrics fail --check if the physics drifts past --tol (default 0.5 %); INFO timings/iteration counts are reported with a delta but never fail. Regenerate the committed baseline after an intentional physics change:
cargo run --release -p filasim-core --bin regbench -- --save crates/filasim-core/tests/regbench-baseline.tsvThe strongest check is the mesh-independent solid↔infill ratio: because both share a mesh, discretization cancels and the ratio must equal the exact E(ρ)=x^1.5 / mass-x closed form (deflection ×6.086, frequency ×0.740 at x=0.3).
- Phases 1–4 of DESIGN.md are implemented and tested (engine: 24 tests; full pipeline smoke incl. optimization quality: binned layout measured ~14–16 % stiffer than uniform infill at equal mass on the cantilever fixture).
- The exported 3MF opens in a real OrcaSlicer install (manual tests
2026-06). Final format decision from those tests: modifiers override
ONLY
sparse_infill_density— the sample'swall_loops=0strips perimeters where a modifier touches the surface, so no wall keys on modifiers. The PART (object level) carrieswall_loops= the in-app perimeter count, keeping the print consistent with the analysis skin. - Single-threaded WASM: optimization at Preview resolution takes ~½–2 min depending on part size (live density view while it runs). wasm threads are the planned next multiplier (~5–8×).
- Thin-shell jagged parts (Benchy-class) need 170–290 MGCG iterations at the presets — the cap is 600 (2× margin), and hitting it is a notice with the best-available approximation shown, never a hard error. Measured 3DBenchy solve times (native, 16 threads): 1.2 s / 3.1 s / 12 s at preview/normal/fine; single-thread browser is ~10× that.
- PrusaSlicer-flavor 3MF writer, golden FEA comparisons, anisotropy, and STEP import remain per DESIGN.md.
- Multi-mesh 3MF imports analyze the largest body only (warned in-app).
- Imports containing several disconnected bodies raise an in-app warning: separate bodies are never joined by the solver — they only fuse where voxelization bridges sub-cell gaps. Internal cavity shells (hollow parts) are recognized and don't count as extra bodies.
AGPL-3.0-only — see LICENSE. Free to use, modify, self-host, and redistribute; if you distribute it or offer it over a network, your version's complete source must be available under the same terms.
Want it inside closed-source software? Commercial exceptions are available — see COMMERCIAL.md. Contributions require the CLA in CONTRIBUTING.md, which also documents the strict dependency license policy (no third-party copyleft in the core — it would break the dual-licensing model; enforced via deny.toml).
The project name/logo are trademarks and not covered by the code license.