G-code Preview — API Reference
    Preparing search index...

    @chestnutlabs/gcode-renderer-2d — low-resource Canvas 2D layer renderer (DD-014 / E8).

    An opt-in current/adjacent-layer 2D view over the existing ToolpathIR, for low-GPU, low-memory, or WebGL-blocked devices (old mobile, embedded printer UIs, locked-down browsers). One parse, one IR, a second lightweight view — no second parser path, no three, no framework. Per-segment color is single-sourced with the 3D renderer via @chestnutlabs/gcode-colors.

    Re-exports the color model so 2D consumers get ColorMode/RGB from one import.

    • Honest capability disclosures for rendering ir as a flat 2D layer view (DD-014 §6/§11). Returns human-readable notes a consumer UI can show; empty when the IR is faithfully representable (planar FDM). It never suppresses geometry — it explains what the flat top-down projection cannot convey.

      • layers: 'unavailable' (non-planar / CNC / unindexed): the parser put every move on layer 0, so the 2D view shows them all in one flat frame — Z variation and non-XY (e.g. G18/G19) motion are not represented.
      • layers: 'inferred': layer boundaries are approximate.

      Parameters

      Returns string[]