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

    Class Path

    Represents a path in 3D space with associated properties

    Used to store and manipulate G-code path data including vertices, extrusion parameters, and tool information

    Index

    Constructors

    • Creates a new Path instance

      Parameters

      • travelType: PathType

        Type of path movement

      • extrusionWidth: number = 0.6

        Width of extruded material (default: 0.6)

      • lineHeight: number = 0.2

        Height of extruded line (default: 0.2)

      • tool: number = 0

        Tool number (default: 0)

      Returns Path

    Properties

    extrusionWidth: number

    Width of extruded material

    layerIndex?: number

    Index of the layer this path belongs to, set by the LayersIndexer; undefined for non-planar jobs

    lineHeight: number

    Height of extruded line

    tool: number

    Tool number used for this path

    travelType: PathType

    Type of path movement

    Accessors

    • get vertices(): number[]

      Gets the path's vertices as a flat array of numbers

      Returns number[]

      Array of vertex coordinates in [x,y,z] order

    Methods

    • Adds a new point to the path

      Parameters

      • x: number

        X coordinate

      • y: number

        Y coordinate

      • z: number

        Z coordinate

      Returns void

    • Checks if a point continues the current line

      Parameters

      • x: number

        X coordinate to check

      • y: number

        Y coordinate to check

      • z: number

        Z coordinate to check

      Returns boolean

      True if the point matches the last point in the path

    • Creates a 3D geometry from the path

      Parameters

      • opts: { extrusionWidthOverride?: number; lineHeightOverride?: number } = {}

        Geometry options

        • OptionalextrusionWidthOverride?: number

          Optional override for extrusion width

        • OptionallineHeightOverride?: number

          Optional override for line height

      Returns BufferGeometry

      BufferGeometry representing the path

    • Creates a line geometry from the path

      Returns LineSegmentsGeometry

      LineSegmentsGeometry representing the path

    • Converts the path's vertices to an array of Vector3 points

      Returns Vector3[]

      Array of Vector3 points

    • Splits the path into its final segment and the body that precedes it.

      Returns { body: Path; segment: Path }

      The last two points as segment, and everything up to and including the segment's first point as body (null when the path is a single segment). Both carry this path's travel type, extrusion settings and tool.

      Requires at least two points; used to draw the final segment of a print in its own highlight color while the rest of the path keeps another one.