Skip to content

API Reference

Classes

ViewerTHREE.EventDispatcher
PropertyFilter
PropertySelector
AggregateFunctionsEnum
CameraTypesEnum
DataTypesEnum
EventsEnum
OperatorsEnum

Typedefs

ViewerConfiguration : Object

Configuation object used to initialise bimU.io Viewer.

Viewpoint : Object

BCF-compatible viewpoint object.

Camera : Object

BCF-compatible camera object.

ClippingPlane : Object

BCF-compatible clipping plane object.

XYZ : Object

BCF-compatible XYZ object.

TagOptions : Object

Display options for Tag.

Viewer ⇐ THREE.EventDispatcher

Kind: global class
Extends: THREE.EventDispatcher

new Viewer(configs)

bimU.io Viewer main application. You should always create an instance of Viewer by passing the ViewerConfiguration object into the constructor.

Param Type Description
configs ViewerConfiguration Viewer configuation object. See ViewerConfiguration.

Example

let viewerConfigs = {
    domElementId: "viewer",
    THREE: null,
    showFPS: true,
    showUI: false
};
let viewer = new bimU.Viewer(viewerConfigs);

viewer.showDialog(title, body, closeButtonText, okButtonText, [okButtonCallback], [dismissible])

Displays a modal dialog with custom UI.

Kind: instance method of Viewer

Param Type Default Description
title string Modal dialog title in plain text or HTML.
body string Modal dialog body in plain text or HTML.
closeButtonText string Display text of the Close button. Passing a null value will hide the button.
okButtonText string Display text of the OK button. Passing a null value will hide the button.
[okButtonCallback] function Callback function when the OK button is clicked.
[dismissible] boolean true Allow modal to be dismissed by keyboard or overlay click.

viewer.closeDialog()

Closes custom modal dialog.

Kind: instance method of Viewer

viewer.showHelp()

Displays user instructions in a modal dialog.

Kind: instance method of Viewer

viewer.showElementInformation()

Displays selected element properties in a modal dialog.

Kind: instance method of Viewer

viewer.initialize()

Initializes bimU.io Viewer. This function must be called before using any other functions.

Kind: instance method of Viewer

viewer.setViewpoint(viewpointObject)

Sets camera viewpoint and clipping planes.

Kind: instance method of Viewer
See: BCF Documentation

Param Type Description
viewpointObject Viewpoint The BCF compatible viewpoint definition. See Viewpoint.

viewer.getViewpoint() ⇒ Viewpoint

Gets camera viewpoint and clipping planes.

Kind: instance method of Viewer
Returns: Viewpoint - The BCF compatible viewpoint definition. See Viewpoint.
See: BCF Documentation

viewer.setSectionBox(min, max)

Sets the section box orthogonally.

Kind: instance method of Viewer

Param Type Description
min THREE.Vector3 Minimum coordinates (lower-left-rear corner of the box).
max THREE.Vector3 Maximum coordinates (upper-right-front corner of the box).

viewer.setSectionBoxMode(mode)

Sets the transformation mode of the section box.

Kind: instance method of Viewer

Param Type Description
mode string The current transformation mode. Possible values are "custom", "translate", "rotate", and "scale". Default is "custom".

viewer.setProjectionMode(mode, value)

Changes camera parameters directly.

Kind: instance method of Viewer

Param Type Description
mode CameraTypesEnum Perspective camera or orthographic camera.
value number Field of View or View to World Scale.

viewer.isPerspectiveMode() ⇒ boolean

Checks camera type.

Kind: instance method of Viewer
Returns: boolean - Whether current camera is a perspective one.

viewer.toggleSectionbox([isVisible])

Toggles section box visibility.

Kind: instance method of Viewer

Param Type Description
[isVisible] boolean Use true to show the section box or false to hide it. It toggles the visibility if the parameter is not set.

viewer.sectionAroundSelection()

Creates a section box around current selection.

Kind: instance method of Viewer

viewer.anyElementSelected(showWarning) ⇒ boolean

Checks if there's any element selected.

Kind: instance method of Viewer
Returns: boolean - Whether at least one element selected.

Param Type Description
showWarning boolean Whether an event should be dispathed if there's no element selected.

viewer.alignToView(viewOrientation)

Aligns current camera to an orthogonal view.

Kind: instance method of Viewer

Param Type Description
viewOrientation string Valid values: 'top', 'bottom', 'front', 'back', 'left', 'right'.

viewer.zoomToFit()

Zooms model extent to fit current viewport.

Kind: instance method of Viewer

viewer.zoomToSelection()

Moves camera to focus on current selection.

Kind: instance method of Viewer

viewer.getBoundingBoxBySelection() ⇒ THREE.Box3

Returns a bounding box of selected elements.

Kind: instance method of Viewer
Returns: THREE.Box3 - Represents an axis-aligned bounding box (AABB) in 3D space.

viewer.zoomToObject(object3D)

Moves camera to focus on a particular 3D object.

Kind: instance method of Viewer

Param Type Description
object3D THREE.Object3D The base class for most objects in Three.js.

viewer.loadModel(modelConfigs, onProgress, onLoaded, onError)

Loads model from bimU.io server.

Kind: instance method of Viewer

Param Type Description
modelConfigs object Model configuration object.
onProgress function Callback when model is being downloaded.
onLoaded function Callback when model is fully loaded.
onError function Callback when an error occurs.

viewer.unselectAllElements()

Unselects all selected elements.

Kind: instance method of Viewer

viewer.unhideAllElements()

Makes all hidden elements visible.

Kind: instance method of Viewer

viewer.resetVisibility()

Unhides all elements and clears all section planes.

Kind: instance method of Viewer

viewer.setVisibility(elementIndices, isVisible, [invertOthers])

Makes elements hidden or visible.

Kind: instance method of Viewer

Param Type Description
elementIndices Array.<number> An array of element indices.
isVisible boolean True is visible. False is hidden.
[invertOthers] boolean True to set all other elements inversely. Default is false.

viewer.hideSelectedElements()

Makes all selected elements invisible.

Kind: instance method of Viewer

viewer.isolateSelectedElements()

Hides all unselected elements.

Kind: instance method of Viewer

viewer.isPointInSectionBox(point)

Checks whether a 3D point is within the current section box.

Kind: instance method of Viewer

Param Type Description
point THREE.Vector3 A 3D point.

viewer.clearAllColorOverrides()

Removes color overrides from all elements.

Kind: instance method of Viewer

viewer.getFileProperties(onSuccess, onError)

Retrieves file properties from bimU.io server.

Kind: instance method of Viewer

Param Type Description
onSuccess function Callback when data is received.
onError function Callback when an error occurs.

viewer.getModelMetadata(onSuccess, onError)

Retrieves model metadata from bimU.io server.

Kind: instance method of Viewer

Param Type Description
onSuccess function Callback when data is received.
onError function Callback when an error occurs.

viewer.getElementDataByIndex(elementIndex, onSuccess, onError)

Retrieves model element data (Revit parameters, Navisworks properties, etc.) from bimU.io server.

Kind: instance method of Viewer

Param Type Description
elementIndex number Element index.
onSuccess function Callback when data is received.
onError function Callback when an error occurs.

viewer.toggleFullscreen([isFullScreen])

Activates or exits full screen mode.

Kind: instance method of Viewer

Param Type Description
[isFullScreen] boolean Use true to activate full screen or false to exit. It toggles the full screen mode if the parameter is not set.

viewer.readCoordinates()

Starts user interaction to read XYZ coordinates.

Kind: instance method of Viewer

viewer.measureDistance()

Starts user interaction to measure distance point by point.

Kind: instance method of Viewer

viewer.measureHeight()

Starts user interaction to measure height by three points.

Kind: instance method of Viewer

viewer.measureAngle()

Starts user interaction to measure angles by a triangle formed by three points.

Kind: instance method of Viewer

viewer.measureArea()

Starts user interaction to measure area by a polygon.

Kind: instance method of Viewer

viewer.clearAllMeasurements()

Removes all current measurements shown in the viewer.

Kind: instance method of Viewer

viewer.setColor(elementIndices, color)

Overrides element color.

Kind: instance method of Viewer

Param Type Description
elementIndices Array.<number> An array of element indices.
color THREE.Color Three.js color object.

viewer.setTexture(elementIndices, texture)

WORK IN PROGRESS. Adds texture to elements.

Kind: instance method of Viewer

Param Type Description
elementIndices Array.<number> An array of element indices.
texture THREE.Texture Texture object.

viewer.addObject(object3D) ⇒ string

Adds an arbitrary 3D object to the viewer.

Kind: instance method of Viewer
Returns: string - UUID of created Object3D.

Param Type Description
object3D THREE.Object3D Three.js Object3D object.

viewer.removeObject(objectId)

Removes an existing 3D object from the viewer.

Kind: instance method of Viewer

Param Type Description
objectId string Three.js Object3D UUID.

viewer.addTag(text, location, [options], [onClick]) ⇒ string

This method adds a 3D sprite to a particular location.

Kind: instance method of Viewer
Returns: string - UUID of created Object3D.

Param Type Description
text string Text to display in tag.
location THREE.Vector3 3D point where tag is placed.
[options] TagOptions Tag display options.
[onClick] function Callback function when tag is clicked.

viewer.removeTag(tagId)

Removes an existing tag from the viewer.

Kind: instance method of Viewer

Param Type Description
tagId string Three.js Object3D UUID.

viewer.getGeometry(elementIndex) ⇒ THREE.BufferGeometry

Returns primitive geometry of a particular model element.

Kind: instance method of Viewer
Returns: THREE.BufferGeometry - Three.js BufferGeometry object.

Param Type Description
elementIndex number Element index.

viewer.getBoundingBox(elementIndices) ⇒ THREE.Box3

Returns the bounding box of particular model elements or the entire model if the parameter is not set.

Kind: instance method of Viewer
Returns: THREE.Box3 - Represents an axis-aligned bounding box (AABB) in 3D space.

Param Type Description
elementIndices number Element index.

viewer.getLocation(elementIndex) ⇒ THREE.Vector3

Returns the center point of a particular model element.

Kind: instance method of Viewer
Returns: THREE.Vector3 - Three.js Vector3 object.

Param Type Description
elementIndex number Element index.

viewer.getElementIndicesBySelection() ⇒ Array.<number>

Returns indices of selected elements.

Kind: instance method of Viewer
Returns: Array.<number> - An array of element indices.

viewer.addCustomButton(domElementId, icon, color, tooltip, callback)

Creates a custom button on the user interface of the viewer.

Kind: instance method of Viewer

Param Type Description
domElementId string DOM element id to use for this button.
icon string Icon string.
color string CSS color keyword, RGBA, or Hex code.
tooltip string Short description.
callback function A callback function when this button is clicked.

viewer.removeDomElement(domElementId)

Removes an existing DOM element by its ID.

Kind: instance method of Viewer

Param Type Description
domElementId string DOM element id to remove.

viewer.setBackgroundColor(color)

Sets background color of the viewer canvas.

Kind: instance method of Viewer

Param Type Description
color number Hexadecimal color. E.g., 0xff0000.

viewer.toggleWireframeMode([isWireframe])

Turns on or off wireframe mode.

Kind: instance method of Viewer

Param Type Description
[isWireframe] boolean Use true to show wireframe or false to hide it. It toggles the wireframe mode if the parameter is not set.

viewer.getScreenshot(openInNewWindow) ⇒ string

Returns screenshot of the viewer canvas.

Kind: instance method of Viewer
Returns: string - A DOMString containing a data URI containing a representation of the screenshot.

Param Type Description
openInNewWindow boolean Whether opens screenshot in a new window/tab.

viewer.getElementDataByQuery(filterExpression, selectExpression, limit, onSuccess, onError)

Retrieves element data from bimU.io server based on a custom query expression.

Kind: instance method of Viewer

Param Type Description
filterExpression string Filter expression string.
selectExpression string Select expression string.
limit number Limit on the number of elements returned.
onSuccess function Callback when data is received.
onError function Callback when an error occurs.

viewer.getElementDataByProperty(propertyFilters, propertySelectors, limit, onSuccess, onError)

Retrieves element data by predefined property filters and selectors.

Kind: instance method of Viewer

Param Type Description
propertyFilters Array.<PropertyFilter> Array of property filters that look for elements satisfying specified conditions.
propertySelectors Array.<PropertySelector> Array of property selectors. Maximum of 5 properties to return.
limit number Limit on the number of elements returned.
onSuccess function Callback when data is received.
onError function Callback when an error occurs.

viewer.aggregateElementProperty(propertyFilters, propertyToAggregate, aggregateFunction, onSuccess, onError)

Retrieves element data by predefined property filters and selectors.

Kind: instance method of Viewer

Param Type Description
propertyFilters Array.<PropertyFilter> Array of property filters.
propertyToAggregate PropertySelector Single property selector that will be aggregated.
aggregateFunction AggregateFunctionsEnum Limit on the number of elements returned. Default is COUNT.
onSuccess function Callback when data is received.
onError function Callback when an error occurs.

viewer.dispose()

Destroys this Viewer instance and releases all resources.

Kind: instance method of Viewer

PropertyFilter

Kind: global class

new PropertyFilter(groupName, propertyName, propertyValue)

This class is used to find elements by a property that satisfies the specified condition. It is similar to the SQL WHERE clause.

Param Type Description
groupName string Property group name.
propertyName string Property name.
propertyValue string Property value.

Example

// Filter out elements that have a property called "Top Constrant" in a "Constraints" group and its value is equal to "Level 1".
let propertyFilter1 = new bimU.PropertyFilter("Constraints", "Top Constrant", "Level 1");
// Filter out elements that have a property called "Height" in a "Dimension" group and its value is greater than 12.34.
let propertyFilter2 = new bimU.PropertyFilter("Dimension", "Height", 12.34);
// Default operator is EQUAL_TO.
propertyFilter2.operator = bimU.OperatorsEnum.GREATER_THAN;

propertyFilter.operator : OperatorsEnum

An operator that determines how the property value is compared. Default is bimU.OperatorsEnum.EQUAL_TO.

Kind: instance property of PropertyFilter

propertyFilter.groupName : string

Property group name

Kind: instance property of PropertyFilter

propertyFilter.propertyName : string

Property name.

Kind: instance property of PropertyFilter

propertyFilter.propertyValue : string | Array.<string> | number | Array.<number>

Property value. Use Array along with IN, NOT_IN, or BETWEEN operators.

Kind: instance property of PropertyFilter

propertyFilter.getExpressionString() ⇒ string

This method returns a SQL equivalent expression for the underlying filter.

Kind: instance method of PropertyFilter
Returns: string - SQL filter expression.

PropertySelector

Kind: global class

new PropertySelector(groupName, propertyName)

This class is used to specify or restrict properties to return. It is similar to the SQL SELECT clause.

Param Type Description
groupName string Property group name.
propertyName string Property name.

Example

// Return a property called "Top Offset" in a "Constraints" group.
let propertySelector1 = new bimU.PropertySelector("Constraints", "Top Offset");
// Default data type is STRING.
propertySelector1.type = bimU.DataTypesEnum.FLOAT;
// Return a property called "Mark" in a "Text" group.
let propertySelector2 = new bimU.PropertySelector("Text", "Mark");
// Rename the property name to "Wall Mark" when data is returned.
propertySelector2.alias = "Wall Mark";

propertySelector.dataType : DataTypesEnum

Data type casting/conversion. Default is bimU.DataTypesEnum.STRING.

Kind: instance property of PropertySelector

propertySelector.groupName : string

Property group name

Kind: instance property of PropertySelector

propertySelector.propertyName : string

Property name.

Kind: instance property of PropertySelector

propertySelector.alias : string

Alias for renaming the property name. It is similar to the SQL AS command. Default is the same as the property name.

Kind: instance property of PropertySelector

propertySelector.getExpressionString() ⇒ string

This method returns a SQL equivalent expression for the underlying selector.

Kind: instance method of PropertySelector
Returns: string - SQL select expression.

AggregateFunctionsEnum

Kind: global class
Read only: true
Properties

Name Type Description
AVG string Calculate the average value of a numeric property.
COUNT string Get the number of matching elements.
MAX string Get the largest value of a numeric property.
MIN string Get the smallest value of a numeric property.
SUM string Calculate the total sum of a numeric property.

new AggregateFunctionsEnum()

Enum for aggregate functions that perform a calculation on property values and return a single value.

CameraTypesEnum

Kind: global class
Read only: true
Properties

Name Type Description
PERSPECTIVE string Perspective projection.
ORTHOGRAPHIC string Orthographic projection.

new CameraTypesEnum()

Enum for camera types.

DataTypesEnum

Kind: global class
Read only: true
Properties

Name Type Description
BOOLEAN string TRUE or FALSE.
INTEGER string Signed integer.
STRING string UTF8-encoded variable-length string.
FLOAT string Floating point number.
TIMESTAMP string W3C date and time formats.

new DataTypesEnum()

Enum for SQL compatible data types.

EventsEnum

Kind: global class
Read only: true
Properties

Name Type Description
ON_MODEL_LOADED string .
ON_MODEL_PROGRESS string .
ON_MODEL_ERROR string .
ON_VIEWER_INITIALIZED string .
ON_VIEWER_STATUS_CHANGED string .
ON_VIEWER_ERROR string .
ON_SELECTION_CHANGED string .
ON_FULL_SCREEN_ENABLED string .
ON_FULL_SCREEN_DISABLED string .
FULL_SCREEN_UNSUPPORTED string .

new EventsEnum()

Enum for events.

OperatorsEnum

Kind: global class
Read only: true
Properties

Name Type Description
EQUAL_TO string Equal to a value. Can be text, number or null.
NOT_EQUAL_TO string Not equal to a value. Can be text, number or null.
IN string Matches any value in a list of values. Can be text or number.
NOT_IN string Does not match any value in a list of values. Can be text or number.
STARTS_WITH string Starts with a text string.
DOES_NOT_START_WITH string Does not start with a text string.
ENDS_WITH string Ends with a text string.
DOES_NOT_END_WITH string Does not end with a text string.
CONTAINS string Contains a text string.
DOES_NOT_CONTAIN string Does not contain a text string.
GREATER_THAN string Greater than a numeric value.
GREATER_THAN_OR_EQUAL_TO string Greater than or equal to a numeric value.
LESS_THAN string Less than a numeric value.
LESS_THAN_OR_EQUAL_TO string Less than or equal to a numeric value.
BETWEEN string Between two numeric values.

new OperatorsEnum()

Enum for comparison and pattern matching operators.

ViewerConfiguration : Object

Configuation object used to initialise bimU.io Viewer.

Kind: global typedef
Properties

Name Type Description
domElementId string DIV element ID
showFPS boolean Whether show FPS meter.
showUI boolean Whether show UI.
buttonColor string CSS color keyword, RGBA, or Hex code for the default UI buttons.

Viewpoint : Object

BCF-compatible viewpoint object.

Kind: global typedef
Properties

Name Type Description
camera Camera Perspective camera or orthographic camera.
clippingPlanes Array.<ClippingPlane> Clipping plane definition.
originatingSystem string Where this viewpoint was created from.

Camera : Object

BCF-compatible camera object.

Kind: global typedef
Properties

Name Type Description
cameraViewPoint XYZ Camera location.
cameraDirection XYZ Camera direction.
cameraUpVector XYZ Camera up vector.
fieldOfView number Camera’s field of view angle in degrees.
viewToWorldScale number Scaling from view to world.

ClippingPlane : Object

BCF-compatible clipping plane object.

Kind: global typedef
Properties

Name Type Description
normal XYZ The normal to the plane.
constant number The negative distance from the origin to the plane along the normal vector.

XYZ : Object

BCF-compatible XYZ object.

Kind: global typedef
Properties

Name Type Description
x number X.
y number Y.
z number Z.

TagOptions : Object

Display options for Tag.

Kind: global typedef
Properties

Name Type Default Description
[shape] string "'circle'" Use 'cicle' or 'rectangular'.
[fontName] string "'Helvetica'" Font name. See https://www.cssfontstack.com/ for more details. FontAwesome is also
[fontSize] number 30 Font size in pixel values (px).
[fontColor] string "'rgba(255, 255, 255, 1)'" CSS color keyword, RBGA, or Hex code for text.
[backgroundColor] string "'rgba(97, 232, 240, 1)'" CSS color keyword, RGBA, or Hex code for background.
[borderColor] string "'rgba(0, 0, 0, 0)'" CSS color keyword, RGBA, or Hex code for border. Default is no border (transparent).
[borderThickness] number 0 Border thickness in pixel values (px).
[visibleBehindObjects] boolean true Whether tag is still visible when behind other objects.
[pulse] boolean false Whether tag has pulse effect.