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

    Imperative controls — a thin proxy over the engine, queued until the canvas binds.

    interface ModelPreviewControls {
        capture(opts?: CaptureOptions): Promise<Blob>;
        frame(): void;
        getCameraState(): CameraState | null;
        resize(width: number, height: number): void;
        setBackground(bg: ModelBackground): void;
        setBuildVolume(def: BuildVolumeDef | null): void;
        setBuildVolumeCage(visible: boolean): void;
        setCameraFov(deg: number): void;
        setCameraState(state: CameraState): void;
        setInteractionQuality(mode: "off" | "auto"): void;
        setPixelRatio(ratio: PixelRatioOption): void;
        setRenderScope(scope: RenderScope | null): void;
        setSource(input: ModelSourceInput): Promise<ModelReadyInfo>;
        setTheme(theme: Theme): void;
        setView(view: CameraView): void;
    }
    Index
    • Show/hide the build-volume wireframe cage, independently of the plate (parity with the toolpath setBuildVolumeCage). The model does not move. Remembered across plate rebuilds and canvas rebinds.

      Parameters

      • visible: boolean

      Returns void

    • Change the perspective lens, [10, 120]°. Throws RangeError synchronously outside it, even before a canvas binds. Remembered across canvas rebinds.

      Parameters

      • deg: number

      Returns void

    • Change the resting pixel ratio: (0, 4] or 'device' (DPR capped at 2, followed live). Throws RangeError synchronously otherwise, even before a canvas binds. Remembered across canvas rebinds. A gesture in progress settles on the new ratio; the default capture() size does not change.

      Parameters

      Returns void