Skip to content

Viewer SDK commands

This is the complete public command surface of Viewer SDK v3.0.0. Commands are available under viewer.commands; the Recommended call column names the higher-level method to prefer when one provides promises, validation, or event handling.

Current syntax

SDK command Arguments Recommended call Purpose
applyDefaultMaterialChoices flags viewer.commands.applyDefaultMaterialChoices(flags) Apply every material choice's configured default option.
applyDefaultObjectChoices flags viewer.commands.applyDefaultObjectChoices(flags) Apply every object choice's configured default option.
applyMaterial layer, material viewer.setMaterial(layer, material) Apply a library material to a scene layer.
applyMaterialChoice choice, option, flags viewer.commands.applyMaterialChoice(...) Select one existing material choice option.
applyObjectChoice choice, option, flags viewer.commands.applyObjectChoice(...) Select one existing object choice option.
captureFrame await viewer.capture() Capture the current frame; the higher-level method resolves with its data URL.
centerView viewer.commands.centerView() Re-center the camera on the current product. This is the sole public button-style command.
clearParts await viewer.clearParts() Remove every keyed multipart addition.
closeScene viewer.close() Close the current scene.
getProperty node, property await viewer.getProperty(node, property) Read one property; the higher-level method resolves with its value.
getSceneObjects viewer.commands.getSceneObjects() Request the current scene-object description through viewer events.
mergePartUrl part id, URL, format await viewer.mergePart(id, source, options) Add or atomically replace a keyed multipart asset from a URL.
openScene URL await viewer.load(url) Open a scene; the higher-level method resolves when loading completes.
readMaterialChoices viewer.commands.readMaterialChoices() Request the existing material-choice definitions through viewer events.
readObjectChoices viewer.commands.readObjectChoices() Request the existing object-choice definitions through viewer events.
removePart part id await viewer.removePart(id) Remove one keyed multipart addition.
setBackground color viewer.setBackground(color) Set the viewer background color.
setInfotag enabled viewer.commands.setInfotag(enabled) Show or hide the information overlay.
setProperty node, property, value viewer.setProperty(node, property, value) Set a property on an explicit scene node or layer.
setQuality quality viewer.setQuality(quality) Select low, medium, high, or ultra viewer quality.
zoom delta viewer.zoom(delta) Move the live viewer camera closer or farther away.

Deprecated syntax

Deprecated SDK command Replacement Notes
None Viewer SDK v3.0.0 exposes no deprecated command aliases.

The Viewer SDK guide explains mounting, events, multipart sources, and the difference between synchronous viewer.commands calls and higher-level asynchronous methods.