G-code Preview — API Reference
    Preparing search index...
    interface ModelViewerOptions {
        autoFrameOnResize?: boolean;
        background?: ModelBackground;
        buildVolume?: BuildVolumeDef | null;
        cameraFov?: number;
        cameraMode?: CameraMode;
        createControls?: (
            camera: PerspectiveCamera | OrthographicCamera,
            domElement: HTMLElement,
        ) => ControlsLike;
        createRenderer?: (canvas: RenderTargetCanvas) => GLRendererLike;
        filamentPalette?: readonly (string | undefined)[];
        interactionQuality?: "off" | "auto";
        limits?: ModelLimits;
        loaders?: readonly ModelLoader[];
        onProgress?: (progress: LoadProgress) => void;
        pixelRatio?: PixelRatioOption;
        renderScope?: RenderScope;
        showVolumeCage?: boolean;
        theme?: Theme;
    }
    Index
    autoFrameOnResize?: boolean

    Re-fit the camera to the model when the canvas is resized (resize()), until the user moves the camera (orbit/zoom/pan or setCameraState); after that their view is kept. frame() (Reset view), a new source, or a render-scope change resumes auto-framing. Default true.

    background?: ModelBackground

    'transparent' (default) | CSS colour | 0xRRGGBB (DD-018).

    buildVolume?: BuildVolumeDef | null

    Build plate under the model (DD-032 §4.3) — the full BuildVolumeDef (shape, min, excluded regions). Omit/null for no plate: the viewer then renders exactly as before. Where the part sits on the plate is decided honestly and reported as placement (see ModelPlacement).

    cameraFov?: number

    Perspective lens in degrees, [10, 120] (default 50). Throws RangeError outside it.

    cameraMode?: CameraMode

    Initial camera projection; default 'perspective'.

    createControls?: (
        camera: PerspectiveCamera | OrthographicCamera,
        domElement: HTMLElement,
    ) => ControlsLike

    Injected orbit controls (tests). Default: three OrbitControls via the stage.

    createRenderer?: (canvas: RenderTargetCanvas) => GLRendererLike

    Injected GL (tests / exotic hosts). Default: the shared stage builder with alpha on.

    filamentPalette?: readonly (string | undefined)[]

    3MF paint_color palette override (hex #RRGGBB per 0-based slot); parity with renderModelStill.

    interactionQuality?: "off" | "auto"

    DD-020 interaction-aware quality; default 'auto' (the interactive default).

    limits?: ModelLimits

    Source-model triangle / byte caps (DD-018 ModelLimits).

    loaders?: readonly ModelLoader[]

    Loader registry (open kind). Default: [stlLoader, threeMfLoader].

    onProgress?: (progress: LoadProgress) => void

    Staged loading-progress callback (DD-024): typed stage/done/total/unit events (no human copy), each tagged with the load generation so a consumer drops events from a superseded setSource. The consumer owns all wording/i18n. Events from a superseded load are not emitted.

    pixelRatio?: PixelRatioOption

    Resting pixel ratio of the canvas: a number in (0, 4], or 'device' (the display's devicePixelRatio capped at 2, followed live). Unset keeps the renderer's ratio (1). A ratio of 2 shades 4× the fragments of 1. Throws RangeError synchronously otherwise. The default capture() size does not change.

    renderScope?: RenderScope

    Initial render scope (DD-030 D2) — e.g. { plateId: 3 }. Omit to render the whole source.

    showVolumeCage?: boolean

    Draw the build-volume wireframe cage over the plate. Default true. false keeps the plate, its grid and the contact shadow and drops only the cage, as the toolpath viewer's setBuildVolumeCage(false) does.

    theme?: Theme

    Plate/backdrop look (DD-032), e.g. studioTheme('dark'). Only the plate and backdrop fields apply (background, gridColor, gridOpacity, gridMajor, bedOutline, bedSurface, bedColor, contactShadow); lights and materialPreset are deliberately not applicable — the model rig is unchanged. theme.background beats background, which is the fallback tier.