![]() |
Infohub JS API
|
Common interface and base class for Model Viewers such as DESITE, COLNEO Pro, Web Viewer, etc.
To create an instance of a ModelViewer use one of the Factory Methods of the specific service classes such as COLNEOproAdapterServices, etc.
Example:
If the user changes the selection or visibility of objects in the 3D-scene these events are thrown:
To connect to these events use connectModelViewer().
Public Member Functions | |
| async | addObjectsToSmartSet (smartSetId, objIds, includeChildren) |
| addSelectionEventListener (listener) | |
| addStyleSchemaToSmartSet (smartSetId, options) | |
| addViewpointToSmartSet (smartSetId, options) | |
| addVisibilityEventListener (listener) | |
| connectModelViewer (on_sc, on_vc, cb) | |
| constructor (t='unknow', n='unknown', v='0.0.0') | |
| createModel (name, domain, settings) | |
| createObject (parentId, data) | |
| createPropertyType (propData, updateExisting) | |
| async | createSmartSet (parentId, name, objectIds, options=null) |
| async | createSmartSetContainer (parentId, name) |
| createSmartSetsFromSchema (schema) | |
| deleteObjects (objIds) | |
| deletePropertyType (ptKeyStr) | |
| async | deleteSmartSet (smartSetId) |
| dump () | |
| get | eDomain () |
| filterObjectsByProperties (objIds, filterExpression) | |
| filterObjectsByStatus (objIds, statusCode, statusFlag) | |
| async | getChildIds (objIdList, depth=0) |
| getDomainByObject (objId) | |
| getInfo () | |
| getModelIds (domains) | |
| getModelMetadata (modelId) | |
| getModuleConfig (moduleConfigName) | |
| getObject (objId, keys) | |
| getObjectIds (domain) | |
| getObjectName (objId) | |
| getObjects (objIdList, opt) | |
| getObjectsRootId (domain) | |
| getPickedPoint () | |
| getProperties (objId, inclPropsFromTypes, filter) | |
| getPropertyTypeInfo (ptKeyStr) | |
| getPropertyTypes (filter) | |
| getPropertyTypesByObject (objId, filter) | |
| getPropertyTypeValues (ptKeyStr, options) | |
| getPropertyValue (objId, ptKeyStr) | |
| getPropertyValues (objIds, ptKeyStr) | |
| getSelectedObjectIds (domains) | |
| getSmartSetsRootId (domain) | |
| async | getView (key) |
| getVisibleObjectIds (domains) | |
| importModel (modelId) | |
| isSelected (objId) | |
| isVisible (objId) | |
| async | mapToExternalID (internalID) |
| async | mapToInternalID (externalID) |
| onSelectionChanged () | |
| onVisibilityChanged () | |
| openUrl (url, target) | |
| removeModel (modelId) | |
| async | removeObjectsFromSmartSet (smartSetId, objIds) |
| removeSelectionEventListener (listener) | |
| removeStyleSchemaFromSmartSet (smartSetId) | |
| removeViewpointFromSmartSet (smartSetId) | |
| removeVisibilityEventListener (listener) | |
| async | restoreProjectContext (context, cb) |
| setAllSelected (domains, flagOnOff) | |
| setAllVisible (domains, flagOnOff) | |
| setModuleConfig (moduleConfigName, settings) | |
| setProperties (objIds, properties) | |
| setPropertiesByMap (propertyMap) | |
| setPropertyValue (objId, ptKeyStr, value) | |
| setSelected (objIds, flagOnOff, options) | |
| async | setView (config) |
| setVisible (objIds, flagOnOff, options) | |
| toggleSelection (objIds) | |
| toggleVisibility (objIds) | |
| updateSmartSets (smartSetIds) | |
| async | zoomTo (config) |
Login, Logout | |
| loginUser (cb, user=null) | |
| loginUser_iam (cb, user=null) | |
| loginUser_idp (cb, user=null) | |
| logoutUser (cb) | |
COLNEO infohub | |
| async | getInfohubSettings () |
| async | setInfohubSettings (settings) |
| async | setInfohubSettingsFromContext (ctx) |
| async | restoreContextFromInfohubSettings (ctx) |
| async | saveInfohubSettings () |
Project | |
| async | getProjectInfo () |
| getProjectId () | |
| getProjectName () | |
| setProjectName (n) | |
| getProjectNumber () | |
| setProjectNumber (nr) | |
| getProjectDirectory (projectId) | |
| saveProject () | |
Object Hierarchy | |
| getParentId (objId) | |
| getRootNodeId (domain) | |
| getRootNodeIdOfSets (domain) | |
Viewpoints | |
| async | showHomeViewpoint () |
| getViewpointIds () | |
| createViewpoint (parentId, options) | |
| updateViewpoint (objId, data) | |
| activateViewpoint (objId) | |
| getViewpointData (objId) | |
| setViewpointData (objId, viewpointData) | |
| deleteViewpoint (objId) | |
Styles | |
| getStyleIds (objID) | |
| getStyles (styleIDs) | |
| createStyle (styleData) | |
| updateStyle (styleId, styleData) | |
| deleteStyles (styleIds) | |
| applyStyleToObjects (styleId, objIds) | |
| resetStylesOfObjects (objIds) | |
| async | resetStyles (domains) |
| activateStyleScheme (smartSetId) | |
Viewer Configuration | |
| async | setConfig (cfg) |
| async | getConfig () |
Viewer Tools | |
| async | transformObject (id, T, includeContained) |
| checkOverlapObjectList (idList, overlapAllowed=0.1, statusCallback=null) | |
| async | calcOptOBB (objIds) |
| async | checkOverlapObjects (id1, id2) |
Public Attributes | |
| _infohub_project_ctx = null | |
| apiName = null | |
| viewerName = null | |
| viewerVersion = null | |
Static Public Attributes | |
| static | eDomain |
| activateStyleScheme | ( | smartSetId | ) |
Activate style scheme.
| {string} | smartSetId - ID the SmartSet/Style Scheme. |
| activateViewpoint | ( | objId | ) |
Activate a viewpoint.
| {string} | objId - Object ID |
| async addObjectsToSmartSet | ( | smartSetId, | |
| objIds, | |||
| includeChildren ) |
Add objects to SmartSet.
| {string} | smartSetId - SmartSet ID. |
| {string[]} | objIds - Object IDs. |
| {boolean} | includeChildren true: tree structure, false: flat list |
| addSelectionEventListener | ( | listener | ) |
add selection listener, no extra call back function
| {*} | listener |
| addStyleSchemaToSmartSet | ( | smartSetId, | |
| options ) |
Add style to SmartSet.
| {string} | smartSetId - ID the SmartSet. |
| {object} | options |
| addViewpointToSmartSet | ( | smartSetId, | |
| options ) |
Add viewpoint to SmartSet.
| {string} | smartSetId - ID the SmartSet. |
| {object} | options |
| addVisibilityEventListener | ( | listener | ) |
add visibility listener, no extra call back function
| {*} | listener |
| applyStyleToObjects | ( | styleId, | |
| objIds ) |
Apply style to objects.
| {string} | styleId - Style ID. |
| {string[]} | objIds - Object IDs. |
| async calcOptOBB | ( | objIds | ) |
Calculate optimized oriented bounding boxes (OBBs) for given object IDs.
| {string[]} | objIds |
| checkOverlapObjectList | ( | idList, | |
| overlapAllowed = 0.1, | |||
| statusCallback = null ) |
Check overlap of oriented bounding boxes (OBBs) for given IDs every object against every other object.
Objects having no geometry are ignored.
| {string[]} | idList |
| {number} | overlapAllowed - Minimum overlap to report (0.0 - 1.0), default: 0.1 |
| {function|null} | statusCallback - Optional callback function to report progress status. |
| async checkOverlapObjects | ( | id1, | |
| id2 ) |
Calculate overlap of oriented bounding boxes (OBBs) for two given object IDs.
| {string} | id1 |
| {string} | id2 |
| connectModelViewer | ( | on_sc, | |
| on_vc, | |||
| cb ) |
@method
@description Connect signals selection changed and visibility changed to given functions.
| {function} | on_sc Function to be called on selection changed, null to disconnect |
| {function} | on_vc Function to be called on visibility changed, null to disconnect |
| {*} | cb |
| constructor | ( | t = 'unknow', | |
| n = 'unknown', | |||
| v = '0.0.0' ) |
| createModel | ( | name, | |
| domain, | |||
| settings ) |
Create model.
Synchronizes with Infohub.
| {string} | name - Model name. |
| {string} | domain - Domain (e.g. 'geo') |
| {object} | settings - Model settings. |
| createObject | ( | parentId, | |
| data ) |
| createPropertyType | ( | propData, | |
| updateExisting ) |
| async createSmartSet | ( | parentId, | |
| name, | |||
| objectIds, | |||
| options = null ) |
Create new SmartSet.
| {string} | parentId Id of parent or domain name (eDomain) for topmost |
| {string} | name Name of the SmartSet. |
| {string[]} | objectIds List of object IDs (root nodes, children will be automatically collected). If all objects should be taken into account, use getObjectsRootId(domain) to get ID of root node of domain and add root node of domain as SmartSet Object only. To add specific objects to a SmartSet (Set by enumeration) use objects which are leafs in the object hierarchy as SmartSet Objects. |
| {object|null} | options Additional options for SmartSet creation. |
{ "filter": { "skip_openings": true, "skip_assembly_parts": false, "visible_only": false }, "group_by": { "propertytypes": [ "ifcEntity##xs:string", "cnVolume##xs:double" ], "options": { "decimal_precision": 4, "case_sensitive": true, "skip_null_values": true, "interval_size": 5.0, "interval_offset": 0.0, "date_grouping": "week" } } }
| async createSmartSetContainer | ( | parentId, | |
| name ) |
Creates a container in smart sets structure.
| {string} | parentId ID of parent |
| {string} | name Name of container |
| createSmartSetsFromSchema | ( | schema | ) |
Create SmartSets from schema.
| {object} | schema - Schema definition. |
| createStyle | ( | styleData | ) |
Get information about specific style / material attributes.
| {string} | styleId - Style ID. |
| {string} | key - If specified, only the corresponding attribute is returned, otherwise the entire object. |
Create a new style / material.
@param {object} styleData - Style definition.
@example
Example styleData: const styleData = { id: "12345", // optional name: "MyStyle", // not empty color: "#rrggbbaa" // valid color value in hexadecimal RGBA format } | createViewpoint | ( | parentId, | |
| options ) |
Create a new viewpoint.
| {string | | null} parentId - ID of parent object |
| {object} | options |
| deleteObjects | ( | objIds | ) |
Delete objects by ID.
Synchronizes data with Infohub.
| {string[]} | objIds - IDs of objects to delete. |
| deletePropertyType | ( | ptKeyStr | ) |
Delete exsisting property type.
Synchronizes with Infohub.
| {string} | ptKeyStr - Access key of property type in the format name##datatype. |
| async deleteSmartSet | ( | smartSetId | ) |
Delete a SmartSet.
| {string} | smartSetId - Id of SmartSet. |
| deleteStyles | ( | styleIds | ) |
Delete styles / materials.
| {string[]} | styleIds - IDs of styles to delete. |
| deleteViewpoint | ( | objId | ) |
Delete a viewpoint.
| {string} | objId - Object ID |
| dump | ( | ) |
Dump info to console @updated 12.01.2026, SW.
| get eDomain | ( | ) |
| filterObjectsByProperties | ( | objIds, | |
| filterExpression ) |
| filterObjectsByStatus | ( | objIds, | |
| statusCode, | |||
| statusFlag ) |
Filter objects by status.
| {string[]} | objIds - Object IDs of objects to filter. |
| {string} | statusCode - one of [ 'selected', 'visible', 'wired', 'locked']. |
| {boolean} | statusFlag - true: status, false: inverted status. |
| async getChildIds | ( | objIdList, | |
| depth = 0 ) |
Collect object Ids contained in objects of objIdList, serach to depth of 'depth' or the complete hiererchy if depth is 0 (default).
| {*} | objIdList Collect child ids from these root objects |
| {*} | depth [optional] Recursion depth, default = 0 (maximum depth) |
| async getConfig | ( | ) |
| getDomainByObject | ( | objId | ) |
Get domain for given object.
| {*} | objId - ID of Object |
| getInfo | ( | ) |
Get name and version of the current ModelViewer.
| async getInfohubSettings | ( | ) |
| getModelIds | ( | domains | ) |
Get model IDs for given domains.
| {eDomain[]} | domains - Domain (e.g. 'all') or combination as array, e.g. ['geo', 'act']. |
| getModelMetadata | ( | modelId | ) |
Get metadata for given model.
| {string} | modelId - Model ID. |
| getModuleConfig | ( | moduleConfigName | ) |
| {string} | moduleConfigName - The name of the module-specific configuration file (e.g., "module_mapping.config"). |
| getObject | ( | objId, | |
| keys ) |
Get object by ID.
Synchronizes data with Infohub.
| {string} | objId - ID of object. |
| getObjectIds | ( | domain | ) |
Get all object IDs for given domains as list.
@param {eDomain[]} domain Domain (e.g. 'all') or combination as array, e.g. ['geo', 'act'].
@returns {ApiResponse<string[]>} Array of object IDs.
@example
// example
modelviewer and gom are defined in index.js like this:
window.Infohub = {}
window.gom = {} window.gom.eDomain = eDomain
Ui.MessageComponent.showInfo("Berechne OOBB ... ")
const objectids = (await Infohub.ModelViewer.getObjectIds( gom.eDomain.GEO )).data
console.log( objectids )
Ui.MessageComponent.showInfo( `Berechne OOBB für ${objectids.length} Objekte ... ` )
let count = 0
for( const id of objectids ) {
... do something count++ if( count % 100 == 0 ) { console.log( calc ... ${count} ) } }
Ui.MessageComponent.showInfo( OOBB wurde für ${objectids.length} Objekte berechnet. , 0 )
| getObjectName | ( | objId | ) |
Get Name for given object.
Usually objects have an built-in ID and Name.
The name is stored in a special property such as cnName in DESITE and cnName in COLNEO pro.
| {*} | objId - ID of Object |
| getObjects | ( | objIdList, | |
| opt ) |
| getObjectsRootId | ( | domain | ) |
Get root object ID for given domain.
| {*} | domain - Domain (e.g. 'geo') |
| getParentId | ( | objId | ) |
Get parent ID of object.
| {string} | objId - Object ID. |
| getPickedPoint | ( | ) |
return { 'intern' : [ ix , iy , iz ], 'global' : [ x , y , z ] }
| getProjectDirectory | ( | projectId | ) |
Get project directory.
| getProjectId | ( | ) |
| async getProjectInfo | ( | ) |
Get project information about local model viewer project.
Get project metadata
"id" : " ... project id ... ", "number" : " ... " "name" : "shortdescription" : "description" : "absolutepath" : " ... local path ... ", "filename" : " ... local file name "}
| getProjectName | ( | ) |
| getProjectNumber | ( | ) |
| getProperties | ( | objId, | |
| inclPropsFromTypes, | |||
| filter ) |
| getPropertyTypeInfo | ( | ptKeyStr | ) |
| getPropertyTypes | ( | filter | ) |
| getPropertyTypesByObject | ( | objId, | |
| filter ) |
| getPropertyTypeValues | ( | ptKeyStr, | |
| options ) |
| getPropertyValue | ( | objId, | |
| ptKeyStr ) |
Get property value for object.
| {string} | objId - Object ID. |
| {string} | ptKeyStr - Access key of property type in the format name##datatype. |
| getPropertyValues | ( | objIds, | |
| ptKeyStr ) |
| getRootNodeId | ( | domain | ) |
Get root node of object trees for a given domain.
| {string} | domain - Domain (e.g. 'geo') |
| getRootNodeIdOfSets | ( | domain | ) |
Get root nodes of smartsets for given domain.
| {string} | domain - Domain (e.g. 'geo') |
| getSelectedObjectIds | ( | domains | ) |
Get IDs of currently selected objects.
| {eDomain[]} | domains - Domain (e.g. 'all') or combination as array, e.g. ['geo', 'act']. |
| getSmartSetsRootId | ( | domain | ) |
| getStyleIds | ( | objID | ) |
Get list of Ids of all available styles.
| getStyles | ( | styleIDs | ) |
Get styles / materials / colors applied to given objects.
| {string[]} | styleIDs - Style IDs. |
| async getView | ( | key | ) |
| getViewpointData | ( | objId | ) |
Get viewpoint data.
| {string} | objId - Object ID |
| getViewpointIds | ( | ) |
| getVisibleObjectIds | ( | domains | ) |
Get IDs of currently visible objects in given domain/domains.
| {eDomain[]} | domains - Domain (e.g. 'all') or combination as array, e.g. ['geo', 'act']. |
| importModel | ( | modelId | ) |
Add model to coordination model.
Synchronizes with Infohub.
| {string} | modelId - Model ID. |
| isSelected | ( | objId | ) |
Check if object is selected.
| {string} | objId - Object ID. |
| isVisible | ( | objId | ) |
Check if object is visible.
| {string} | objId - Object ID. |
| loginUser | ( | cb, | |
| user = null ) |
| loginUser_iam | ( | cb, | |
| user = null ) |
| loginUser_idp | ( | cb, | |
| user = null ) |
| logoutUser | ( | cb | ) |
@description Logout user.
Clear user and token.
| {function} | cb Callback function |
| async mapToExternalID | ( | internalID | ) |
Maps one internal object ID to their corresponding external (IFC) ID.
The returned object uses internal IDs as keys and external IDs as values. In most cases, the internal and external IDs may be identical (except DESITE Version > 3.4.0).
| {string} | internalID - internal element ID |
| async mapToInternalID | ( | externalID | ) |
Maps external (IFC) ID to their corresponding internal element ID(s).
The returned object uses the external ID as keys and internal IDs as values. In most cases, the internal and external IDs may be identical (except DESITE Version > 3.4.0).
| {string} | externalID - external (IFC) ID to be mapped. |
| onSelectionChanged | ( | ) |
| onVisibilityChanged | ( | ) |
| openUrl | ( | url, | |
| target ) |
Open URL/Link in Browser (target = null -> default browser ).
| {*} | url |
| {*} | target Open URL in this target (ignore, no effect now, -> future use for tabs etc.) |
| removeModel | ( | modelId | ) |
remove model from project.
Synchronizes with Infohub.
| {string} | modelId - Model ID. |
| async removeObjectsFromSmartSet | ( | smartSetId, | |
| objIds ) |
Remove objects from SmartSet.
| {string} | smartSetId - SmartSet ID. |
| {string[]} | objIds - Object IDs to remove. |
| removeSelectionEventListener | ( | listener | ) |
remove selection listener, no extra call back function
| {*} | listener |
| removeStyleSchemaFromSmartSet | ( | smartSetId | ) |
Remove style from SmartSet.
| {string} | smartSetId - ID the SmartSet. |
| removeViewpointFromSmartSet | ( | smartSetId | ) |
remove viewpoint to SmartSet.
| {string} | smartSetId - ID the SmartSet. |
| removeVisibilityEventListener | ( | listener | ) |
remove visibility listener, no extra call back function
| {*} | listener |
| async resetStyles | ( | domains | ) |
| resetStylesOfObjects | ( | objIds | ) |
Reset styles to default.
| {string[]} | objIds - Object IDs. |
| async restoreContextFromInfohubSettings | ( | ctx | ) |
| async restoreProjectContext | ( | context, | |
| cb ) |
| async saveInfohubSettings | ( | ) |
Force settings saving.
| saveProject | ( | ) |
Save current project, show SaveFileDialog if project was newly created and no file path is available.
| setAllSelected | ( | domains, | |
| flagOnOff ) |
Set all objects of specified domains as selected or deselected.
Example:
| {boolean} | flagOnOff |
| {string[]} | domains |
| setAllVisible | ( | domains, | |
| flagOnOff ) |
| async setConfig | ( | cfg | ) |
Set viewer configuration.
Changes configuration partially!
| {*} | cfg = { "edges" : bool, // draw edges of objects
"grid" : {
"show" : bool,
"color" : #hex
},
"background" : {
"color" : #hex
}
} |
| async setInfohubSettings | ( | settings | ) |
| {object} | settings { 'scope_id' : ' ... ', 'project_shortid' : ' ... ', 'coordinationmodel_shortid' : ' ... ', 'connected_by' : ' ... ' } |
| async setInfohubSettingsFromContext | ( | ctx | ) |
| setModuleConfig | ( | moduleConfigName, | |
| settings ) |
| {string} | moduleConfigName - The name of the module-specific configuration file (e.g., "module_mapping.config"). |
| {Object} | settings - An object containing configuration values, e.g: { "schema_shortid":"fl0Ke_IGoV8=", } |
| setProjectName | ( | n | ) |
| setProjectNumber | ( | nr | ) |
| setProperties | ( | objIds, | |
| properties ) |
| setPropertiesByMap | ( | propertyMap | ) |
Set properties in a batch by a property map object -> properties.
| {*} | propertyMap { "object id 1" : {
"proptypeid1" : value1,
"proptypeid2" : value2
},
"object id 2" : {
"proptypeid1" : value1,
"proptypeid2" : value2,
"proptypeid3" : value3,
},
} |
| setPropertyValue | ( | objId, | |
| ptKeyStr, | |||
| value ) |
Set single property value.
Synchronizes with Infohub.
| {string} | objId - Object ID. |
| {string} | ptKeyStr - property typeidö in the format name##datatype. |
| {string} | value - New value. |
| setSelected | ( | objIds, | |
| flagOnOff, | |||
| options ) |
Set selection of objects.
| {string[]} | objIds - Object IDs. |
| {boolean} | flagOnOff - Selection flag. |
| {Object} | [options] - Optional configuration object. |
| {boolean} | [options.with_children=false] - Include child objects. |
| {boolean} | [options.exclusively=false] - If true, clear all other selections. |
| async setView | ( | config | ) |
| setViewpointData | ( | objId, | |
| viewpointData ) |
Set viewpoint data.
| {string} | objId - Object ID |
| {object} | viewpointData - Viewpoint data to set. |
| setVisible | ( | objIds, | |
| flagOnOff, | |||
| options ) |
| async showHomeViewpoint | ( | ) |
| toggleSelection | ( | objIds | ) |
Toggle selection status of given objects.
| {string[]} | objIds - Object IDs to toggle. |
| toggleVisibility | ( | objIds | ) |
Toggle visibility of given objects.
| {string[]} | objIds - Object IDs to toggle. |
| async transformObject | ( | id, | |
| T, | |||
| includeContained ) |
Rotate and Translate object.
Rotation is executed first around point 'rotatePoint' with rotation matrix 'rotateMat6rix', then object is translated.
if includeContained is true ont only the geometry of the object itself is transformed but also the included objects ('id' could be a model, a container or an assembly)
| {*} | id |
| {*} | T = { 'move' : [], 'rotate' : { 'pivot' : [ x , y , z ], 'alpha' : val_deg } } |
| updateSmartSets | ( | smartSetIds | ) |
Update SmartSets.
Synchronizes with Infohub.
| {string[]} | smartSetIds - array of SmartSet IDs. |
| updateStyle | ( | styleId, | |
| styleData ) |
Update style / material.
| {string} | styleId - Style ID. |
| {object} | styleData - Updated style data. |
| updateViewpoint | ( | objId, | |
| data ) |
Update existing viewpoint.
| {string} | objId - Object ID |
| {object} | data - Data for the viewpoint in JSON notation |
| async zoomTo | ( | config | ) |
| _infohub_project_ctx = null |
| apiName = null |
|
static |
| viewerName = null |
| viewerVersion = null |