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

    Class ObjectsManager

    Index

    Constructors

    Properties

    ambientLight: number = 0.4
    boundingBoxColor?: Color

    Color of the bounding box; undefined hides it

    boundingBoxMesh?: LineBox

    Wireframe box around the model, created lazily on first draw

    brightness: number = 1.3
    buildVolume?: BuildVolume

    Build volume visualization, or undefined when none is drawn

    clippingPlanes: Plane[] = []

    Clipping planes for the current layer range, applied to every line material we create

    directionalLight: number = 1.3
    disposables: Disposable[] = []
    extrusionColor: Color | Color[] = ObjectsManager.defaultExtrusionColor

    Current extrusion color(s); an array is indexed by tool

    extrusionsGroup: Group
    extrusionWidth?: number

    Width of extruded material. Undefined means each path uses its own width.

    gradientEnabled: boolean = false

    Whether extrusion lines get a per-layer brightness gradient baked into their vertex colors. Only meaningful for line rendering; tubes ignore it.

    layerCount: number = 0

    Total number of layers, used to normalize the gradient ramp

    lineHeight: number
    lineWidth: number
    materials: ShaderMaterial[] = []

    Shader materials used for tube rendering, indexed by tool

    renderTubes: boolean = false
    scene: Scene
    travelColor: Color = ...

    Current travel move color

    travelMovesGroup: Group
    defaultExtrusionColor: Color = ...

    Default color for extrusions when the caller supplies none

    rebuildDebounce: 100

    How long to coalesce geometry rebuilds for, in ms

    Methods

    • Records paths as rendered without drawing them, so later batches skip them.

      Parameters

      Returns void

      Used when a highlight redraws part of a path — its final segment in its own color — so the per-tool batch does not also draw the original whole path. The claim is part of the current highlight and is undone by revertHighlight.

    • Resolves the color a tool draws with, falling back when the array has no entry.

      Parameters

      • toolIndex: number

        Tool asking for its color

      Returns Color

      A gcode file can reference more tools than the caller supplied colors for (e.g. a color array sized for 2 tools rendering a 3-tool file). The array's last configured color — or the default when the array is empty — is used instead, warning once per tool index rather than throwing.

    • Parameters

      • paths: Path[]
      • color: Color
      • toolIndex: number = 0

      Returns void

    • Renders a tool's extrusions in whichever representation is currently selected, in the color the tool resolves to.

      Parameters

      • paths: Path[]
      • toolIndex: number = 0

      Returns void

    • Draws paths in a single color with a dedicated material, independent of the per-tool colors, and records them as rendered.

      Parameters

      • paths: Path[]
      • color: Color

      Returns void

      Used for highlight overlays — the top layer and the last segment — that must win over the tool color. Because the material is not the cached per-tool one, recoloring a tool later leaves the highlight untouched. The object is tagged so setExtrusionColor skips it for the same reason.

    • Parameters

      • paths: Path[]
      • color: Color
      • toolIndex: number = 0

      Returns void

    • Draws a slice of the job's combined path list, routing each path to its category: travels as travel lines, extrusions per tool in the current representation.

      Parameters

      • paths: Path[]

        Paths in print order, travels and extrusions interleaved

      • categories: { extrusions: boolean; travels: boolean }

        Which categories to draw. Paths of a disabled category are left unrendered, so they draw when the category is re-enabled.

      Returns void

      Already-drawn paths are skipped, so progressive rendering can pass a growing prefix of the same list and each path is built exactly once.

    • Empties both groups and forgets which paths have been rendered, so the next render call rebuilds everything from scratch.

      Returns void

      Used when a change invalidates existing geometry (new job, tubes/lines swap, line dimensions). Cheap property changes should mutate in place instead.

    • Removes the currently drawn highlight and forgets that its paths were rendered, so the next render call redraws them in their normal color.

      Returns void

      Used to move a live top-layer/last-segment highlight forward as newer layers or segments arrive, without leaving stale highlighted geometry behind on the layer or path it has moved past. Only what the highlight itself drew or claimed is unclaimed — paths the per-tool batches drew stay rendered, so they are not drawn a second time. The overlay's own geometry and material are disposed; the per-path source geometries they were built from are left for the next full reset — the paths get redrawn through the normal path, which builds its own fresh geometry anyway.

    • Recolors the bounding box in place; undefined hides it.

      Parameters

      • Optionalcolor: Color

        New color, or undefined to hide the box

      Returns void

    • Stores the extrusion color(s) and repaints the rendered extrusions in place.

      Parameters

      • value: Color | Color[]

        One color for every tool, or an array indexed by tool

      Returns void

      Tools already drawn past the end of an array repaint with the fallback color, so shrinking the array never leaves a tool showing a stale color.

    • Draws the bounding box for the given bounds, creating or resizing the mesh as needed.

      Parameters

      Returns void

      The mesh is kept across geometry rebuilds — only a change in the bounds themselves (a file streaming in) makes a new one. Visibility tracks whether a color is set.

    • Parameters

      • OptionalminZ: number
      • OptionalmaxZ: number

      Returns void