WebViewer
- class WebViewer()
Constructors
Properties
Accessors
floorplanManager
operatorManager
overlayManager
view
views
defaultEngineBinary
defaultEngineModule
defaultEnginePath
Methods
Constructors
- WebViewer.constructor(inputParams)
- Arguments
inputParams (
WebViewerConfig()
) – object containing key-value pairs for viewer to set
Creates a new Web Viewer instance. You must pass in a containerId key with the ID of an element or a container element to use for your viewer. The system will create any required elements inside the supplied container.
- Return type
WebViewer
Properties
- WebViewer.BCFManager
- Type
BCFManager
- WebViewer._views
- Type
[View]
- WebViewer.animationManager
- Type
Manager
- WebViewer.cuttingManager
- Type
CuttingManager
- WebViewer.explodeManager
- Type
ExplodeManager
- WebViewer.lineManager
- Type
LineManager
- WebViewer.markupManager
- Type
MarkupManager
- WebViewer.measureManager
- Type
MeasureManager
- WebViewer.model
- Type
Model
- WebViewer.noteTextManager
- Type
NoteTextManager
- WebViewer.selectionManager
- Type
SelectionManager
- WebViewer.sheetManager
- Type
SheetManager
Accessors
- floorplanManager()
- Deprecated
FloorplanManagers are now properties of Views.
- Return type
FloorplanManager
- operatorManager()
- Deprecated
OperatorManagers are now properties of Views.
- Return type
OperatorManager
- overlayManager()
- Deprecated
OverlayManagers are now properties of Views.
- Return type
OverlayManager
- view()
- Return type
View
- views()
- Return type
[View]
- defaultEngineBinary()
- Return type
unknown
- defaultEngineBinary(val)
- Arguments
val (
unknown()
) – None
- Return type
void
- defaultEngineModule()
- Return type
unknown
- defaultEngineModule(val)
- Arguments
val (
unknown()
) – None
- Return type
void
- defaultEnginePath()
- Return type
undefined | string
- defaultEnginePath(val)
- Arguments
val (
undefined | string()
) – None
- Return type
void
Methods
addView
- WebViewer.addView(config)
- Arguments
config (
ViewConfig()
) – configuration to be used for the new view.
Adds another 3D view of the scene to the page.
- Returns
A promise with the created View.
- Return type
Promise <View>
advanceExportToSvg
- WebViewer.advanceExportToSvg()
Get the next chunk of the SVG code
- Returns
A promise that resolves to a string containing the next chunk or undefined on completed..
- Return type
Promise <undefined | string>
applyFilter
- WebViewer.applyFilter(filterId)
- Arguments
filterId (
FilterId()
) – None
- Return type
void
beginExportToSvg
- WebViewer.beginExportToSvg(config)
- Arguments
config (
SvgConfig()
) – Allows customization of the resultant SVG.
Setup the env to export the current scene to a two-dimensional SVG representation through stream.
- Returns
A promise that resolves to void when the env is ready.
- Return type
Promise <void>
closeConnection
- WebViewer.closeConnection()
Disconnects the network connection when in CSR mode.
- Return type
void
delayCapping
- WebViewer.delayCapping()
Delays capping processing by a fixed time interval.
- Return type
void
endExportToSvg
- WebViewer.endExportToSvg()
Reset the env after SVG stream export.
- Returns
A promise that resolves to void when the env is reset.
- Return type
Promise <void>
exportToSvg
- WebViewer.exportToSvg(config)
- Arguments
config (
SvgConfig()
) – Allows customization of the resultant SVG.
Exports the current scene to a two-dimensional SVG representation.
- Returns
A promise that resolves to the created SVG string.
- Return type
Promise <string>
fitWorld
- WebViewer.fitWorld(duration)
- Arguments
duration (
number()
) – None
- Return type
Promise <void>
focusInput
- WebViewer.focusInput(focus)
- Arguments
focus (
boolean()
) – if true, the Web Viewer will be focused and accept keyboard input, otherwise it will be blurred and not accept keyboard input
Sets whether keyboard input should be directed to this Web Viewer.
- Return type
void
getAllowHighDpi
- WebViewer.getAllowHighDpi()
Gets the current value for high DPI rendering
- Returns
current high DPI setting
- Return type
boolean
getFormatVersionString
- WebViewer.getFormatVersionString()
Returns the format version string.
- Returns
string containing version information for the format.
- Return type
string
getMinimumFramerate
- WebViewer.getMinimumFramerate()
Gets the minimum framerate that will be maintained by the viewer. The viewer will use various culling techniques in order to maintain the value returned.
- Returns
Promise that is resolved when the operation has completed.
- Deprecated
Views can have independent framerates. This should be set using
View.getMinimumFramerate
.- Return type
Promise <number>
getModelReady
- WebViewer.getModelReady()
- Return type
boolean
getRendererType
- WebViewer.getRendererType()
Gets the RendererType this viewer was created with.
- Returns
the render mode.
- Return type
RendererType
getSceneReady
- WebViewer.getSceneReady()
- Return type
boolean
getStatistics
- WebViewer.getStatistics(calculateTotals)
- Arguments
calculateTotals (
boolean()
) – Forces an update of the total count elements. Please note that repeatedly calculating these items can cause a performance impact.
Gets viewer statistics for the current rendered frame. Statistics marked with a (*) below must be calculated and will not be included in the results unless the calculateTotals parameter is true. The values of these items will be cached and only updated during the next call to this method with calculateTotals set to true.
- Returns
an object containing informational key/value pairs | Statistic Name| Description | | ———————– | —————————————————–| | draw_call_count | number of draw calls made when rendering the frame | | frames_per_second | frames per second estimation | | triangle_count | the number of triangles rendered | | line_segment_count | the number of line segments rendered | | point_count | the number of points rendered | | total_element_count(*) | the total number of elements in the scene | | total_triangle_count(*) | the total number of triangles in the scene |
- Return type
Promise <object>
getStreamCutoffScale
- WebViewer.getStreamCutoffScale()
Returns the scale factor that will be applied to the streaming size cutoff. An object whose projected size is lower than the cutoff will not be streamed until its projected size reaches the cutoff. A value of 0 disables the cutoff.
- Return type
number
getStreamingMode
- WebViewer.getStreamingMode()
Gets the streaming mode this viewer was created with.
- Returns
the streaming mode.
- Return type
StreamingMode
getView
- WebViewer.getView(viewKey)
- Arguments
viewKey (
ViewKey()
) – The key of the view to be returned.
Gets a view with the provided key.
- Returns
The view, or undefined if it doesn’t exist.
- Return type
undefined | View
getViewElement
- WebViewer.getViewElement()
Gets the view element for this viewer. This element contains the canvas
- Returns
the view element
- Return type
HTMLDivElement
getViewerVersionString
- WebViewer.getViewerVersionString()
Returns the viewer version string.
- Returns
string containing version information for the viewer.
- Return type
string
moveToWindow
- WebViewer.moveToWindow(win)
- Arguments
win (
Window()
) – the new document that this viewer will be associated with.
This method should be called when the viewer is being moved to a new window. An example use case would be opening a new pop up window.
- Return type
void
pauseRendering
- WebViewer.pauseRendering([callback])
- Arguments
callback (
function()
) – optional If provided, rendering will be paused, the callback will be called, and then rendering will be resumed once the callback returns or throws an exception.
Pauses rendering updates for all views. This function is useful when performing large batches of updates and you would like the result to appear all at once.
- Return type
Promise <void>
- WebViewer.callback()
- Return type
void
redraw
- WebViewer.redraw([callback])
- Arguments
callback (
function()
) – optional A function to be called once the draw is complete. This is provided instead of aPromise
to ensure the callback is called before the start of another redraw.
Forces the viewer to perform a full redraw of all views.
- Return type
void
- WebViewer.callback()
- Return type
void
registerCustomOperator
- WebViewer.registerCustomOperator(operator)
- Arguments
operator (
Operator()
) – None
Associates a custom operator object with a system generated operatorId.
- Returns
an operatorId to be used for this operator.
- Return type
OperatorId
removeView
reset
- WebViewer.reset(durationCameraTransition)
- Arguments
durationCameraTransition (
number()
) – None
Reset the camera, visibility, and transforms to their default state
- Returns
Promise that resolves when the operation has completed.
- Return type
Promise <void>
resetClientTimeout
- WebViewer.resetClientTimeout()
Resets the client timeout to the duration set with setClientTimeout.
- Return type
void
resizeCanvas
- WebViewer.resizeCanvas()
This method should be called after the container element is moved or resized.
- Return type
void
resumeRendering
- WebViewer.resumeRendering()
Resumes rendering for all views.
- Return type
Promise <void>
selectPart
- WebViewer.selectPart(nodeId, selectionMode)
- Arguments
nodeId (
null | number()
) – nodeId of the part to select. Pass null to clear the selection.selectionMode (
SelectionMode()
) – None
Selects a part with the given Id.
- Return type
SelectionType
setAllowHighDpi
- WebViewer.setAllowHighDpi(allow)
- Arguments
allow (
boolean()
) – controls the high DPI Setting.
Controls rendering on high DPI displays. If true, the image will be rendered at full resolution when a high-DPI display is detected. If false, the image may be rendered at a lower resolution. The default value is false. This method may be called any time during or after the sceneReady callback has triggered.
- Return type
void
setCallbacks
- WebViewer.setCallbacks(callbacks)
- Arguments
callbacks (
CallbackMap()
) – object with property names set to corresponding functions to be called when the event occurs.
Registers callbacks that will be called when their corresponding events occur.
- Return type
void
setClientTimeout
- WebViewer.setClientTimeout(timeoutDuration, warningTime)
- Arguments
timeoutDuration (
number()
) – the total time in minutes of inactivity that is allowed before a timeout event occurswarningTime (
number()
) – the number of minutes before issuing a timeoutWarning event
Sets the parameters for client driven timeout monitoring. If no input is recorded for the the duration, the viewer will disconnect and free server resources. Calling this method will reset any pending timeout duration. No timeout will occur when viewing SCS Files. The default value is to disconnect after 15 minutes, with a warning issued after 14 minutes of inactivity. <br><br> <strong>Please note:</strong> Both parameters are required.
- Returns
boolean value indicating whether the timeout values were sucessfully updated
- Return type
boolean
setMinimumFramerate
- WebViewer.setMinimumFramerate(value)
- Arguments
value (
number()
) – The frame rate for the views to maintain.
Sets a minimum frame rate that will be maintained by all views. Views will use various culling techniques in order to maintain the value passed in.
Passing
0
will cause the entire scene to be drawn for every frame.- Returns
Promise that is resolved when the operation has completed.
- Return type
Promise <void>
setServerRenderQuality
- WebViewer.setServerRenderQuality(jpegQualityLow, jpegQualityHigh, scaleLow, scaleHigh)
- Arguments
jpegQualityLow (
number()
) – The JPEG quality of the low quality render framejpegQualityHigh (
number()
) – The JPEG quality of the high quality render framescaleLow (
number()
) – The scale factor for the low quality render framescaleHigh (
number()
) – The scale factor for the high quality render frame
Sets the image quality settings for the high quality and low quality server side render. The low quality settings will be applied during model interaction (camera changes, selection, etc)
- Return type
void
setStreamCutoffScale
- WebViewer.setStreamCutoffScale(value)
- Arguments
value (
number()
) – None
Specifies a scale factor that will be applied to the streaming size cutoff. An object whose projected size is lower than the cutoff will not be streamed until its projected size reaches the cutoff.
This value may also be set for file-based sessions. In that case, when loading an SCS file based assembly via XML, projected size will be calculated on a per-file basis using the bounding information provided in the XML. For additional information, refer to [[Model.loadSubtreeFromXmlBuffer]].
A value of 0 will disable the cutoff. The value should be in the interval of [0.0, 2.0].
- Return type
Promise <void>
setViewOrientation
- WebViewer.setViewOrientation(orientation, duration)
- Arguments
orientation (
ViewOrientation()
) – a [[ViewOrientation]] object specifying back, front, top, etc.duration (
number()
) – the time in milliseconds for the model to transition to the new view orientation.
Sets the orientation of the current model view.
- Return type
Promise <void>
shutdown
- WebViewer.shutdown()
Releases the resources used by the viewer. This method should be called when the viewer is no longer needed but the page is not being reloaded.
- Return type
void
start
- WebViewer.start()
Starts the viewer and begins the loading process
- Return type
boolean
takeSnapshot
- WebViewer.takeSnapshot(config)
- Arguments
config (
SnapshotConfig()
) – None
Creates an Image of the current canvas
- Return type
Promise <HTMLImageElement>
trigger
- WebViewer.trigger(name, id, filename)
- Arguments
name (
bcfLoaded()
) – Noneid (
number()
) – Nonefilename (
string()
) – None
- Return type
void
- WebViewer.trigger(name, id)
- Arguments
name (
bcfRemoved()
) – Noneid (
number()
) – None
- Return type
void
- WebViewer.trigger(name, eventType, nodeIds, initialMatrices, newMatrices)
- Arguments
name (
handleEvent()
) – NoneeventType (
HandleEventType()
) – NonenodeIds (
[number]()
) – NoneinitialMatrices (
[Matrix]()
) – NonenewMatrices (
[Matrix]()
) – None
- Return type
void
- WebViewer.trigger(name, eventType, nodeIds, initialMatrices, newMatrices)
- Arguments
name (
handleEventEnd()
) – NoneeventType (
HandleEventType()
) – NonenodeIds (
[number]()
) – NoneinitialMatrices (
[Matrix]()
) – NonenewMatrices (
[Matrix]()
) – None
- Return type
void
- WebViewer.trigger(name, eventType, nodeIds, initialMatrices)
- Arguments
name (
handleEventStart()
) – NoneeventType (
HandleEventType()
) – NonenodeIds (
[number]()
) – NoneinitialMatrices (
[Matrix]()
) – None
- Return type
void
- WebViewer.trigger(name, cuttingSection, planeIndex)
- Arguments
name (
cuttingPlaneDragStart()
) – NonecuttingSection (
CuttingSection()
) – NoneplaneIndex (
number()
) – None
- Return type
void
- WebViewer.trigger(name, cuttingSection, planeIndex)
- Arguments
name (
cuttingPlaneDrag()
) – NonecuttingSection (
CuttingSection()
) – NoneplaneIndex (
number()
) – None
- Return type
void
- WebViewer.trigger(name, cuttingSection, planeIndex)
- Arguments
name (
cuttingPlaneDragEnd()
) – NonecuttingSection (
CuttingSection()
) – NoneplaneIndex (
number()
) – None
- Return type
void
- WebViewer.trigger(name)
- Arguments
name (
cuttingSectionsLoaded()
) – None
- Return type
void
- WebViewer.trigger(name, redlineMarkup)
- Arguments
name (
redlineCreated()
) – NoneredlineMarkup (
RedlineItem()
) – None
- Return type
void
- WebViewer.trigger(name, redlineMarkup)
- Arguments
name (
redlineDeleted()
) – NoneredlineMarkup (
RedlineItem()
) – None
- Return type
void
- WebViewer.trigger(name, redlineMarkup)
- Arguments
name (
redlineUpdated()
) – NoneredlineMarkup (
RedlineItem()
) – None
- Return type
void
- WebViewer.trigger(name)
- Arguments
name (
measurementBegin()
) – None
- Return type
void
- WebViewer.trigger(name, measurement)
- Arguments
name (
measurementCreated()
) – Nonemeasurement (
MeasureMarkup()
) – None
- Return type
void
- WebViewer.trigger(name, measurement)
- Arguments
name (
measurementDeleted()
) – Nonemeasurement (
MeasureMarkup()
) – None
- Return type
void
- WebViewer.trigger(name, measurement)
- Arguments
name (
measurementValueSet()
) – Nonemeasurement (
MeasureMarkup()
) – None
- Return type
void
- WebViewer.trigger(name, measurement)
- Arguments
name (
measurementShown()
) – Nonemeasurement (
MeasureMarkup()
) – None
- Return type
void
- WebViewer.trigger(name, measurement)
- Arguments
name (
measurementHidden()
) – Nonemeasurement (
MeasureMarkup()
) – None
- Return type
void
- WebViewer.trigger(name, noteText)
- Arguments
name (
noteTextCreated()
) – NonenoteText (
NoteText()
) – None
- Return type
void
- WebViewer.trigger(name, noteText)
- Arguments
name (
noteTextHidden()
) – NonenoteText (
NoteText()
) – None
- Return type
void
- WebViewer.trigger(name, noteText)
- Arguments
name (
noteTextShown()
) – NonenoteText (
NoteText()
) – None
- Return type
void
- WebViewer.trigger(name)
- Arguments
name (
walkOperatorActivated()
) – None
- Return type
void
- WebViewer.trigger(name)
- Arguments
name (
walkOperatorDeactivated()
) – None
- Return type
void
- WebViewer.trigger(name, view)
- Arguments
name (
viewCreated()
) – Noneview (
MarkupView()
) – None
- Return type
void
- WebViewer.trigger(name, view)
- Arguments
name (
viewDeleted()
) – Noneview (
MarkupView()
) – None
- Return type
void
- WebViewer.trigger(name, view)
- Arguments
name (
viewLoaded()
) – Noneview (
MarkupView()
) – None
- Return type
void
- WebViewer.trigger(name, position, modifiers)
- Arguments
name (
contextMenu()
) – Noneposition (
Point2()
) – Nonemodifiers (
KeyModifiers()
) – None
- Return type
void
- WebViewer.trigger(name)
- Arguments
name (
beginInteraction()
) – None
- Return type
void
- WebViewer.trigger(name)
- Arguments
name (
endInteraction()
) – None
- Return type
void
unregisterCustomOperator
- WebViewer.unregisterCustomOperator(operatorId)
- Arguments
operatorId (
OperatorId()
) – the ID of the operator that is to be unregistered
Removes a previously registered custom operator from the system.
- Return type
void
unsetCallbacks
- WebViewer.unsetCallbacks(callbacks)
- Arguments
callbacks (
CallbackMap()
) – object with property names set to corresponding functions to be unregistered.
Unregisters callbacks from the system. Note the actual function object passed in must be the same as the one that was registered using setCallbacks.
- Return type
void
waitForIdle
- WebViewer.waitForIdle(config)
- Arguments
config (
function()
) – None
Returns a Promise that will resolve after streaming and associated asynchronous operations complete and the scene is fully drawn.
- Return type
Promise <void>