code wiki / _hdl_build / nx_print_dispatch.nx
nx_print_dispatch.nx source
↩ module page · 23 lines · 1496 B
1// nx_print_dispatch.nx -- LIB: the MULTI-MATERIAL print dispatcher (3D-printing workstream R1-unify). ONE
2// entry point -- "emit this geometry in THIS material" -- routes by material to the right toolpath emitter:
3// FILAMENT -> nx_fdm_gcode (hot hotend, sub-mm), concrete -> nx_paste_gcode (cold paste), steel_waam ->
4// nx_metal_gcode (arc + cooling dwell). Materials with no emitter yet (clay, steel_dmls) and unknown ids
5// return 0 -- HONEST refusal, never a wrong/unsafe emit. The unification that makes "3D printing in all
6// materials" a single capability. license_tier: ORIGINAL
7import "nx_fdm_gcode.nx"
8import "nx_paste_gcode.nx"
9import "nx_metal_gcode.nx"
10import "nx_print_material.nx"
11import "nx_food_science.nx"
12import "nx_seg_store.nx"
13import "nx_syscalls.nx"
14
15// emit the w x d x h wall in `mat_id`; returns byte length, or 0 if the material is unknown / has no emitter.
16func pd_emit(prefix: *u8, mat_id: *u8, w: i64, d: i64, h: i64, out: *u8) -> i64 {
17 let fam: *u8 = sys_mmap(24)
18 if pm_field_str(prefix, mat_id, 1, fam) == 0 { return 0 } // unknown material id
19 if pm_streq(mat_id, "concrete" as *u8) == 1 { return pg_emit(prefix, w, d, h, out) }
20 if pm_streq(mat_id, "steel_waam" as *u8) == 1 { return mg_emit(prefix, w, d, h, out) }
21 if pm_streq(fam, "FILAMENT" as *u8) == 1 { return fg_emit(prefix, mat_id, w, d, h, out) }
22 return 0 // modeled-only (clay/dmls): no emitter yet
23}