G-code Preview — API Reference
    Preparing search index...
    interface PreviewController {
        controls: GcodePreviewControls;
        raw: { renderer: () => null | PreviewRenderer; session: GcodeParseSession };
        bindCanvas(canvas: null | HTMLCanvasElement): void;
        cancel(): void;
        clearProgress(): void;
        dispose(): void;
        getState(): GcodePreviewState;
        observeProgress(obs: ProgressObservation): null | MappedProgress;
        onEvent(cb: (e: PreviewEvent) => void): () => void;
        onStateChange(cb: (state: GcodePreviewState) => void): () => void;
        parse(
            input: ArrayBuffer | Uint8Array<ArrayBufferLike> | File,
            opts?: WireParseOptions,
        ): Promise<ParseOutcome>;
        tickProgress(nowMs: number): null | MappedProgress;
    }
    Index

    Properties

    raw: { renderer: () => null | PreviewRenderer; session: GcodeParseSession }

    Escape hatches — the neutral objects themselves (advanced use). renderer() returns the active PreviewRenderer (the 3D ToolpathRenderer or the 2D LayerView2DRenderer), or null before bind / during the 3D renderer's on-demand load.

    Methods

    • Bind/rebind the renderer to a canvas (null unbinds). Rebinding disposes safely.

      Parameters

      • canvas: null | HTMLCanvasElement

      Returns void