COLNEO Pro 1.0
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 getInfohubSettings ()
 
ApiJsonResponse setInfohubSettings (QVariantMap settings)
 
ApiJsonResponse getStatistics ()
 
PROJECT
ApiJsonResponse create (QVariantMap settings)
 
ApiJsonResponse open (QString filepath)
 
ApiJsonResponse saveAs (QString filepath)
 
ApiJsonResponse archive (QString filepath)
 
MODELS
ApiJsonResponse importModel (QString filepath, QVariantMap importOptions=QVariantMap())
 
ApiJsonResponse exportModels (QString filePath, QStringList modelIds, QVariantMap options)
 
INFOHUB
ApiJsonResponse importModelFromInfohub (QString sid, QVariantMap importOptions=QVariantMap())
 
ApiJsonResponse downloadNode (QString sid, QVariantMap &options)
 
ApiJsonResponse checkSyncStatus (QString id, 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)
 

Function Documentation

◆ archive

ApiJsonResponse archive ( QString filepath)
slot

Creates a project archive (zip).

Parameters
filepath
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 node data (object versi9on) from infohub

Parameters
options
opt = {
"members" : [],
}
Since
1.0, 03.2026, jh

◆ exportModels

ApiJsonResponse exportModels ( QString filePath,
QStringList modelIds,
QVariantMap options )
slot

Exports one or more models to a file in either JSON (.cnjson) or binary (.cnbin) format.

Parameters
filePathAbsolute path to the target file, e.g. "C:/MyModels/Test.cnjson".
modelIdsList of model IDs to export. Only valid model IDs are processed, invalid or non-model IDs are ignored.
optionsExport configuration. If a section key (e.g. "geometry", "properties", "nodes") is missing or explicitly set to null, that category will not be exported.
{
"geometry" : {
"fields": ["vertices", "triangles", "faces", "facets", "styles", "edges"],
"whitelist": true
},
"properties": {
"propertytypes" : ["cnName##xs:string", "cnGuid##xs:ID"],
"whitelist": false,
"typed_properties": false // unused for now
"scripted_properties" : false
},
"nodes": {
"exclude_hidden": false,
"exclude_openings": true,
"exclude_assembly_parts": false
},
...
}
Returns
data: Array<string> // List of model IDs sucessfully exported.
Since
1.0, Oct 2025

◆ 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" : " ... "
}
}
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" : "..."
}
Since
1.0, Sep 2025, 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

◆ 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

◆ importModel

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

Import a model from file. Currenty supported file formats are .ifc, ifcxml, .ifczip, .cpixml, .cnjson or .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

◆ 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

Saves the project under the current file path.

Returns
{
key: value
}
\since 1.0.0
/
/*!
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" : "..."
}
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

◆ 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