new Viewer(client, params)
Parameters:
| Name | Type | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
client |
The |
|||||||||||||
params |
An object containing viewer configuration parameters. Properties
|
Members
-
<readonly> draggers
-
List of names of available draggers:
LineTextPanOrbitZoomZoomWindowOrbitAroundBuildingMeasureLineCuttingPlaneXAxisCuttingPlaneYAxisCuttingPlaneZAxisWalk
-
options
-
VisualizeJSparameters. -
visualizeJs
-
Returns
VisualizeJSmodule instance. -
<readonly> visualizeJsUrl
-
VisualizeJSlibrary URL. Use configure() to change library URL.
Methods
-
activeDragger()
-
Returns active dragger instance or
nullif there is no active dragger. -
addMarkupEntity()
-
Add an empty markup entity to the overlay.
-
cancel()
-
Cancels asynchronous model loading started by open().
-
clear()
-
Unloads the model and clears the viewer.
-
clearOverlay()
-
Remove markup overlay.
-
clearSlices()
-
Remove all cutting planes.
-
colorizeAllMarkup(r, g, b)
-
Colorize all markup entities with the specified color.
Parameters:
Name Type Default Description r255 Redpart of color.g0 Greenpart of color.b0 Bluepart of color. -
colorizeSelectedMarkups(r, g, b)
-
Colorize all selected markup entities with the specified color.
Parameters:
Name Type Default Description r255 Redpart of color.g0 Greenpart of color.b0 Bluepart of color. -
configure(params)
-
Change the viewer configuration parameters.
Parameters:
Name Type Description paramsAn object containing new configuration parameters.
Properties
Name Type Description visualizeJsUrlVisualizeJSlibrary URL. Set this URL to use your own library instance or leave it blank to use the default URL defined byClient.js. -
createViewpoint()
-
Create a viewpoint. To add a viewpoint to the list of model viewpoints, use the Model.saveViewpoint() or File.saveViewpoint().
-
dispose()
-
Releases all resources allocated by this
Viewerinstance. Call this method before release theViewerinstance. -
drawViewpoint(viewpoint)
-
Draw a viewpoint. To get a list of available model viewpoints, use the Model.getViewpoints() or File.getViewpoints().
Parameters:
Name Type Description viewpointViewpoint data.
-
executeCommand(id, args)
-
Executes the command denoted by the given command identifier.
Parameters:
Name Type Argument Description idIdentifier of the command to execute.
args<repeatable>
Parameters passed to the command function.
Returns:
A returned value of the given command. Returns
undefinedwhen the command doesn't exists. -
getMarkupColor()
-
Get markup color.
Returns:
Color with
RGBvalues. -
getSelected()
-
Returns a list of original handles for the selected entities.
-
<async> initialize(canvas, onProgress)
-
Load
VisualizeJSmodule and initialize it with the specified canvas. Call dispose() to release allocated resources.Parameters:
Name Type Description canvasHTML
<canvas>element forVisualizeJS.onProgressA callback function that handles events measuring progress of loading of the
VisualizeJSlibrary. Retrieves visualizeprogress event. -
is3D()
-
Returns
trueif current drawing is 3D drawing. -
isInitialized()
-
Returns
trueifVisualizeJSmodule has been loaded andinitialized. -
<async> loadReferences(model)
-
Load model references into the viewer. References are images, fonts, or any other files to correct rendering of the model.
Parameters:
Name Type Description modelInstance of model with references. If a
Fileinstance is specified instead of a model, the file references will be loaded. -
<async> open(file)
-
Loads a model of a file or assembly into the viewer.
This method requires a Client instance to work. For standalone viewer instance use openVsfFile() or openVsfxFile().
Fires:
- open
- geometrystart
- geometryprogress
- databasechunk
- geometrychunk
- geometryend
- geometryerror
Parameters:
Name Type Description fileFile or Assembly or Model instance to load. If a
Fileinstance with multiple models is specified, the default model will be loaded. If there is no default model, first availiable model will be loaded. -
openVsfFile(buffer)
-
Loads a VSF file into the viewer.
Fires:
- open
- geometrystart
- geometryprogress
- databasechunk
- geometryend
- geometryerror
Parameters:
Name Type Description bufferBinary data buffer to load.
-
openVsfxFile(buffer)
-
Loads a VSFX file into the viewer.
Fires:
- open
- geometrystart
- geometryprogress
- databasechunk
- geometryend
- geometryerror
Parameters:
Name Type Description bufferBinary data buffer to load.
-
registerDragger(name, dragger)
-
Register dragger on draggerFactory.
Parameters:
Name Type Description nameDragger name.
draggerDragger class.
-
resetActiveDragger()
-
Reset the state of the active dragger.
-
scheduleUpdateAsync(maxScheduleUpdateTimeInMs, maxScheduleUpdateCount)
-
Update with internal schedule, need after change operation when have long update for update without lock UI
Parameters:
Name Type Default Description maxScheduleUpdateTimeInMs50 Maximum time for one update, by default 30 ms
maxScheduleUpdateCountMaximum count of schedule update
Returns:
return void Promise
-
setActiveDragger(name)
-
Set active dragger.
Viewermust be initialized before enable dragger or exception is thrown.Fires:
- changeactivedragger
Parameters:
Name Type Description nameDragger name. Can be one of the draggers list.
Returns:
Returns active dragger instance or
nullif there is no dragger with the given name. -
setMarkupColor(r, g, b)
-
Set markup color.
Parameters:
Name Type Default Description r255 Redpart of color.g0 Greenpart of color.b0 Bluepart of color. -
setSelected(handles)
-
Select model entities by original handles that are obtained using File.getProperties() or File.searchProperties() methods.
Fires:
- select
Parameters:
Name Type Description handlesThe list of original handles.
-
syncOverlay()
-
Synchronize markup overlay.
-
update(force)
-
Updates the viewer. Do nothing if the auto-update mode is disabled in the constructor (use the
updateevent to update viewer manually).Fires:
- update
Parameters:
Name Type Default Description forcefalse If
trueupdates the viewer immidietly. Otherwise updates on next animation frame. Default isfalse. -
visLib()
-
Returns
VisualizeJSmodule instance. -
visViewer()
-
Returns
VisualizeJSViewer instance.
Client.js