nx_estimate.nx
buildroot/runtime/nx_estimate.nx
about
nx_estimate.nx -- pre-print operator visibility (filament + time).
Closes the operator question "is this a 10-min print or 18 hours?"
BEFORE committing to a slice + upload. Industry slicers show
time + filament in their preview pane; substrate provides the
same info without the full slice cost.
Algorithm (rough but fast, sub-millisecond):
1. Compute mesh bbox volume (mm³)
2. Estimate solid printed volume = bbox × (perim_factor + (1 -
perim_factor) × infill_pct / 100)
3. Filament_mm = solid_volume / filament_cross_section_mm²
4. Print_minutes = solid_volume / typical_flow_mm³/s / 60
More accurate version (queued v2): run nx_print_session_run + read
emitter.E_acc_q14 + count G-code lines. v2 is exact but slow;
v1 is rough but instantaneous (operator can call BEFORE deciding
to commit to the full slice).
Verdicts surface operator-actionable warnings:
OK -- print is reasonable
WARN_LONG -- > 24h estimated (operator should reconsider scope)
WARN_FIL -- > 250m estimated (typical PLA spool is ~330m for 1kg)
WARN_TINY -- < 1g of filament (probably too small to print)
Per [[feedback-engineering-sciences-bits-up-3d-print-first]]:
pre-print visibility is operator's right; substrate composes
nx_mesh bbox + nx_gcode_extrude filament-cross-section helper to
answer without third-party slicer dependency.
license_tier: ORIGINAL
dependencies 6 imports · 1 importers
imports: nx_syscalls.nxnx_mesh.nxnx_mesh_print_check.nxnx_machine_graph.nxnx_material_profile.nxnx_gcode_extrude.nx
imported by: nx_estimate_test.nx
structs
| 63 | struct NxPrintEstimate |
consts
| 39 | const NX_MAGIC_1440: i64 = 1440 |
| 40 | const NX_MAGIC_250000: i64 = 250000 |
| 42 | const NX_EST_Q14: i64 = 16384 |
| 46 | const NX_EST_OK: i64 = 0 |
| 47 | const NX_EST_WARN_LONG: i64 = 1 |
| 48 | const NX_EST_WARN_FIL: i64 = 2 |
| 49 | const NX_EST_WARN_TINY: i64 = 3 |
| 50 | const NX_EST_ERR_INPUT: i64 = 4 |
| 70 | const NX_ESTIMATE_BYTES: i64 = 32 |
functions
| 52 | func nx_est_verdict_name(v: i64) -> *u8 called by 1: main |
| 81 | func nx_estimate_print(mesh: *NxMesh, |