gcode-preview - v3.0.0-alpha.5
    Preparing search index...

    Class SlicerMetadataParserAbstract

    Abstract base class for slicer-specific metadata parsers

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    identificationPatterns: RegExp[]

    Patterns that identify this slicer in gcode comments

    slicerName: string

    The name of the slicer this parser handles

    Methods

    • Checks if this parser can handle the given gcode based on comments

      Parameters

      • commentCommands: GCodeCommand[]

        Array of gcode commands with comments

      • maxLines: number = 200

        How many of those commands to sample before giving up

      Returns boolean

      True if this parser can handle the gcode

    • Whether the moves of this gcode can be trusted to derive per-path extrusion dimensions from

      Parameters

      • commentCommands: GCodeCommand[]

        Array of gcode commands with comments

      Returns boolean

      True unless the dialect's E values are not filament lengths

      Deriving is the default, for every dialect and for gcode no parser recognised: a file that announces its dimensions simply outranks the derived values path by path (the Job resolves that order), so there is nothing to gate on. A dialect only opts out when the arithmetic itself does not hold -- Cura's UltiGCode flavor, whose E is cubic millimetres of material rather than millimetres of filament, would otherwise derive confidently wrong widths. Evaluated on the chunk that identified the slicer (like detectSlicerName), so it can inspect header comments.

    • Resolves the slicer name to report for the given gcode.

      Parameters

      • commentCommands: GCodeCommand[]

        Array of gcode commands with comments

      Returns string

      The slicer name

      Parsers that handle a family of slicers sharing one comment dialect override this to report the specific generator named in the header.

    • Reads the filament diameter announced in header comments, when any

      Parameters

      • commentCommands: GCodeCommand[]

        Array of gcode commands with comments

      Returns number

      The filament diameter in millimeters, or undefined when unknown

      Feeds the volumetric dimension derivation (see derivesExtrusionDimensions), which converts extruded filament lengths into deposited volume. Only header-borne values may be reported here: a diameter that appears after moves (like Cura's end-of-file ;SETTING_3 blob) would reach a one-shot parse before any move executes but a streamed parse only after every move already ran, making the two disagree.