COLNEO Pro 1.0
Loading...
Searching...
No Matches
View3dAPI

Description

3D Viewer API interface.

API is provided by Javascript object (WebForms, Macros) cnView3dAPI.

Since
11.2014, jh

(c) COLNEO GmbH

Functions

ApiJsonResponse getSceneBoundingBox ()
 
ApiJsonResponse getSceneGlobalTranslation ()
 
INFO
ApiJsonResponse getInfo ()
 
TOOLS
ApiJsonResponse getScreenshot ()
 
VIEWPOINTS
ApiJsonResponse getCurrentViewData ()
 
ApiJsonResponse resetView ()
 
ApiJsonResponse createViewpoint (QString &parentId, QString &name, QVariantMap &options)
 
ApiJsonResponse updateViewpoint (QString &vpId)
 
ApiJsonResponse getViewData (QString &vpId)
 
ApiJsonResponse setViewData (QString &vpId, QVariantMap &data)
 
ApiJsonResponse getViewpointIds ()
 
ApiJsonResponse activateViewpoint (QString &vpId)
 
ApiJsonResponse setHomeViewpointId (QString &vpID)
 
ApiJsonResponse resetHomeViewpoint ()
 
ApiJsonResponse getHomeViewpointId ()
 
ApiJsonResponse getActiveViewpointId ()
 
CAMERA
ApiJsonResponse getCamera ()
 
ApiJsonResponse setCamera (QVariantMap &cam)
 
ApiJsonResponse zoomAll (QVariantMap &opt=QVariantMap())
 
ApiJsonResponse zoomToObjects (QStringList &objectIds, QVariantMap &options=QVariantMap())
 
ApiJsonResponse zoomToPoints (QVariantList &points, QVariantMap &options=QVariantMap())
 
ApiJsonResponse showViewpointHome ()
 
CLIPPING
ApiJsonResponse setClippingPlanes (QVariantMap &clipping)
 
ApiJsonResponse getClippingPlanes ()
 
ApiJsonResponse resetClipping ()
 
PICKING
ApiJsonResponse getPickedPoints ()
 
ApiJsonResponse startPickedPointsLog ()
 
ApiJsonResponse stopPickedPointsLog ()
 
ApiJsonResponse getPickedFaces ()
 
ApiJsonResponse clearPickedFaces ()
 
ApiJsonResponse startPickedFacesLog ()
 
ApiJsonResponse stopPickedFacesLog ()
 
CONFIG
ApiJsonResponse getConfig ()
 
ApiJsonResponse setConfig (QVariantMap &cfg)
 
ApiJsonResponse resetConfig ()
 
NAVIGATION
ApiJsonResponse setNavigationMode (QVariantMap &cfg)
 
ApiJsonResponse getNavigationMode ()
 
OVERLAYS / LEGENDS
ApiJsonResponse createOverlay (QString name, QString content, QVariantMap config=QVariantMap())
 
ApiJsonResponse removeOverlay (QString id)
 
ApiJsonResponse clearOverlays ()
 
ApiJsonResponse getOverlayIds ()
 
ApiJsonResponse getOverlay (QString id)
 
ApiJsonResponse setOverlayContent (QString id, QString content)
 
ApiJsonResponse setOverlayName (QString id, QString name)
 
ApiJsonResponse setOverlayConfig (QString id, QVariantMap config)
 
ApiJsonResponse getOverlayConfig (QString id)
 
ApiJsonResponse showOverlay (QString id)
 
ApiJsonResponse hideOverlay (QString id)
 
ApiJsonResponse hideAllOverlays ()
 
ApiJsonResponse showAllOverlays ()
 

Function Documentation

◆ activateViewpoint

ApiJsonResponse activateViewpoint ( QString & vpId)
slot

Activates a viewpoint linked to a SmartSet.

Parameters
vpIdID of SmartSet associated with the view point.
Returns
True if SmartSet has a view point and could be activated, else false.
data: boolean
Since
1.0, Aug 2025

◆ clearOverlays

ApiJsonResponse clearOverlays ( )
slot

Remove/Delete all overlays.

Since
1.0, 08.2025, jh

◆ clearPickedFaces

ApiJsonResponse clearPickedFaces ( )
slot
Since
1.0.0, 2025.02, jh

◆ createOverlay

ApiJsonResponse createOverlay ( QString name,
QString content,
QVariantMap config = QVariantMap() )
slot

Create a new overlay in 3D view.

Parameters
name
contentHTML content of overlay/legend
config
{
"position" : [ x:int , y:int ]
}
Returns
Id of newly created overlay
data : string
Since
1.0, 08.2025, jh

◆ createViewpoint

ApiJsonResponse createViewpoint ( QString & parentId,
QString & name,
QVariantMap & options )
slot

Creates a viewpoint.

A viewpoint is created as Smartset with a view (camera, clipping) attached.
To delete a viewpoint, use method cnCoreAPI.deleteObject(id).

Parameters
parentIdParent to which the Smartset is appended. To append the Smartset on top level, use the ID returned by cnCoreAPI.getSmartSetsRootId(domain).
nameName of the new Viewpoint/Smartset.
options
{
"visible": true,
"styles": false,
"clipping": false,
"redlining" : false
...
}
Returns
ID of the newly created SmartSet which is equivalent to viewpoint ID (viewpoint is attached to smartset)
data : string
Since
1.0, Nov 2025, jh

◆ getActiveViewpointId

ApiJsonResponse getActiveViewpointId ( )
slot

Get ID of active viewpoint.

Returns
ID of the currently active viewpoint for the current project, if set, otherwise an error code.
data: string
Since
1.0, Mar 2026

◆ getCamera

ApiJsonResponse getCamera ( )
slot

Returns the current camera configuration of the 3D viewport.

This method retrieves the complete state of the currently active camera and returns it as a JSON-compatible structure (QVariantMap) in the API response data field.

Returns
camera configuration as JSON
{
"far": 15000,
"lookat": [
0,
0,
23.768959045410156
],
"near": 0.10000000149011612,
"position": [
-171.1416778564453,
-171.1416778564453,
66.55438232421875
],
"up": [
0,0,1
]
}
Since
1.0.0, Jan 2026

◆ getClippingPlanes

ApiJsonResponse getClippingPlanes ( )
slot
Since
1.0.0, 2025.02, jh

◆ getConfig

ApiJsonResponse getConfig ( )
slot

Get the current configuration of the 3D viewer.

See also
setConfig()
Since
1.0, Feb 2025, jh

◆ getCurrentViewData

ApiJsonResponse getCurrentViewData ( )
slot

Get current view.

Returns
JS object containing view data.
{
"camera": {
"position": [-20.0, -20.0, 5.0],
"lookat": [0.0, 0.0, 0.0],
"up": [0.0, 0.0, 1.0]
},
"clipping": [
{
"normal": [1.0, 0.0, 0.0],
"refpoint": [3.0, 1.0, 1.0] // picked point
}
],
"redlining": [
{
"type": "Line",
"pen": {
"color": "#ff0000",
"width": 3,
"style": 1
},
"brush": {
},
"box": [0.0, 0,0, 10.0, 4.0]
}
]
}
Since
1.0, Aug 2025, sl

◆ getHomeViewpointId

ApiJsonResponse getHomeViewpointId ( )
slot

Get ID of home viewpoint.

Returns
ID of the currently set home viewpoint for the current project, if set, otherwise an error code.
data: string
Since
1.0, 11.2025

◆ getInfo

ApiJsonResponse getInfo ( )
slot

Get info about OpenGL version etc.

Since
1.0, 10.2025, jh

◆ getNavigationMode

ApiJsonResponse getNavigationMode ( )
slot
Since
1.0.0, 2025.02, jh

◆ getOverlay

ApiJsonResponse getOverlay ( QString id)
slot

Get overlay.

Returns
JavaScript object containing the overlay data such as id, name, html content and position.
Since
1.0, Sep 2025, sl

◆ getOverlayConfig

ApiJsonResponse getOverlayConfig ( QString id)
slot

Get config data (position etc) of overlay.

{
"position" : [ x:int, y:int ]
}
Since
1.0, 08.2025, jh

◆ getOverlayIds

ApiJsonResponse getOverlayIds ( )
slot

Get IDs of all overlays.

Since
1.0, 08.2025, jh

◆ getPickedFaces

ApiJsonResponse getPickedFaces ( )
slot
Since
1.0.0, 2025.02, jh

◆ getPickedPoints

ApiJsonResponse getPickedPoints ( )
slot
Since
1.0.0, 2025.02, jh

◆ getSceneBoundingBox

ApiJsonResponse getSceneBoundingBox ( )
slot

Get bounding box of scene, i.e. of all objects in coordination model

Since
1.0, 02.206, jh

◆ getSceneGlobalTranslation

ApiJsonResponse getSceneGlobalTranslation ( )
slot

Get global/internal translation of scene from global coordinates to internal coordinates. Note: Mainly for development and testing prurposes.

Since
1.0, 02.2026, jh

◆ getScreenshot

ApiJsonResponse getScreenshot ( )
slot

Get current view as Base64 encoded string.

Returns
data: string (base64 encoded)
Since
1.0, 2025.02, jh

◆ getViewData

ApiJsonResponse getViewData ( QString & vpId)
slot
Since
1.0, 11.2025, jh

◆ getViewpointIds

ApiJsonResponse getViewpointIds ( )
slot

Retrieves the IDs of all viewpoints in the design domain. Containers are not included in the list.

Returns
list of all viewpoints except containers
Note
: The method currently only searches the Design domain. Additional domains will also be offered in the future.
Since
1.0, 11.2025, jh

◆ hideAllOverlays

ApiJsonResponse hideAllOverlays ( )
slot

Hide all overlays

Since
1.0, 08.2025, jh

◆ hideOverlay

ApiJsonResponse hideOverlay ( QString id)
slot

Hide overlay.

Since
1.0, 08.2025, jh

◆ removeOverlay

ApiJsonResponse removeOverlay ( QString id)
slot

Remove (delete) overlay

Parameters
idId of overlay
Returns
Since
1.0, 08.2025, jh

◆ resetClipping

ApiJsonResponse resetClipping ( )
slot
Since
1.0.0, 2025.02, jh

◆ resetConfig

ApiJsonResponse resetConfig ( )
slot

Reset the current 3D viewer configuration to the default settings.

Since
1.0, Aug 2025, sl

◆ resetHomeViewpoint

ApiJsonResponse resetHomeViewpoint ( )
slot

Reset home viewpoint.

Returns
true if a home viewpoint exists and reset was successful, else false.
data: boolean
Since
1.0, 11.2025

◆ resetView

ApiJsonResponse resetView ( )
slot

Reset view ==> clearSelection(), showAll(), resetClipping()

Since
1.0, 03.2026, jh

◆ setCamera

ApiJsonResponse setCamera ( QVariantMap & cam)
slot

Sets the camera configuration of the 3D viewport.

This method updates the currently active camera based on the provided JSON-compatible structure (QVariantMap). It validates the presence, type, and basic constraints of all required fields before applying the configuration.

Parameters
cam= { "near": number, // Near clipping plane distance, must be > 0 "far": number, // Far clipping plane distance, must be > near "position": [ number, number, number ], // Camera position in world coordinates "lookat": [ number, number, number ], // Point the camera is looking at "up": [ number, number, number ] // Up vector, must be non-zero }
See also
getCamera()
Since
1.0.0, Jan 2026

◆ setClippingPlanes

ApiJsonResponse setClippingPlanes ( QVariantMap & clipping)
slot
Since
1.0.0, 2025.02, jh

◆ setConfig

ApiJsonResponse setConfig ( QVariantMap & cfg)
slot

Set configuration of 3D viewer.

Parameters
cfgConfiguration object (JSON)
const cfg = {
"background_color": "#ffffff",
"selection_color": "#ffa664ff",
"fastpaint": true,
"edges": {
"enabled": true,
"color": "#5c5c5cff"
},
"grid": {
"enabled": true,
"color": "#e0e0e0ff",
...
},
"draw_openings": true,
"draw_spaces": true,
...
}
Note
Color values must be provided in hexadecimal RGB(A) format
Since
1.0, Feb 2025, jh

◆ setHomeViewpointId

ApiJsonResponse setHomeViewpointId ( QString & vpID)
slot

Set viewpoint with ID 'vpID' as home viewpoint for the current project.

If an empty ID or non-existent ID is passed, an error code is returned.

Parameters
vpIDID of the viewpoint that is to be set as the home viewpoint
Returns
true if home viewpoint changed, else false. In case of an invalid id check status code.
data: boolean
Since
1.0, 11.2025

◆ setNavigationMode

ApiJsonResponse setNavigationMode ( QVariantMap & cfg)
slot

Set navigation mode of 3D view.

Available modes:
[ orbit , walk, clip, measure, redline ]

Parameters
cfg= { "mode" : " ... mode ... " }
Since
1.0.0, 2025.02, jh

◆ setOverlayConfig

ApiJsonResponse setOverlayConfig ( QString id,
QVariantMap config )
slot

Get config data (position etc) of overlay

Parameters
config
{
"position" : [ x:int , y:int ]
}
Since
1.0, 08.2025, jh

◆ setOverlayContent

ApiJsonResponse setOverlayContent ( QString id,
QString content )
slot

Set HTML content of overlay

Since
1.0, 08.2025, jh

◆ setOverlayName

ApiJsonResponse setOverlayName ( QString id,
QString name )
slot
Since
1.0, 08.2025, jh

◆ setViewData

ApiJsonResponse setViewData ( QString & vpId,
QVariantMap & data )
slot
Since
1.0, 11.2025, jh

◆ showAllOverlays

ApiJsonResponse showAllOverlays ( )
slot

Show all overlays

Since
1.0, 08.2025, jh

◆ showOverlay

ApiJsonResponse showOverlay ( QString id)
slot

Set overlay visible

Since
1.0, 08.2025, jh

◆ showViewpointHome

ApiJsonResponse showViewpointHome ( )
slot

Show home viewpoint.

Since
1.0, Jun 2025, jh

◆ startPickedFacesLog

ApiJsonResponse startPickedFacesLog ( )
slot
Since
1.0.0, 2025.02, jh

◆ startPickedPointsLog

ApiJsonResponse startPickedPointsLog ( )
slot
Since
1.0.0, 2025.02, jh

◆ stopPickedFacesLog

ApiJsonResponse stopPickedFacesLog ( )
slot
Since
1.0.0, 2025.02, jh

◆ stopPickedPointsLog

ApiJsonResponse stopPickedPointsLog ( )
slot
Since
1.0.0, 2025.02, jh

◆ updateViewpoint

ApiJsonResponse updateViewpoint ( QString & vpId)
slot

Updates a viewpoint.

Unlike updateSmartSets(), which updates the SmartSet structure according to the given rule, this function updates only the viewpoint.

Parameters
vpIdID of viewpoint (SmartSet)
Returns
data : boolean
Since
1.0, Nov 2025

◆ zoomAll

ApiJsonResponse zoomAll ( QVariantMap & opt = QVariantMap())
slot

Adjusts the view to fit the bounding box of all objects (even hidden).

See also
zoomToObjects
Parameters
optOptions (optional)
{
'view' : one of [ 'current' , 'top' , 'left' , 'right' , 'front' , 'back' ]
// 'current' is default, i.e. view direction/vector is not changed
}

Example

// show all objects from top down
const opt = {
'view' : 'top'
}
return cnView3dAPI.zoomAll( opt )
Since
1.0, Aug 2025, sl, 02.2026, jh

◆ zoomToObjects

ApiJsonResponse zoomToObjects ( QStringList & objectIds,
QVariantMap & options = QVariantMap() )
slot

Adjusts the view to fit the bounding box of the given objects.

This method modifies the current view so that all provided objects are visible in the viewport. The method computes the combined bounding box of all valid objects and moves the eye point (camera position) accordingly, so that the entire bounding box fits within the view. The current viewing direction is preserved.

Parameters
objectIdsA list of object IDs. The bounding boxes of the associated objects will be used to compute the zoom target.
optionsOptions (optional)
{
'view' : one of [ 'current' , 'top' , 'left' , 'right' , 'front' , 'back' ]
// 'current' is default, i.e. view direction/vector is not changed
}
Returns
data: null
Note
Objects with invalid or undefined geometry may be ignored.
Since
1.0, Aug 2025, sl

◆ zoomToPoints

ApiJsonResponse zoomToPoints ( QVariantList & points,
QVariantMap & options = QVariantMap() )
slot

Adjusts the view to fit the bounding box of the given points.

This method modifies the current view so that all provided points are visible in the viewport. The method computes the combined bounding box of all valid points and moves the eye point (camera position) accordingly, so that the entire bounding box fits within the view. The current viewing direction is preserved.

Parameters
pointsAn array of points. The x, y and z coordinates must be passed on as a list one after the other. The length of the list must be divisible by three.
optionsOptions (optional)
{
'view' : one of [ 'current' , 'top' , 'left' , 'right' , 'front' , 'back' ]
// 'current' is default, i.e. view direction/vector is not changed
}
Returns
data: null
Since
1.0.0, 2026.02, jh