nx_adaptive_layer.nx
buildroot/runtime/nx_adaptive_layer.nx
about
nx_adaptive_layer.nx -- bits-up Q14 multi-criteria adaptive layer
height computation for FDM (and any direct-write process where the
substrate computes per-Z layer thickness from local geometry).
=====================================================================
EXCEED axis (research baseline)
=====================================================================
Industry adaptive-layer-height treatments (as of 2026-05):
Cura 5.x `adaptive_layer_height`:
CURVATURE ONLY. Computes mesh surface curvature per candidate
Z and outputs layer height = max if flat / min if curved.
Single-input heuristic from Wong & Pfaffenberger 2017.
OrcaSlicer 2.3.2 "By Slope":
CURVATURE ONLY. Same algorithm family as Cura.
PrusaSlicer 2.7 "variable layer height":
CURVATURE ONLY. Manual or automatic from surface angle.
Bambu Studio:
No adaptive layer height; constant layer height.
Academic SOTA:
Steuben et al. 2016 "Multi-Criteria Adaptive Slicing":
Proposed curvature + overhang + feature-dimension, but uses
offline FEM stress analysis -- minutes per model, not slice-time.
Wang et al. 2018 "Adaptive Slicing for FDM Based on
Print-Time-Aware Optimization":
Time-aware single-pass; still curvature-dominated.
EXCEED axis (this file): 4-CRITERION weighted Q14 score at O(1) per
Z-step. Caller supplies 4 normalized [0, 16384] inputs:
curvature_q14: surface curvature at this Z (Cura's input)
load_above_q14: cantilever moment magnitude above this Z
(composes nx_pillar_physics -- the load model
industry doesn't have)
dependencies 2 imports · 2 importers
imports: nx_syscalls.nxnx_tier.nx
imported by: nx_adaptive_layer_test.nxnx_print_exceed_compose_test.nx
structs
| none |
consts
| 65 | const NX_ADAPT_CURVATURE_WEIGHT_Q14: i64 = 6554 // 0.40 |
| 66 | const NX_ADAPT_LOAD_WEIGHT_Q14: i64 = 4915 // 0.30 |
| 67 | const NX_ADAPT_BRIDGE_WEIGHT_Q14: i64 = 3277 // 0.20 |
| 68 | const NX_ADAPT_OVERHANG_WEIGHT_Q14: i64 = 1638 // 0.10 |
| 71 | const NX_ADAPT_MIN_LAYER_DEFAULT_Q14: i64 = 1311 // 0.08 mm (fine detail) |
| 72 | const NX_ADAPT_MAX_LAYER_DEFAULT_Q14: i64 = 4915 // 0.30 mm (coarse fast) |
| 74 | const NX_ADAPT_Q14_ONE: i64 = 16384 |
| 78 | const NX_ADAPT_OK: i64 = 0 |
| 79 | const NX_ADAPT_ERR_BAD_INPUT: i64 = 1 |
functions
| 88 | func nx_adaptive_layer_score(curvature_q14: i64, called by 1: nx_adaptive_layer_height |
| 129 | func nx_adaptive_layer_height(curvature_q14: i64, |