code wiki / (root) / nx_preflight.nx

nx_preflight.nx

buildroot/runtime/nx_preflight.nx

9728 B244 linesdepth 6pulls 10 transitivereach 3 importersview sourcekind library
docsdependenciesstructsconstsfunctions

about

nx_preflight.nx -- bulletproof pre-print orchestrator. Composes every shipped pre-print sanity primitive into a single SAFE / WARN / UNSAFE verdict that gates G-code emission. Per NISHI_3D_PRINT_BULLETPROOF_PREFLIGHT_ROADMAP -- "push and play" equivalent of Bambu LiDAR/AI/loadcell + Klipper KAMP + Prusa loadcell preflight, sovereign substrate-native. Checks performed (this primitive's contract): 1. nx_mesh_is_manifold (watertight geometry) 2. nx_mesh_fits_machine (bbox <= build volume) 3. nx_polymer_validate_profile (temps within polymer envelope) 4. nx_flow_envelope_check (slicer flow <= min(machine, material)) On any UNSAFE: refuse to emit print-start command. On WARN: emit but surface the warning to operator. Per cardinal feedback-no-false-ok-substrate-honesty-audit: claiming "bulletproof" without ALL these checks IS the false-OK class. Future versions add G-code structural sanity, Moonraker ready-state, calibration freshness (queued P-BP-2..P-BP-6). Per cardinal feedback-thymus-sovereignty-audit-soma-germline: every check composes ONLY substrate primitives -- no Bambu/Prusa/ vendor APIs, no cloud lookups, no third-party services. license_tier: ORIGINAL

dependencies 6 imports · 3 importers

nx_syscalls.nx nx_mesh.nx nx_mesh_print_check.nx nx_machine_graph.nx nx_material_profile.nx nx_polymer_thermal.nx nx_preflight.nx nx_preflight_test.nx nx_print_session.nx nx_print_session_test.nx

imports: nx_syscalls.nxnx_mesh.nxnx_mesh_print_check.nxnx_machine_graph.nxnx_material_profile.nxnx_polymer_thermal.nx

imported by: nx_preflight_test.nxnx_print_session.nxnx_print_session_test.nx

structs

74struct NxPreflightResult

consts

38const NX_PREFLIGHT_SAFE: i64 = 0
39const NX_PREFLIGHT_WARN: i64 = 1
40const NX_PREFLIGHT_UNSAFE: i64 = 2
44const NX_PFR_OK: i64 = 0
45const NX_PFR_NOT_MANIFOLD: i64 = 1
46const NX_PFR_MESH_TOO_LARGE: i64 = 2
47const NX_PFR_BAD_THERMAL: i64 = 3
48const NX_PFR_FLOW_EXCEEDED_MACHINE: i64 = 4
49const NX_PFR_FLOW_EXCEEDED_MATERIAL: i64 = 5
50const NX_PFR_BAD_LAYER_HEIGHT: i64 = 6
51const NX_PFR_NULL_INPUT: i64 = 7
52const NX_PFR_LAYER_TOO_THICK: i64 = 8
53const NX_PFR_LAYER_TOO_THIN: i64 = 9
54const NX_PFR_N: i64 = 10
81const NX_PREFLIGHT_BYTES: i64 = 32
89const NX_Q14_TO_MM: i64 = 16384

functions

56func nx_pfr_name(r: i64) -> *u8
called by 1: main
91func nx_mesh_fits_machine(mesh: *NxMesh, machine: *NxMachineGraph) -> i64
122func nx_flow_envelope_check(line_width_q14: i64, layer_height_q14: i64,
called by 1: nx_preflight_check
157func nx_layer_envelope_check(layer_height_q14: i64,
called by 1: nx_preflight_check
178func nx_preflight_check(mesh: *NxMesh,