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

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 ()
 
CAMERA
ApiJsonResponse getCamera ()
 
ApiJsonResponse setCamera (QVariantMap &cam)
 
ApiJsonResponse zoomAll ()
 
ApiJsonResponse zoomToObjects (QStringList &objectIds)
 
ApiJsonResponse zoomToPoints (QVariantMap &pointarray)
 
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, sl

◆ 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,
...
}
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

◆ getCamera

ApiJsonResponse getCamera ( )
slot

...

Returns
{
...
}
Since
1.0.0, ...

◆ 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
}
]
}
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 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

◆ 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
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

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

◆ setCamera

ApiJsonResponse setCamera ( QVariantMap & cam)
slot

...

Parameters
cam= { }
See also
getCamera()
Since
1.0.0, ...

◆ 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 : true | false
Since
1.0, Nov 2025

◆ zoomAll

ApiJsonResponse zoomAll ( )
slot

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

See also
zoomToObjects
Since
1.0, Aug 2025, sl

◆ zoomToObjects

ApiJsonResponse zoomToObjects ( QStringList & objectIds)
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.
Returns
data: null
Note
Objects with invalid or undefined geometry may be ignored.
Since
1.0, Aug 2025, sl

◆ zoomToPoints

ApiJsonResponse zoomToPoints ( QVariantMap & pointarray)
slot
Since
1.0.0, 2025.02, jh