code wiki / _hdl_build / nx_matstruct.nx
nx_matstruct.nx
buildroot/runtime/_hdl_build/nx_matstruct.nx
about
nx_matstruct.nx -- ★THE STRUCTURAL MATERIAL REGISTRY: what a part is MADE OF, and what that implies.
★THE GAP THIS CLOSES (seq1417, measured 2026-07-30): the ecosystem HAS a real structural primitive --
nx_stress computes sigma = F/A in integer Pascals and returns SEALED verdicts SAFE/WORKING/YIELDED/
FRACTURED -- but it imports nx_material_profile.nx and inherits ITS enum, which is the SLICER'S FILAMENT
REGISTRY (PLA, PETG, ABS, ASA, PC, TPU, NYLON, PA-CF, PEEK, carrying hotend temps and retraction).
So the entire structural-material universe was 3D-PRINTER FILAMENT. 'This bracket is 1018 steel' was
INEXPRESSIBLE, and an underbuilt verdict on a car was impossible no matter how good the geometry got.
★★WHY THIS IS A NEW ORGAN AND NOT SIX MORE ROWS IN NX_MAT_*: that enum is OWNED BY THE PRINT LANE and
is backed by a struct of hotend temperature, cooling and pressure advance. Adding steel to it would owe
a hotend temperature for steel. A filament class and a structural-material class are DIFFERENT THINGS
THAT SHARE A NAME; binding a general primitive to a domain-specific registry was the category error.
This registry keeps the print lane's data intact and simply stops being the only answer.
★★★NOTHING IS STRIPPED (rule 25 -- the answer is always better data, never fewer options): indices 0..8
ARE the nine filaments, in nx_stress's exact order, carrying its exact shipped yields and ultimates, so
this is a strict SUPERSET and a caller can migrate by index. T6 proves that correspondence value by
value against the literals nx_stress ships, so a transcription slip cannot pass.
nx_matstruct selftest
license_tier: ORIGINAL expect_exit: 0 No hw writes (Rule 26).
dependencies 1 imports · 0 importers
imports: nx_gate_verdict.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 24 | const MS_MAGIC_1240: i64 = 1240 |
| 25 | const MS_MAGIC_3500: i64 = 3500 |
| 26 | const MS_MAGIC_1270: i64 = 1270 |
| 27 | const MS_MAGIC_2100: i64 = 2100 |
| 28 | const MS_MAGIC_1040: i64 = 1040 |
| 29 | const MS_MAGIC_2200: i64 = 2200 |
| 30 | const MS_MAGIC_1070: i64 = 1070 |
| 31 | const MS_MAGIC_2300: i64 = 2300 |
| 32 | const MS_MAGIC_1200: i64 = 1200 |
| 33 | const MS_MAGIC_1210: i64 = 1210 |
| 34 | const MS_MAGIC_1140: i64 = 1140 |
| 35 | const MS_MAGIC_2000: i64 = 2000 |
| 36 | const MS_MAGIC_1300: i64 = 1300 |
| 37 | const MS_MAGIC_7000: i64 = 7000 |
| 38 | const MS_MAGIC_1320: i64 = 1320 |
| 39 | const MS_MAGIC_3600: i64 = 3600 |
| 40 | const MS_MAGIC_7870: i64 = 7870 |
| 41 | const MS_MAGIC_205000: i64 = 205000 |
| 42 | const MS_MAGIC_7850: i64 = 7850 |
| 43 | const MS_MAGIC_4140: i64 = 4140 |
| 44 | const MS_MAGIC_2700: i64 = 2700 |
| 45 | const MS_MAGIC_68900: i64 = 68900 |
| 46 | const MS_MAGIC_6061: i64 = 6061 |
| 47 | const MS_MAGIC_2680: i64 = 2680 |
| 48 | const MS_MAGIC_70300: i64 = 70300 |
| 49 | const MS_MAGIC_5052: i64 = 5052 |
| 50 | const MS_MAGIC_7100: i64 = 7100 |
| 51 | const MS_MAGIC_168000: i64 = 168000 |
| 52 | const MS_MAGIC_1810: i64 = 1810 |
| 53 | const MS_MAGIC_45000: i64 = 45000 |
| 54 | const MS_MAGIC_4430: i64 = 4430 |
| 55 | const MS_MAGIC_114000: i64 = 114000 |
| 56 | const MS_MAGIC_1000000000: i64 = 1000000000 |
| 57 | const MS_MAGIC_7870000000: i64 = 7870000000 |
| 58 | const MS_MAGIC_2700000000: i64 = 2700000000 |
| 61 | const MS_FAM_POLYMER: i64 = 0 |
| 62 | const MS_FAM_STEEL: i64 = 1 |
| 63 | const MS_FAM_ALUMINIUM: i64 = 2 |
| 64 | const MS_FAM_IRON: i64 = 3 |
| 65 | const MS_FAM_MAGNESIUM: i64 = 4 |
| 66 | const MS_FAM_TITANIUM: i64 = 5 |
| 69 | const MS_SAFE: i64 = 0 // below half yield -- ample margin |
| 70 | const MS_WORKING: i64 = 1 // [yield/2, yield) -- the design range |
| 71 | const MS_YIELDED: i64 = 2 // [yield, ultimate) -- permanent deformation |
| 72 | const MS_FRACTURED: i64 = 3 // at or past ultimate |
| 73 | const MS_UNKNOWN: i64 = 4 // not in the registry -- REFUSED, never guessed |
| 75 | const MS_NM: i64 = 16 // materials modelled -- honest, and QUERYABLE |
| 76 | const MS_S: i64 = 5 // row: family, density kg/m3, yield MPa, ultimate MPa, modulus MPa |
| 77 | const MS_BAD: i64 = 0 - 1 |
| 78 | const MS_MPA: i64 = 1000000 // MPa -> Pa, applied at the accessor so the TABLE stays readable |
functions
| 82 | func ms_table(T: *i64) -> i64 called by 1: main |
| 107 | func ms_count() -> i64 { return MS_NM } called by 1: main |
| 108 | func ms_ok(m: i64) -> i64 { if m < 0 { return 0 } if m >= MS_NM { return 0 } return 1 } |
| 109 | func ms_family(T: *i64, m: i64) -> i64 { if ms_ok(m)==0 { return MS_BAD } return T[m*MS_S] } |
| 110 | func ms_density(T: *i64, m: i64) -> i64 { if ms_ok(m)==0 { return MS_BAD } return T[m*MS_S+1] } |
| 111 | func ms_yield_mpa(T: *i64, m: i64) -> i64 { if ms_ok(m)==0 { return MS_BAD } return T[m*MS_S+2] } |
| 112 | func ms_ult_mpa(T: *i64, m: i64) -> i64 { if ms_ok(m)==0 { return MS_BAD } return T[m*MS_S+3] } |
| 113 | func ms_mod_mpa(T: *i64, m: i64) -> i64 { if ms_ok(m)==0 { return MS_BAD } return T[m*MS_S+4] } |
| 115 | func ms_yield_pa(T: *i64, m: i64) -> i64 { if ms_ok(m)==0 { return MS_BAD } return T[m*MS_S+2]*MS_MPA } |
| 116 | func ms_ult_pa(T: *i64, m: i64) -> i64 { if ms_ok(m)==0 { return MS_BAD } return T[m*MS_S+3]*MS_MPA } |
| 119 | func ms_verdict(T: *i64, m: i64, sigma_pa: i64) -> i64 |
| 132 | func ms_mass_mg(T: *i64, m: i64, vol_mm3: i64) -> i64 |
| 138 | func ms_name(m: i64) -> *u8 called by 1: main |
| 158 | func main(argc: i64, argv: *i64) -> i64 |