Skip to content

07 — Data model

Engine-owned canonical data. C# sees blittable POD mirrors only.

Golden fixture

Field Value
File 4-colors+Benchy+AMS+test-v2.3mf (repo root)
Plates 1
Vertices 16562
Triangles 33097
Palette colors 4

Enforced by C++ Catch2 Benchy cases and C# LoadModel_OnBenchy3Mf.

Mesh domain (engine_data.h / MeshStore)

Type Role
TriangleMesh Positions, indices, optional color indices; append remaps
Plate Per-plate mesh + metadata (thumbnail etc.)
PaletteEntry Filament/paint color
LoadedModel Plates + palette + unit

Load modes: Full (geometry populated) vs MetadataOnly (geometry null).

G-code move (NpsGcodeMove / 36 B)

Field Meaning
x,y,z mm absolute
e cumulative extrusion
f feed mm/min
type Travel=0, Extrude=1
layer 0-based
reserved[0] accel mm/s² (M204)
reserved[1] future time

Shared array after either GenerateGcode or ParseGcode/ParseBgcode.

Split text buffers

API Content
GetLastGeneratedGcode Demo toolpath text
GetLastParsedGcode Parsed / decoded text

Do not assume they are the same pointer or content.

Analysis findings

Type Size Use
NpsAnalysisFinding 300 B severity, category[32], message[128], layer, moveIndex, suggestion[128]
NpsAnalysisFindingSummary 16 B severity, layer, moveIndex, findingId

findingId indexes full array until next AnalyzeGcode.

Material profile (NpsMaterialProfile / 108 B)

Thermal/mechanical/chamber/motion/flow fields + type / chamberType strings. Default PLA when profile null. Catalog in material_catalog.cpp.

Warp grid

Piece Role
NpsWarpGrid layer, gridW/H, minX/Y, gridRes
risk float array row-major w*h, engine-owned

Overlay keyspace (open strings)

Not a closed int enum. Host constants in NpsAbi.OverlayModeId:

  • motion-type (default)
  • thermal, warp-risk, bond-strength, cooling-eff
  • plus analyzer-advertised ids via GetSupportedOverlayIds

Viewport buffers

Per-layer extrude/travel float streams (CPU prep). MVP 4×4. Simulation index clips progressive draw. Overlay values drive heatmap colors (ViewportGetHeatmapColor).

Ownership / lifetime

  • Engine-owned pointers/strings: valid until next op of that domain or destroy.
  • Caller-owned out buffers: findings copy, string outs with capacity.
  • SafeHandles own engine + viewport native objects on C# side.

See also