Optionalclient: ClientThe Client instance that is used to load model reference files from the Open Cloud
Server. Do not specify Client if you need a standalone viewer instance to view VSFX files from
the web or from local computer.
An object containing viewer configuration parameters.
OptionalcrossOrigin?: stringThe
crossorigin content
attribute on Visalize.js script element. One of the following values: "", anonymous, or
use-credentials.
OptionalenableAutoUpdate?: booleanEnable auto-update of the viewer after any changes. If the
auto-update is disabled, you need to register an update event handler and update the
VisualizeJS viewer and active dragger manually. Default is true.
OptionalmarkupType?: MarkupTypeThe type of the markup core: Visualize or Konva. Default is Konva.
OptionalvisualizeJsUrl?: stringVisualizeJS library URL. Set this URL to use your own library
instance, or specify undefined or blank to use the default URL defined by Viewer.visualize
library you are using.
HTMLCanvasElement that the viewer operates on. Defined only when the viewer is initialized.
List of canvas events, such as mouse events or pointer events or touch events that the viewer should listen to and redirect to the draggers and components.
By default, the following events are redirected:
The Client instance that is used to load model reference files from the Open Cloud Server.
Statistical information about the GPU memory and the rendering process.
List of active loaders used to load models into the viewer.
List of models loaded into the viewer.
Viewer options.
List of names of available components.
List of names of available draggers.
The following draggers are available by default:
For a quick reference on how to implement your own dragger, see IDragger.
2D markup core instance used to create markups.
Returns VisualizeJS module
instance.
VisualizeJS library URL. Use configure() to change library URL.
Returns the active dragger reference, or null if there is no active dragger.
Registers a new listener for the event type.
The type of event to listen to.
The function that gets called when the event is fired.
Adds an empty Visualize markup entity to the VisualizeJS overlay.
Unloads an open file, clears the canvas and markups, and deactivates the active dragger.
Fires:
Changes the viewer parameters.
An object containing new parameters.
OptionalcrossOrigin?: stringThe
crossorigin content
attribute on Visalize.js script element. One of the following values: "", anonymous, or
use-credentials.
OptionalvisualizeJsUrl?: stringVisualizeJS library URL. Set this URL to use your own library
instance or specify undefined or blank to use the default URL defined by Viewer.visualize
library you are using.
Saves the viewer state as a viewpoint.
To save a viewpoint to the Open Cloud Server for a specific file, use the File.saveViewpoint().
Fires:
The object handle or list of handles. To avoid collisions across models in multi-model scenes, use composite handles in the form "model:handle". All handles in the list must be in the same format.
Unloads an open file, clears the canvas and markups, and releases resources allocated by this viewer
instance. Call this method before releasing the Viewer instance.
Sets the viewer state to the specified viewpoint.
To get a list of available viewpoints from the Open Cloud Server for a specific file, use the
File.getViewpoints().
Fires:
Viewpoint data.
Fires the event. Alias to emitEvent().
The type of event that gets fired.
The event properties.
Fires the event. Calls each of the listeners registered for the event type event.type, in the
order they were registered.
The event that gets fired.
Executes the command denoted by the given command. If the command is not found, tries to set active dragger with the specified name.
The following commands are available by default:
applyModelTransformautoTransformAllModelsToCentralPointclearMarkupclearSelectedclearSlicescreatePreviewexplodegetDefaultViewPositionsgetModelsgetSelectedhideSelectedisolateSelectedregenerateAllresetViewselectModelsetActiveDraggersetDefaultViewPositionsetMarkupColorsetSelectedshowAllzoomToExtentszoomToObjectszoomToSelectedTo register custom command use the commands.registerCommand.
Command ID or dragger name.
Parameters passed to the command handler function.
Returns the result of the command handler function or new active dragger instance. Returns
undefined if neither the command nor the dragger exists.
Explode index. Range is 0 to 100.
Returns the component reference, or null if there is no component with the specified name.
Component name. Can be one of the components list.
Returns a list of handles for the hidden objects.
Special cases:
Optionalmultimodel: booleanSpecifies if the returned handles should be formatted for a multi-model scene:
false (default): Returns raw handles as stored in the file. Useful for single-model scenes.true: Returns composite handles in the form model:handle. Useful for multi-model scenes.Returns a list of handles for the isolated objects.
Optionalmultimodel: booleanSpecifies if the returned handles should be formatted for a multi-model scene:
false (default): Returns raw handles as stored in the file. Useful for single-model scenes.true: Returns composite handles in the form model:handle. Useful for multi-model scenes.Returns the scaling factors for each axis in world space.
Returns a list of handles for the selected objects.
Optionalmultimodel: booleanSpecifies if the returned handles should be formatted for a multi-model scene:
false (default): Returns raw handles as stored in the file. Useful for single-model scenes.true: Returns composite handles in the form model:handle. Useful for multi-model scenes.Creates a snapshot image of the current viewer state.
If the viewer has an active markup, combines the viewer canvas with the markup overlay. Otherwise, captures only the viewer canvas.
Optionaltype: stringThe MIME type of the image format. Can be one of:
image/png - PNG format with lossless compression (recommended for quality)image/jpeg - JPEG format with lossy compression (smaller file size)image/webp - WebP format (modern browsers only)If not specified, uses snapshotMimeType option.
Optionalquality: numberA number between 0 and 1 indicating the image quality for lossy formats. If not specified, uses snapshotQuality option.
A Data URL string containing the snapshot image.
Loads the VisualizeJS module and initializes it with the specified canvas. Call
dispose() to release allocated resources.
Fires:
HTMLCanvasElement for
VisualizeJS. The canvas element must have an id attribute, otherwise an exception will be
thrown.
OptionalonProgress: (event: ProgressEvent) => voidA callback function that handles events measuring progress of loading of the
VisualizeJS library.
Returns true if the currently opened model is a 3D model.
Returns true if VisualizeJS module has been loaded and initialized.
Removes the listener from an event type. Alias to removeEventListener().
The type of the event that gets removed.
The listener function that gets removed.
Registers a new listener for the event type. Alias to addEventListener()
The type of event to listen to.
The function that gets called when the event is fired.
Loads a file into the viewer.
The viewer must be initialized before opening the file. Otherwise, open() does
nothing.
This method requires a Client instance to be specified to load file from the Open Cloud Server.
The file geometry data on the Open Cloud Server must be converted into a vsfx format, otherwise an
exception will be thrown.
For files from Open Cloud Server, the default model will be loaded. If there is no default model, first availiable model will be loaded. If no models are found in the file, an exception will be thrown.
For URLs, the file extension is used to determine the file format. For a ArrayBuffer and Data URL, a file format must be specified using params.format parameter. If no appropriate loader is
found for the specified format, an exception will be thrown.
If there was an active dragger before opening the file, it will be deactivated. After opening the file, you must manually activate the required dragger.
To open a large files, enable partial streaming before opening. Partial streaming is only supported when opening files from an Open Cloud Server, but not local files and URLs. Example:
viewer.options.enableStreamingMode = true;
viewer.options.enablePartialMode = true;
await viewer.open(file);
Fires:
File to load. Can be:
File, Assembly, or Model instance from the Open Cloud ServerURL stringLoading parameters.
Optionalformat?: stringFile format. Can be one of vsf or vsfx. Required when loading a file as
ArrayBuffer or Data URL.
Optionalmode?: stringReserved for future use.
OptionalmodelId?: stringReserved for future use.
OptionalrequestHeader?: HeadersInitThe request header used in HTTP request.
OptionalwithCredentials?: booleanWhether the HTTP request uses credentials such as cookies, authorization headers or TLS client certificates. See XMLHttpRequest.withCredentials for more details.
If type is specified, removes all registered listeners for type, otherwise removes all registered
listeners.
Optionaltype: TThe type of the listener that gets removed.
Removes the listener for the event type.
The type of the event that gets removed.
The listener function that gets removed.
Resets the state of the active dragger.
Transforms position from screen space into world space.
Screen position in pixels.
The object handle or list of handles. To avoid collisions across models in multi-model scenes, use composite handles in the form "model:handle". All handles in the list must be in the same format.
Changes the active dragger. The viewer must be initialized before activating the dragger, otherwise an exception will be thrown.
Fires:
Dragger name. Can be one of the draggers list or an empty string to deactivate the current dragger.
Returns the new active dragger reference or null if there is no dragger with the given
name.
Optionalhandles: string[]The object handle or list of handles. To avoid collisions across models in multi-model scenes, use composite handles in the form "model:handle". All handles in the list must be in the same format.
Resizes the output canvas to (width, height) with device pixel ratio taken into account.
Fires:
The width of the canvas.
The height of the canvas.
Setting updateStyle to false prevents any style changes to the output canvas.
Creates an overlay view. Overlay view is used to draw cutting planes and markups.
Toggles the selection of the specified objects by handles:
Fires:
The object handle or list of handles. To avoid collisions across models in multi-model scenes, use composite handles in the form "model:handle". All handles in the list must be in the same format.
Updates the viewer.
Do nothing if the auto-update mode is disabled in the constructor. In this case, register an
update event handler and update the Visualize viewer and active dragger manually.
Fires:
If true updates the viewer immidietly. If a number is specified and more than the
given amount of milliseconds has elapsed since the last rendering, the update is performed
immediately as well. Otherwise updates on next animation frame. Default is false.
Updates the viewer asynchronously without locking the user interface. Used to update the viewer after changes that require a long rendering time.
Do nothing if the auto-update mode is disabled in the constructor. In this case, register an
update event handler and update the VisualizeJS viewer and active dragger manually.
Fires:
Maximum time for one update, default 30 ms.
Maximum count of scheduled updates.
Returns VisualizeJS module
instance.
Returns VisualizeJS Viewer
instance.
Transforms position from world space into screen space.
Position in world space coordinates.
The object handle or list of handles. To avoid collisions across models in multi-model scenes, use composite handles in the form "model:handle". All handles in the list must be in the same format.
3D viewer powered by VisualizeJS.