COLNEO Pro 1.2
Loading...
Searching...
No Matches
ProjectAPI

Description

Project API interface.

Register Javascript object with cnProjectAPI.

The Project API provides project related information and functions such as getting/setting project informations, settings, connection to COLNEO infohub project, opening and saving project etc.

Since
1.0, 10.2025

Functions

PROJECT INFO
ApiJsonResponse getInfo (QStringList keys=QStringList())
ApiJsonResponse getDirectory ()
ApiJsonResponse setInfo (QVariantMap projectInfo)
ApiJsonResponse getStatistics ()
PROJECT
ApiJsonResponse create (QVariantMap settings)
ApiJsonResponse open (QString filepath)
ApiJsonResponse saveAs (QString filepath)
ApiJsonResponse archive (QString dirpath, QString filname)
ApiJsonResponse getLocalCoordinationModel ()
MODELS
ApiJsonResponse importModel (QString &filepath, QVariantMap &importOptions=QVariantMap())
ApiJsonResponse exportModels (QString &filePath, QStringList &objectIds, QVariantMap &options)
ApiJsonResponse updateModelFromFile (QString &modelId, QString &filePath, QVariantMap &options=QVariantMap())
INFOHUB
ApiJsonResponse getInfohubSettings ()
ApiJsonResponse setInfohubSettings (QVariantMap settings)
ApiJsonResponse importModelFromInfohub (QString sid, QVariantMap importOptions=QVariantMap())
ApiJsonResponse getObjectsFromInfohub (QStringList &objIds, QVariantMap &options=QVariantMap())
ApiJsonResponse downloadNode (QString sid, QVariantMap &options)
ApiJsonResponse downloadObjects (QString &parentid, QString &node, QVariantMap &params, QVariantMap &options=QVariantMap())
ApiJsonResponse uploadObjects (QString &parentsid, QJsonArray &objecttree, QVariantMap &options=QVariantMap())
ApiJsonResponse checkSyncStatus (QString id, QVariantMap &options)
INFOHUB - COORDINATIONMODEL
ApiJsonResponse getCoordinationModel ()
ApiJsonResponse getCoordinationModelPath (QVariantMap &options)
ApiJsonResponse syncCoordinationModel (QVariantMap &options)
MACROS
ApiJsonResponse getMacroIds ()
ApiJsonResponse getMacro (QString id)
ApiJsonResponse createMacro (QVariantMap macroAsJson)
ApiJsonResponse updateMacro (QString id, QVariantMap macroAsJson)
ApiJsonResponse deleteMacro (QString id)
ApiJsonResponse runMacro (QString id)
PROGRESS
ApiJsonResponse getProgressId ()
ApiJsonResponse createProgress (QString parentid, QString name=QString())
ApiJsonResponse clearProgress (QString id)
ApiJsonResponse resetProgress (QString id)
ApiJsonResponse setProgress (QString id, QVariantMap p)
ApiJsonResponse getProgress (QString id)
ApiJsonResponse countProgressChildren (QString id, int depth)
ApiJsonResponse getProgressChildrenIds (QString id, int depth)
ApiJsonResponse getProgressSubscriberNames (QString id, int depth)
WEBMODULES
ApiJsonResponse getWebmoduleBookmarks ()
ApiJsonResponse addWebmoduleBookmark (QVariantMap &webmodule)
ApiJsonResponse removeWebmoduleBookmark (QString &webmodule_id)
ApiJsonResponse updateWebmoduleBookmark (QString &webmodule_id, QVariantMap &webmodule)
ApiJsonResponse webmodulesSaveToFilesystem ()
ApiJsonResponse webmodulesSaveToInfohub ()
ApiJsonResponse webmodulesRestoreModelFromFilesystem ()
ApiJsonResponse webmodulesRestoreModelFromInfohub ()

Function Documentation

◆ addWebmoduleBookmark

ApiJsonResponse addWebmoduleBookmark ( QVariantMap & webmodule)
slot

Adds a webmodule bookmark from its JSON object representation. If the supplied ID is empty or already exists, a new unique ID is generated.

Parameters
webmoduleWebmodule bookmark fields.
{
"id": "webmodule-1",
"url": "https://www.example.com",
"name": "Example",
"is_homemodule": false,
"preview": "iVBORw0KGgo...",
"icon": "iVBORw0KGgo..."
}
Returns
The created webmodule bookmark.
Since
1.1, 07.2026

◆ archive

ApiJsonResponse archive ( QString dirpath,
QString filname )
slot

Create a project archive.

Create a project archive (cnpzip) on the same level as the project folder (in which the cnp is located) with the same name as the projectfolder and cnpzip as a file extension.

Returns
{
data: ...
}
Since
1.0.0

◆ checkSyncStatus

ApiJsonResponse checkSyncStatus ( QString id,
QVariantMap & options )
slot

Check sync status of object.

Check if object is linked to an object on infohub. Return the sync status.

Since
1.0, 03.2026, jh

◆ clearProgress

ApiJsonResponse clearProgress ( QString id)
slot

Remove all child progress objects. Set progress value to 0, clear progress message,

Since
1.0, 03.2026, jh

◆ countProgressChildren

ApiJsonResponse countProgressChildren ( QString id,
int depth )
slot

Collect children to the depth of 'depth' and return number of progress objects.

Since
1.0, 02.2026, jh

◆ create

ApiJsonResponse create ( QVariantMap settings)
slot

Create a new, empty project.

Parameters
settings
{
name: "",
code: "",
description: ""
}
Returns
Since
1.0

◆ createMacro

ApiJsonResponse createMacro ( QVariantMap macroAsJson)
slot

Create a new macro. If no ID is specified, it is generated automatically.

Parameters
macroAsJsonObject holding the data
{
name: "MyMacro",
desc: "Set all object visible in domain design",
code: "cnCoreAPI.setVisibleAll(true, \"geo\")",
actionName: ""
}
Returns
data: string // ID of new macro
Since
1.0, May 2025

◆ createProgress

ApiJsonResponse createProgress ( QString parentid,
QString name = QString() )
slot

Create a new progress object as child of 'parentid'

Since
1.0, 02.2026, jh

◆ deleteMacro

ApiJsonResponse deleteMacro ( QString id)
slot

...

Parameters
id
Since
1.0.0, ...

◆ downloadNode

ApiJsonResponse downloadNode ( QString sid,
QVariantMap & options )
slot

Download the data of a specific node (object version) from COLNEO infohub given by its ShortId.

Calls GET /{scope}/nodes/{node}/data in the currently connected infohub scope. The response is a single object in GOM notation. The node's child hierarchy is not included.

Parameters
sidNode short ID in the currently connected infohub scope.
optionsOptional selection of GOM members to retrieve. If members is empty, infohub returns its default node data. Typical members are info, properties, geometry, relations, relations_right, annotations, typeinfo, and objecttype.
const options = {
"members" : [ "info", "properties", "geometry" ]
}
Returns
API response whose data member contains one GOM object:
{
"status" : 200,
"data" : {
"info" : { ... },
"properties" : { ... },
"geometry" : { ... }
}
}
Since
1.0, 03.2026, jh

◆ downloadObjects

ApiJsonResponse downloadObjects ( QString & parentid,
QString & node,
QVariantMap & params,
QVariantMap & options = QVariantMap() )
slot

Download objects as tree from node and instantiate objects as child object of parentid

Parameters
parentidCreate downloaded objects as child objects of this object in COLNEO pro
paramsURL parameters for download
Definition gom.options.h:1801
options
Definition gom.options.h:1893
Since
1.1, 06.2026, jh

◆ exportModels

ApiJsonResponse exportModels ( QString & filePath,
QStringList & objectIds,
QVariantMap & options )
slot

Exports one or more models to a file in either JSON (.tree.json), cnZIP (.cnzip), or binary (.cnbin) format.

Parameters
filePathAbsolute path to the target file, e.g. "C:/MyModels/Test.cnjson".
objectIdsList of root object IDs to export.
optionsExport configuration. If a section key (e.g. "geometry", "properties", "nodes") is missing or explicitly set to null, that category will not be exported.
{
"output" : {
"format":
'cnzip_1.0' // file extension .cnzip
| 'cnbin' // *.cnbin
| 'tree.json_1.0' // *.tree.json
| 'obj' // *.obj
| 'cpixml_1.2' // *.cpixml
},
"members" : [ 'geometry' , 'properties' , 'nodes' ],
"geometry" : { // specification of content of geometry
"fields": ["vertices", "triangles", "faces", "facets", "styles", "edges"],
"whitelist": true
},
"properties": {
"propertytypes" : ["cnName##xs:string", "cnGuid##xs:ID"],
"whitelist": false,
"scripted_properties" : false
},
"nodes": {
"exclude_hidden": false, // if true only visible objects are written to output
"exclude_openings": true, // only valid for objects in domain design 'geo'
"exclude_assembly_parts": false // only valid for object in domain design 'geo'
}
}
Returns
data: Array<string> // List of model IDs sucessfully exported.
Since
1.0, Oct 2025

◆ getCoordinationModel

ApiJsonResponse getCoordinationModel ( )
slot

Get connected coordination model on infohub.

Returns
data :
{
}

◆ getCoordinationModelPath

ApiJsonResponse getCoordinationModelPath ( QVariantMap & options)
slot

Gets the node path of the coordination model connected to the current project.

Retrieves the path data from COLNEO infohub and waits until the request has completed. The response status, message, and data returned by Infohub are forwarded unchanged.

Parameters
optionsSpecifies the node data included for each path entry.
{
"members": ["info", "properties", "relations", "relations_right"],
"properties": {
"propertytypes": ["cnName##xs:string", "project:number##xs:string"],
"is_whitelist": true
},
"relations": {
"relation_filter": {
"expose": true,
"relation_names": ["SUCCESSORS"],
"is_whitelist": true
},
"right_objects": {
"members": ["info", "properties"],
"properties": {
"propertytypes": ["cnName##xs:string"],
"is_whitelist": true
}
}
}
}

Property type selections are sent only for whitelist filters. When relations are disabled with relations.relation_filter.expose = false, relation members and relation query parameters are omitted.

Returns
API response containing the ordered node path supplied by Infohub.
{
"status": 200,
"message": "",
"data": [
{
"info": { ... },
"properties": { ... },
"relations": [ ... ],
"relations_right": [ ... ]
}
]
}

Returns status 401 when no Infohub user is logged in. Other HTTP and network errors from the endpoint are returned with their corresponding message.

See also
gom::NodeOptions::toUrlParameters()
https://www.colneo.site/cn_documentation/cn_api_REST/hub/#/Nodes%20%2F%20Hierarchy/get__scope__nodes__node__path_data
Since
1.1, 08.2026, jh

◆ getDirectory

ApiJsonResponse getDirectory ( )
slot

Usable in scripted properties

Gets the directory of the current project.

Returns
Absolute path of the project directory.
data: string
Since
1.0, Dec 2025

◆ getInfo

ApiJsonResponse getInfo ( QStringList keys = QStringList())
slot

Usable in scripted properties

Get project information such as name, ID, created by etc. Also get information about connection to COLNEO infohub.

Parameters
keysIf specified, only the corresponding keys/attributes are returned, otherwise the entire project data.
Returns
data : {
"filePath": "C:/Documents/COLNEO Projects/Test/test.cnp",
"id": "",
"name" : "Test",
"shortDescription" : "",
"createdBy": "max@colneo.email",
"createdOn": "2025-04-09T08:41:17.054Z",
"description": "Test Project",
"executionPeriod": "",
"savedBy": "max@colneo.email",
"savedOn": "2025-04-09T08:41:17.055Z",
"savedWithVersion": "1.0.0",
"properties" : {
"budget##xs:double" : 0.0,
"client##xs:string" : " ... ",
"project:number##xs:string" : "",
"project:phase##xs:string" : "",
},
"infohub" : {
"scope_id" : " ... ",
"project_shortid" : " ... ",
"connected_by" : " ... ",
"coordinationmodel_shortid": " ... ",
"upload_act_folder": "",
"upload_boq_folder": "",
"upload_doc_folder": "",
"upload_geo_folder": "",
"upload_iss_folder": "",
"upload_cst_folder": ""
}
}
See also
getDirectory()
Since
1.0, Jul 2025

◆ getInfohubSettings

ApiJsonResponse getInfohubSettings ( )
slot

Usable in scripted properties

Get infohub settings such as scope and project short id which stores the connection between the local COLNEO pro project and a project on infohub.

Returns
data : {
"scope_id" : " ... ",
"project_shortid" : " ... ",
"connected_by" : " ... ",
"coordinationmodel_shortid": " ... ",
"upload_act_folder": "",
"upload_boq_folder": "",
"upload_doc_folder": "",
"upload_geo_folder": "",
"upload_iss_folder": "",
"upload_cst_folder": ""
}
Since
1.0, Sep 2025, jh

◆ getLocalCoordinationModel

ApiJsonResponse getLocalCoordinationModel ( )
slot

Get the local project struture/coordination model

Returns
data : {
"domains" : [
]
}
Since
1.1, 04.2026, jh

◆ getMacro

ApiJsonResponse getMacro ( QString id)
slot

Get macro data with specified ID.

Parameters
idID of macro.
Returns
{
id: "",
name: "",
desc: "",
code: "",
actionName: ""
}
Since
1.0, May 2025

◆ getMacroIds

ApiJsonResponse getMacroIds ( )
slot

Get IDs of available macros in project.

Returns
List of macro IDs.
data : Array<string>
Since
1.0, May 2025

◆ getObjectsFromInfohub

ApiJsonResponse getObjectsFromInfohub ( QStringList & objIds,
QVariantMap & options = QVariantMap() )
slot

Get object data from infohub.
Collect and return data specified in options.

Parameters
objIdsList of object IDs.
optionsSpecifies which data blocks to retrieve.
Available options:
{
}
Definition gom.options.h:1474
Returns
Objects as JS Object in GOM notation
data: Array<Object>
[
{
"meta" : {...},
"info" : {...},
"properties": {...}
"geometry" : {...},
"relations" : {...},
"nodes" : [ ]
}
]

Example:

const objectIds = [
"3mJ7Qf2a",
"8kP4Xn9c"
];
const options = {
"members": [ "properties", "geometry", "nodes" ],
"properties": {
"propertytypes": [
"cnName##xs:string",
"cnGuid##xs:ID"
],
"is_whitelist": true
},
"geometry": {
"geometry_fields": [ "aabb" ],
"is_whitelist": true
},
"nodes": {
"depth": 1,
"members": [ "info", "properties" ],
"properties": {
"propertytypes": [ "cnName##xs:string" ],
"is_whitelist": true
}
}
};
const response = cnProjectAPI.getObjectsFromInfohub(objectIds, options);
if (response.status === 200) {
response.data.forEach(object => {
console.log(object.info, object.properties, object.geometry.aabb);
});
} else {
console.error(`Could not load objects: ${response.message}`);
}
Since
1.0, Sep 2025
1.1, 07.2026, update to gom notation, jh

◆ getProgress

ApiJsonResponse getProgress ( QString id)
slot

Get progress values of progress object 'id'

Since
1.0, 03.2026, jh

◆ getProgressChildrenIds

ApiJsonResponse getProgressChildrenIds ( QString id,
int depth )
slot

Collect children to the depth of 'depth' and return list of progress ids.

Returns
data : [ id1 , id2, ... ]
Since
1.0, 02.2026, jh

◆ getProgressId

ApiJsonResponse getProgressId ( )
slot

Get ID of root progress object.

Since
1.0, 02.2026, jh

◆ getProgressSubscriberNames

ApiJsonResponse getProgressSubscriberNames ( QString id,
int depth )
slot

Get list of names of object which have to subscribed to this project object or one of its children.

Since
1.0, 03.2026, jh

◆ getStatistics

ApiJsonResponse getStatistics ( )
slot

...

Returns
{
key: value
}
Since
1.0.0

◆ getWebmoduleBookmarks

ApiJsonResponse getWebmoduleBookmarks ( )
slot

Returns all webmodule bookmarks as a JSON array.

Returns
JSON response containing the webmodule bookmarks.
{
"status": 200,
"message": "",
"data": [
{
"id": "webmodule-1",
"url": "https://www.example.com",
"name": "Example",
"is_homemodule": true,
"preview": "",
"icon": ""
}
]
}
Since
1.1, 07.2026

◆ importModel

ApiJsonResponse importModel ( QString & filepath,
QVariantMap & importOptions = QVariantMap() )
slot

Import a model from file. Currently supported file formats include .ifc, .ifcxml, .ifczip, .cpixml, .obj, .cnjson and .cnbin.

Parameters
filepathThe file path of the model file, e.g "C:/MyModels/Test.ifc"
importOptionsOptions for file import
base : {
"updateStyles" : bool,
"createNewIds" : bool
},
design: {
"translation" : [ dx , dy , dz ]
"rotation_point" : [ x , y , z ]
"rotation_angle" : number
"scale" : [ sx , sy , sz ]
},
"citygml" : {
"merge_surfaces" : bool
"import_terrain_intersection" : bool
}
Returns
ID of imported model, else empty string if an error occured.
data: string
Since
1.0, May 2025

◆ importModelFromInfohub

ApiJsonResponse importModelFromInfohub ( QString sid,
QVariantMap importOptions = QVariantMap() )
slot

Download and import model from infohub

The method returns a request id which is sent by the global project progress once the download finishes.

Parameters
sidShortId of document on infohub. Document must be in the current choosen scope.
importOptionsOptions for file import,
See also
importModel()
Returns
data: " ... request-id ..."
Since
1.0, 03.2026, jh

◆ open

ApiJsonResponse open ( QString filepath)
slot

Open the project from a given file path.

Parameters
filepath
Returns
true, if project was opened successful, otherwise false
{
key: value
}
Since
1.0

◆ removeWebmoduleBookmark

ApiJsonResponse removeWebmoduleBookmark ( QString & webmodule_id)
slot

Removes a webmodule bookmark by ID.

Parameters
webmodule_idID of the webmodule bookmark to remove.
Returns
The removed webmodule bookmark.
Since
1.1, 07.2026

◆ resetProgress

ApiJsonResponse resetProgress ( QString id)
slot

Reset all child progress objects. Set progress value to 0, clear progress message,

Since
1.0, 03.2026, jh

◆ runMacro

ApiJsonResponse runMacro ( QString id)
slot

Run (evaluate) a macro

Parameters
idID of macro.
Returns
Result of evaluation
Since
1.0.0, 2025-02-05

◆ saveAs

ApiJsonResponse saveAs ( QString filepath)
slot

Save project under the current file path/name.

If project has not been saved before or is not opened from an existing project, so there is no valid path and name set, this function returns an error (400).

Returns
{
status: 200
data: {
"path" : absolute file path
"name" : filename
}
}
\since 1.0, 04.2026, jh
/
/*!
Saves the project under a new file path.
\param filepath
\returns
\code
{
data: boolean
}
Since
1.0.0

◆ setInfo

ApiJsonResponse setInfo ( QVariantMap projectInfo)
slot

Set Project Information.

Returns
{
data:
}
Since
1.0.0

◆ setInfohubSettings

ApiJsonResponse setInfohubSettings ( QVariantMap settings)
slot

Set infohub settings such as scope and project shortid.
Keys are set partially, only the given keys are changed.

Parameters
settings
{
"scope_id" : " ... ",
"project_shortid" : " ... ",
"connected_by" : " ... ",
"coordinationmodel_shortid": " ... ",
"upload_act_folder": "",
"upload_boq_folder": "",
"upload_doc_folder": "",
"upload_geo_folder": "",
"upload_iss_folder": "",
"upload_cst_folder": ""
}
Returns
true if setting was successfully, else false
data: boolean
Since
1.0, Sep 2025, jh

◆ setProgress

ApiJsonResponse setProgress ( QString id,
QVariantMap p )
slot
Since
1.0, 03.2026, jh

◆ syncCoordinationModel

ApiJsonResponse syncCoordinationModel ( QVariantMap & options)
slot

Synchronizes selected project data with the connected COLNEO infohub coordination model.

The local synchronized##xs:dateTime property is compared with the coordination model's info.updated value. A newer coordination model is downloaded; otherwise, the selected local data is uploaded. On the first synchronization, existing coordination-model project information and styles are downloaded when present, while missing members are populated from the local project and local webmodules are always uploaded as the leading value. The project name maps to ProjectInfo::getName() and the project number maps to project:number##xs:string; project IDs are not synchronized. Webmodules map to the bookmarks member of cmconfig:webmodules##xs:object, and styles map to the styles member of cmconfig:styles##xs:object.

Parameters
optionsMembers selected for synchronization.
{
"sync_webmodules": true,
"sync_name_and_id": true,
"sync_styles": true
}
Returns
API response containing the synchronization direction (from_infohub, to_infohub, or both), timestamps, user, and effective options.
Since
1.1, 08/2026

◆ updateMacro

ApiJsonResponse updateMacro ( QString id,
QVariantMap macroAsJson )
slot

Update a macro. The ID cannot be changed!

Parameters
id
macroAsJson
Returns
True, if macro was updated (changed!) successfully
data : boolean
See also
createMacro()
Since
1.0, May 2025

◆ updateModelFromFile

ApiJsonResponse updateModelFromFile ( QString & modelId,
QString & filePath,
QVariantMap & options = QVariantMap() )
slot

Updates an existing model in the project using the specified model file.

Parameters
modelIdID of the model to update.
filePathFull file path to the new model file.
optionsUpdate options.
{
}
Returns
JSON response containing the update result.
data: ...
Since
1.1, Jul 2026
Remarks
Not implemented yet.

◆ updateWebmoduleBookmark

ApiJsonResponse updateWebmoduleBookmark ( QString & webmodule_id,
QVariantMap & webmodule )
slot

Partially updates an existing webmodule bookmark.

Parameters
webmodule_idID of the webmodule bookmark to update.
webmoduleWebmodule bookmark fields to change.
Returns
The updated webmodule bookmark.
Since
1.1, 07.2026

◆ uploadObjects

ApiJsonResponse uploadObjects ( QString & parentsid,
QJsonArray & objecttree,
QVariantMap & options = QVariantMap() )
slot

Upload objects/tree to COLNEO infohub

Endpoint : POST/PATCH [...service_hub...]/{scope}/v2/nodes/{node}/tree

Specify REST verb in options.

Parameters
parentsidParent ShortID/NodeID
objecttreeTree in GOM JSON notation
options
Definition gom.options.h:1974
Since
1.1, 06.2026, jh

◆ webmodulesRestoreModelFromFilesystem

ApiJsonResponse webmodulesRestoreModelFromFilesystem ( )
slot

Restores the webmodule model from the webmodules directory of the current project.

The current webmodule records are replaced with the records read from the filesystem. The project must have been saved before this method is called.

Returns
JSON response containing the number of restored webmodule records on success.
Since
1.1, 07.2026

◆ webmodulesRestoreModelFromInfohub

ApiJsonResponse webmodulesRestoreModelFromInfohub ( )
slot

Restores the webmodule model from the COLNEO infohub project.

The current webmodule records are replaced with the records received from COLNEO infohub.

Returns
JSON response containing the number of restored webmodule records on success.
Since
1.1, 07.2026

◆ webmodulesSaveToFilesystem

ApiJsonResponse webmodulesSaveToFilesystem ( )
slot

Saves the current webmodule model to the webmodules directory of the current project.

The project must have been saved before this method is called.

Returns
JSON response containing the path of the saved webmodule file on success.
Since
1.1, 07.2026

◆ webmodulesSaveToInfohub

ApiJsonResponse webmodulesSaveToInfohub ( )
slot

Saves the current webmodule model to the COLNEO infohub project.

Returns
JSON response describing whether the webmodule model was saved successfully.
Since
1.1, 07.2026