G-code Preview — API Reference
    Preparing search index...
    interface ModelViewer {
        capture(opts?: CaptureOptions): Promise<Blob>;
        dispose(): void;
        frame(): void;
        getCameraState(): CameraState | null;
        getPlacement(): {
            placement: ModelPlacement
            | null;
            placementOffset: PlacementOffset | null;
        };
        onEvent(cb: (e: ModelViewerEvent) => void): () => void;
        resize(width: number, height: number): void;
        setBackground(bg: ModelBackground): void;
        setBuildVolume(def: BuildVolumeDef | null): void;
        setBuildVolumeCage(visible: boolean): void;
        setCameraFov(fov: 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
    • Re-fit the camera to the current model bounds (the default 3/4 view), fitting the bounding box to the canvas aspect and field of view. Also resumes auto-framing on resize.

      Returns void

    • Show/hide the build-volume wireframe cage, independently of the plate, grid and shadow (parity with the toolpath setBuildVolumeCage). The model does not move and the camera is not re-fitted. Remembered when the plate is rebuilt (a new bed, theme or scope).

      Parameters

      • visible: boolean

      Returns void

    • Change the perspective lens, [10, 120]° (RangeError outside it). Keeps apparent size; re-fits while auto-framing.

      Parameters

      • fov: number

      Returns void

    • Render only a subset of the current source (DD-030 D2): { plateId }, { objectIds }, or an { instanceFilter }; null restores the whole source. Rebuilds and reframes to the subset. Gate a { plateId } on the ready info's plates being present — an unmatched scope renders empty.

      Parameters

      Returns void