MainPage   Related pages 
List of all members
CoreAPI Reference

Functions

Tools
string addDays (string dateStr, int nrDays)
 
int getCalendarWeek (date dt)
 
string createID ()
 
long calcHashcode (string str)
 
string compressToIfcGuid (string id)
 
string uncompressFromIfcGuid (string ifcGuid)
 
bool checkRegExp (string value, string pattern)
 
double calcSlantedArea (string objId, double angleMin=0.0, double angleMax=45.0)
 
object calcGpsCoordsByStation (string objId, double station)
 
object calcGpsCoordsByModelCoords (double x, double y)
 
object calcModelCoordsByGpsCoords (double lat, double lon)
 
object calcGkCoordsByModelCoords (double x, double y, double z)
 
object calcModelCoordsByGkCoords (double r, double h)
 
object calcGkCoordsByGpsCoords (double lat, double lon)
 
object calcGpsCoordsByGkCoords (double rw, double hw)
 
object convertCoordinates (object coordinates)
 
string idListToStr (array< string > idList)
 
array< string > strToIdList (string strIDList)
 
var mapToExternalIDs (const array< string > cpIDs)
 
var mapFromExternalIDs (const array< string > cpExternalIDs)
 
Files
var getFileInfo (string filePath)
 
string getAbsolutePath (string filePath)
 
string getBaseName (string filePath)
 
string getFileName (string filePath)
 
Application
string getApplicationDirectory ()
 
string getApplicationFilename ()
 
string getApplicationLanguage ()
 
string getVersionAsString ()
 
object getVersion ()
 
bool requireVersion (int major, int minor, int patch)
 
Domains
string getDomainByElement (string objId)
 
Project
string getUserName ()
 
string getProjectName ()
 
string getProjectDirectory ()
 
object getProjectLocation () const
 
object getProjectInfo ()
 
Object Hierarchy
array< string > getContainedElements (string containerId, int maxDepth, bool loadExternal=true)
 
int countContainedElements (string containerId, int maxDepth, bool loadExternal=true)
 
string getParent (string objId)
 
array< string > getOpenings (string objId)
 
array< string > getParts (string objId)
 
Object Links
array< string > getLinkedObjects (string objectIDList, string resultDomains="all", string objectLookupDomains="all")
 
Object Status
bool isVisible (string objId)
 
bool isSelected (string objId)
 
bool isLocked (string objId)
 
bool isWired (string objId)
 
Properties
var getPropertyValue (string objId, string propName, string propType, bool inh=true)
 
array< object > getPropertyValuesByObject (string objId, string filterpattern="*")
 
var getPropertySource (string objId, string propName, string propType, bool inh=true)
 
string getPropertyUnit (string propName, string propType)
 
object getPropertyTypeMetaData (string propName, string propType)
 
array< object > getPropertyTypeList (string domain="all", string filterPattern="*", bool activeOnly=false)
 
array< object > getPropertyTypeListByObject (string objId, string filterPattern="*")
 
bool isPropertyInherited (string objId, string propName, string propType)
 
string getPropertyValueRange (string idList, string propName, string propType, string domainFilter="geometry")
 
var evaluateFormula (string code, string id, string id_otherdomain=string())
 
string prepareJsCode (string code, string id, int dec=-1, string frmt="%L1", int fieldWidth=10, QChar fillChar=QChar())
 
array< string > extractPropertyNames (string code, string startTag="[[", string endTag="]]")
 
array< object > getGlobalProjectProperties ()
 
Geometry
array< object > getPointList (string objId)
 
Alignments / Regions
object getPointOnAlignmentAtStation (string alignmentId, double d)
 
double getStationOfProjectedPoint (string alignmentId, double x, double y, double z=0.0)
 
array< string > getRegionsOfAlignment (string alignmentId)
 
array< object > getRangesOfRegion (string alignmentID, string regionID)
 
double getValueOfAlignmentRegion (string alignmentID, string regionID)
 
Activities
int getTaskMode (string taskID)
 
string getTaskVisualisation (string taskID)
 
string getTaskRestrictionsByTask (string taskID)
 

Function Documentation

◆ addDays

string addDays ( string  dateStr,
int  nrDays 
)
function
Deprecated:
This method will be removed in future versions of DESITE and should not be used for new scripts anymore.

Add days to a given date.

Parameters
dateStrDate to add days to, in ISO format (yyyy-MM-dd)
nrDaysNumber of days to add
Returns
Calculated new date in ISO format (yyyy-MM-dd)
Since
1.0.16
3.2.1, 21 Feb 2023 : deprecated
Deprecated:
This method will be removed in future versions of DESITE and should not be used for new scripts anymore.

◆ calcGkCoordsByGpsCoords

object calcGkCoordsByGpsCoords ( double  lat,
double  lon 
)
function
Deprecated:
This method will be removed in future versions of DESITE and should not be used for new scripts anymore.

Calculate global Gauss-Krueger coordinates from GPS coordinates.

Example:

var obj = desiteAPI.calcGkCoordsByGpsCoords(22.402491, 71.016991);
JSON.stringify(obj, undefined, 2);
Returns
JSON object which contains the coordinate values H ("Hochwert"; northing) and R ("Rechtswert"; easting).
{
"H": 3909631.600654817,
"R": 11924723.272716647
}
Since
2.0.19, 02 Mar 2018
3.3.0, 02 Jun 2023 : deprecated
Deprecated:
Use convertCoordinates() instead.
convertCoordinates({position: {...}, from: "GPS", to: "GaussKruger"})

◆ calcGkCoordsByModelCoords

object calcGkCoordsByModelCoords ( double  x,
double  y,
double  z 
)
function
Deprecated:
This method will be removed in future versions of DESITE and should not be used for new scripts anymore.

Calculate global Gauss-Krueger coordinates from internal model coordinates.
Since the model can be moved and the reference point can be specified by the user, the Gauss-Krueger coordinates can change.

Returns
JSON object which contains the coordinate values H ("Hochwert"; northing), R ("Rechtswert"; easting) and Z (height).

Example:

var obj = desiteAPI.calcGkCoordsByGpsCoords(22.402491, 71.016991, 10.0);
JSON.stringify(obj, undefined, 2);
Returns
{
"H": 5700071.016991,
"R": 2570022.402491,
"Z": 10
}
Since
2.0.19, 02 Mar 2018
3.3.0, 02 Jun 2023 : deprecated
Deprecated:
Use convertCoordinates() instead.
convertCoordinates({position: {...}, from: "Local", to: "GaussKruger"})

◆ calcGpsCoordsByGkCoords

object calcGpsCoordsByGkCoords ( double  rw,
double  hw 
)
function
Deprecated:
This method will be removed in future versions of DESITE and should not be used for new scripts anymore.

Returns GPS coordinates as JSON object.

Example:

var obj = desiteAPI.calcGpsCoordsByGkCoords(11924723.272716647, 3909631.600654817);
JSON.stringify(obj, undefined, 2);
Returns
{
"Lat": 35.23028571362665,
"Lon": 37.6603185283756
}
Since
2.0.19, 02 Mar 2018
3.3.0, 02 Jun 2023 : deprecated
Deprecated:
Use convertCoordinates() instead.
convertCoordinates({position: {...}, zone: "...", from: "GaussKruger", to: "GPS"})

◆ calcGpsCoordsByModelCoords

object calcGpsCoordsByModelCoords ( double  x,
double  y 
)
function
Deprecated:
This method will be removed in future versions of DESITE and should not be used for new scripts anymore.

Calculate global GPS coordinates from internal model coordinates.
Since the model can be moved and the reference point can be specified by the user the GPS coordinates can change.

Example:

var obj = desiteAPI.calcGpsCoordsByModelCoords(11924723.272716647, 3909631.600654817);
JSON.stringify(obj, undefined, 2);
Returns
{
"Lat": 86.49242657261553,
"Lon": 41.17570237573105
}
Since
2.0.19, 02 Mar 2018
3.3.0, 02 Jun 2023 : deprecated
Deprecated:
Use convertCoordinates() instead.
convertCoordinates({position: {...}, from: "Local", to: "GPS"})

◆ calcGpsCoordsByStation

object calcGpsCoordsByStation ( string  objId,
double  station 
)
function
Deprecated:
This method will be removed in future versions of DESITE and should not be used for new scripts anymore.

Calculates the GPS coordinates by a station situated on an alignment.

The alignment is determined by traversing up the object hierarchy until an object of type 'typeBsAlignment' is found. Therefore each direct and indirect child object of an alignment can be passed to the method. The GPS coordinates are returned as a JSON object, if an error occurs during the calculation, an additional error code is written to the JSON object.

Parameters
objId: ID of a bs element
station: The station
Returns
GPS coordinates or error code: 0 - undefined -1 - object not found -2 - alignment not found -3 - station invalid

Example:

{
var obj = desiteAPI.calcGpsCoordsByStation("{16e8fe62-6af7-4b9c-8598-479d310bea1e}-59", 37);
JSON.stringify(obj, undefined, 2);
Lon: 0,
Lat: 0,
Error: -1
}
Since
1.9.0, 19 May 2016
3.3.0, 02 Jun 2023 : deprecated
Deprecated:
Use getPointOnAlignmentAtStation() and convertCoordinates() instead.

◆ calcHashcode

long calcHashcode ( string  str)
function
Deprecated:
This method will be removed in future versions of DESITE and should not be used for new scripts anymore.

Calculate hashcode from a given string.

Since
2.1.4, 15 Nov 2017
3.2.1, 21 Feb 2023 : deprecated
Deprecated:
This method will be removed in future versions of DESITE and should not be used for new scripts anymore.

◆ calcModelCoordsByGkCoords

object calcModelCoordsByGkCoords ( double  r,
double  h 
)
function
Deprecated:
This method will be removed in future versions of DESITE and should not be used for new scripts anymore.

Calculate model coordinates from Gauss-Krueger coordinates.

Since
2.0.19, 02 Mar 2018
3.3.0, 02 Jun 2023 : deprecated
Deprecated:
Use convertCoordinates() instead.
convertCoordinates({position: {...}, zone: "...", from: "GaussKruger", to: "Local"})

◆ calcModelCoordsByGpsCoords

object calcModelCoordsByGpsCoords ( double  lat,
double  lon 
)
function
Deprecated:
This method will be removed in future versions of DESITE and should not be used for new scripts anymore.

Calculate global Gauss-Krueger coordinates from GPS coordinates.

Example:

var obj = desiteAPI.calcModelCoordsByGpsCoords(23.0,50.0);
JSON.stringify(obj, undefined, 2);
Returns
{
"X": 6674573.942654451,
"Y": -2672725.3777886564
}
Since
2.0.19, 02 Mar 2018
3.3.0, 02 Jun 2023 : deprecated
Deprecated:
Use convertCoordinates() instead.
convertCoordinates({position: {...}, from: "GPS", to: "Local"})

◆ calcSlantedArea

double calcSlantedArea ( string  objId,
double  angleMin = 0.0,
double  angleMax = 45.0 
)
function

Calculate the up-facing surface area of an object that is slanted by a given angle (e.g ramps or roofs).
0 <= angleMin <= angleMax <= 180

Parameters
objId: ID of object
angleMin: Min. deviation angle in relation to vector (0,0,1), default = 0.0 [deg]
angleMax: Max. deviation angle in relation to vector (0,0,1), default = 45.0 [deg] (top area criteria)
Returns
Calculated area
Since
1.5.0, 10 dec 2014, sl

◆ checkRegExp

bool checkRegExp ( string  value,
string  pattern 
)
function
Deprecated:
This method will be removed in future versions of DESITE and should not be used for new scripts anymore.

Check regular expression. Wildcards are enabled.

Examples:

var value = 'DESITE MD';
var pattern1 = "DES*";
var pattern2 = "dES*";
console.log( "CHECK 1: " + desiteAPI.checkRegExp( value, pattern1) ); // returns true
console.log( "CHECK 2: " + desiteAPI.checkRegExp( value, pattern2) ); // return false
Since
2.0
3.2.1, 21 Feb 2023 : deprecated
Deprecated:
This method will be removed in future versions of DESITE and should not be used for new scripts anymore.

◆ compressToIfcGuid

string compressToIfcGuid ( string   id)
function
Parameters
id- The input ID can be a default GUID (upper- or lowercase, optional brackets) or a Revit UniqueId.
Examples (all of these are equivalent):
{0D2AB993-45D9-4197-9BC4-B41C8059BA34}
{0d2ab993-45d9-4197-9bc4-b41c8059ba34}
0D2AB993-45D9-4197-9BC4-B41C8059BA34
0d2ab993-45d9-4197-9bc4-b41c8059ba34
0d2ab993-45d9-4197-9bc4-b41c807fc47b-00267e4f
Returns
IFC-GUID (base64 encoded, 22 characters) if conversion from input ID was possible, otherwise an empty string.

Example:

desiteAPI.compressToIfcGuid("0d2ab993-45d9-4197-9bc4-b41c8059ba34"); // returns 0DAhcJHTb1bvl4j1o0MReq
See also
https://technical.buildingsmart.org/resources/ifcimplementationguidance/ifc-guid/
Since
2.0.4, 11 Oct 2016
3.4.3, 21 Aug 2024 : added support for Revit UniqueId

◆ convertCoordinates

object convertCoordinates ( object   coordinates)
function

Converts coordinates from one coordinate system to another, supported values are 'GPS', 'GaussKruger', 'UTM', 'Local' and 'Global'.

Example #1:

let result = desiteAPI.convertCoordinates({ position: { latitude: 51.124213, longitude: 6.855469 }, from: "GPS", to: "GaussKruger" });

Example #2:

let result = desiteAPI.convertCoordinates({ position: { x: 2559936.183, y: 5665814.897, z: 0.0 }, zone: "2", from: "GaussKruger", to: "GPS" });

Example #3:

let result = desiteAPI.convertCoordinates({ position: { x: 349928.672, y: 5665824.905, z: 0.0 }, zone: "32U", from: "UTM", to: "Global" });

Example #4:

let result = desiteAPI.convertCoordinates({ position: { x: 349928.672, y: 5665824.905, z: 0.0 }, from: "Global", to: "Local" });

Example #5:

let result = desiteAPI.convertCoordinates({ position: { x: 2.0, y: 10.0, z: 0.0 }, from: "Local", to: "GPS" });
Returns
Example #1:
{
"error":
{
"code": 0,
"message": "OK"
},
"position":
{
"x":2559932.9043900613,
"y": 5665813.67069443,
"z": 0
},
"zone": "2"
}
Example #2:
{
"error":
{
"code": 0,
"message": "OK"
},
"position":
{
"latitude": 51.12422618875434,
"longitude": 6.855515916017161
}
}
Since
3.3.0, 02 jun 2023

◆ countContainedElements

int countContainedElements ( string   containerId,
int  maxDepth,
bool  loadExternal = true 
)
function
Deprecated:
This method will be removed in future versions of DESITE and should not be used for new scripts anymore.

Recursively count objects (and containers) in container with given ID.

Parameters
containerIdUnique ID of container
maxDepthMaximum Depth of hierarchy to be traversed, 0 for unlimited
loadExternalLoad external data of container with given ID if storage type is external and content type is undefined (default: true). Note: Does not work for nested external storage types yet.
Since
1.0.20, 29 Nov 2012
2.6.1, 06 Aug 2020 : added loading of external stored data (clash runs and selection sets)
3.2.1, 30 Jan 2023 : deprecated
Deprecated:
Use getContainedElements() instead, then get the length of the returned array.
let countContainedElements = desiteAPI.getContainedElements(id, depth).length;

◆ createID

string createID ( )
function

Create a GUID.

Since
2.0

◆ evaluateFormula

var evaluateFormula ( string  code,
string  id,
string  id_otherdomain = string() 
)
function

Evaluate formula with JavaScript, similar to what you can do in a property.

Parameters
codeFormula code
idObject which is used to get property values in variables such as [[cpPercentComplete##xs:double]]
id_otherdomainObject of other domain (yet only domain 'geometry' is supported), e.g. a linked object, the variables must contain the domain. Example: [[cpVolume##xs:double##geometry]]
Returns
Value of formula.
If an error occurred, a string is returned containing an error code:
ERROR#-1 - Could not find object 'id'
ERROR#-2 - Object of other domain not found
ERROR#-3 - Could not get project of object 'id'

Example #1:

var id = '8b5721f3-e2ad-4e2c-b797-ded155fb50e5'; // object
var vol = desiteAPI.getPropertyValue(id, 'cpVolume', 'xs:double');
var code = "1 + [[cpVolume##xs:double]] * Math.sqrt(2)";
var res = desiteAPI.evaluateFormula(code, id);
console.log("Volume: " + vol); // 2.812511618900961
console.log("Result: " + res); // 4.977492075781649

Example #2 (with other domain):

var id = '0943368f-5091-4c45-84b7-76bf0ffcfd38'; // task
var id_otherdomain = '8b5721f3-e2ad-4e2c-b797-ded155fb50e5'; // object
var pcc = desiteAPI.getPropertyValue( id, 'cpPercentComplete', 'xs:double' );
var vol = desiteAPI.getPropertyValue( id_otherdomain, 'cpVolume', 'xs:double' );
var code = "[[cpPercentComplete##xs:double]] * [[cpVolume##xs:double##geometry]]";
var res = desiteAPI.evaluateFormula(code, id, id_otherdomain);
console.log("PercentComplete: " + pcc); // 0.8
console.log("Volume: " + vol); // 2.812511618900961
console.log("RESULT: " + res); // 2.2500092951207686
Since
2.0.3, 10 Oct 2016
2.0.10, 07 Mar 2017 : Moved from AutomationAPI to CoreAPI

◆ extractPropertyNames

array< string > extractPropertyNames ( string   code,
string   startTag = "[[",
string   endTag = "]]" 
)
function
Deprecated:
This method will be removed in future versions of DESITE and should not be used for new scripts anymore.

Extract variables/properties from a formula/code. A property is enclosed by a start tag and an end tag. By default start tag = '[[' and end tag is ']]'. A property consists of a name and a data type separated by ##.

Example:

=SUMLINKED( [[cpVolume##xs:double]] * 1.1 )

Result:

cpVolume##xs:double
Since
2.5.2, 16 Sep 2019
3.2.1, 07 Feb 2023 : deprecated
Deprecated:
This method will be removed in future versions of DESITE and should not be used for new scripts anymore.

◆ getAbsolutePath

string getAbsolutePath ( string  filePath)
function
Returns
A file's absolute path. This doesn't include the file name.

Example: C:/test/myTextFile.txt -> C:/test

Since
2.0.18, 31 jan 2018, jh

◆ getApplicationDirectory

string getApplicationDirectory ( )
function
Returns
The path of the directory in which the application file is included.
Since
1.0.17, 18 jul 2012, jh

◆ getApplicationFilename

string getApplicationFilename ( )
function
Returns
The filename of the application.
Since
2.0.15, 30 aug 2017, ar

◆ getApplicationLanguage

string getApplicationLanguage ( )
virtualfunction
Returns
The current language of the GUI.
Since
2.1.4, 27 nov 2017, jh

◆ getBaseName

string getBaseName ( string  filePath)
function
Returns
The base name of the file. The base name consists of all characters in the file up to (but not including) the first '.' character.

Example: C:/test/myTextFile.txt -> myTextFile

Since
2.0.18, 31 jan 2018, jh

◆ getCalendarWeek

int getCalendarWeek ( date  dt)
function

Get calendar week by date. The format of date must be as in the following example:

Example:

var dt = new Date('Tue, 05 FEB 2009 09:09:00 GMT-0400');
desiteAPI.getCalendarWeek(dt);
Since
1.5.0, 12 oct 2015, jh

◆ getContainedElements

array< string > getContainedElements ( string   containerId,
int  maxDepth,
bool  loadExternal = true 
)
function

Get a list of objects contained in the container with the given ID.
All contained containers are traversed recursively and appended to the list as well. If the object 'containerId' could not be found, an empty list is returned.

Parameters
containerIdUnique ID of container
maxDepthMaximum depth of the hierarchy to be traversed, 0 for unlimited
loadExternalLoad external data of container with given ID if storage type is external and content type is undefined (default: true). Note: Does not work for nested external storage types yet.
Since
1.0.18, 18 Aug 2012
2.6.1, 06 Aug 2020 : added loading of external stored data (clash runs and selection sets)

◆ getDomainByElement

string getDomainByElement ( string  objId)
function

Get domain by object.

Parameters
objIdLookup this object
Returns
domaintype as string, empty string if object could not be found

Example:

var selIdListStr = desiteAPI.getSelected('all');
var selIdList = selIdListStr.split(';');
for( var i=0; i<selIdList.length; i++ ) {
var id = selIdList[i];
if( id.length < 1 ) continue;
var p = desiteAPI.getDomainByElement( id );
console.log("Domain: " + p );
}
Since
2.0.7, 17 dec 2016, jh

◆ getFileInfo

var getFileInfo ( string   filePath)
function

Retrieve detail information on a given file.

Example:

const fileInfo = desiteAPI.getFileInfo('C:\\windows\\explorer.exe');
console.log(JSON.stringify(fileInfo, 0, 4));
Returns
undefined if the file wasn't found, otherwise an object like this:
{
"AbsolutePath": "C:/windows",
"BaseName": "explorer",
"Bytes": 5307536,
"Created": "2023-08-11T08:00:32.214Z",
"FileName": "explorer.exe",
"IsDir": false,
"IsFile": true,
"LastModified": "2023-08-11T08:00:32.375Z",
"LastRead": "2023-08-23T08:13:54.999Z",
"Suffix": "exe"
}
Since
2.1.6, 02 Mar 2018
3.2.5, 23 Aug 2023 : added 'Bytes', changed return to undefined if file was not found

◆ getFileName

string getFileName ( string  filePath)
function
Returns
The name of the file, excluding the path.

Example: C:/test/myTextFile.txt -> myTextFile.txt

Since
2.0.18, 31 jan 2018, jh

◆ getGlobalProjectProperties

array< object > getGlobalProjectProperties ( )
function

Get list of (custom) global project properties.

Returns
Example
[
{
"createdBy": "user",
"createdOn": "2022-05-24T16:33:51",
"datatype": "xs:double",
"description": "A Number",
"name": "MyLength",
"updatedBy": "user",
"updatedOn": "2022-05-24T16:35:10",
"unit": "m",
"value": 123.45
},
{
"createdBy": "user",
"createdOn": "2022-05-24T16:34:04",
"datatype": "xs:date",
"description": "",
"name": "MyDate",
"updatedBy": "user",
"updatedOn": "2022-05-24T16:36:08",
"unit": "",
"value": "2022-05-23T22:00:00.000Z"
}
]
Since
3.0.2, 24 May 2022

◆ getLinkedObjects

array< string > getLinkedObjects ( string  objectIDList,
string  resultDomains = "all",
string  objectLookupDomains = "all" 
)
function

Get objects which are linked to given objects.

Results can be optionally restricted to specific domains.
Passed IDs can be of any domain, but you can optionally use the third parameter to assert that they are of a specific domain or domains.

Parameters
objectIDListObjects to check the links of. Note that all passed IDs must be valid or the returned list will be empty.
resultDomains[optional] domain filter for linked objects to return. Can be a list (like 'geometry;activities'). Default is 'all'.
objectLookupDomains[optional] domain filter for the passed objects (link sources). The method looks up the objects in objectIDList only in these domains. Can also be a list. Default 'all'.
Returns
List of linked object IDs

Examples:

var objList = desiteAPI.getLinkedObjects ( idList );
Returns
All objects (any domain) linked to passed objects (also any domain).
var objList = desiteAPI.getLinkedObjects ( idList, "geometry" );

Same as above, but only linked geometric objects are retrieved.

var objList = desiteAPI.getLinkedObjects ( idList, "geometry", "activities" );

Same as above, but it is ensured that the passed IDs identify tasks (objects of domain 'activities' ).

Note that you will rarely (if ever) need the third parameter as you usually know which kinds of IDs you're passing.

Since
1.0.18, 14 Aug 2012
1.9.0, 19 May 2016 : reverse lookup

◆ getOpenings

array< string > getOpenings ( string  objId)
function

Retrieves all opening objects (if any) for a given object. Openings are sub-elements of a given object.

Parameters
objIdObject for which to get openings of
Returns
List of opening object IDs
Since
1.5.0, 12 may 2015, ah

◆ getParent

string getParent ( string  objId)
function

Get ID of parent element of object with ID 'objId'. If object has no parent, an empty string will be returned.

Since
1.0.18, 18 aug 2012, jh

◆ getParts

array< string > getParts ( string  objId)
function

Get IDs of parts (result of a cut) of object with ID 'objId'. If object has no parts, an empty array will be returned.

Parameters
objIdID of object
Returns
List with Ids of the parts
Since
1.5.0, 04 apr 2016, sl

◆ getPointList

array< object > getPointList ( string  objId)
function

Get points of object as JSON.

Parameters
objIdID of geometric element
var pointList = desiteAPI.getPointList( 'id123ABC' );
pointList = [ { x : 0.0, y : 0.0, z : 0.0 }, { x : 1.0, y : 1.0, z : 2.0 } ]
Since
1.9.1, 26 jul 2016, sl

◆ getPointOnAlignmentAtStation

object getPointOnAlignmentAtStation ( string  alignmentId,
double  d 
)
function

Get point on alignment at specified station length as JSON. If length > alignment length, the end point will be returned.

Station start is not taken into account and has to be substracted from d. See desiteAPI.getPropertyValue(alignmentId, "Alignment:StationStart", "xs:double");

Parameters
alignmentIdAlignment Object ID
dDistance from start
var point = desiteAPI.getPointOfAlignmentAtStation( 'id123ABC', 100.0 );
point = { "x": 88.23, "y": 27.41, "z": 0.0 }
Since
2.0.10, 24 feb 2017, sl

◆ getProjectDirectory

string getProjectDirectory ( )
function
Returns
The directory of the currently opened project. If no project is opened, then there will be an empty string.
Since
1.0.17, 18 jul 2012, jh

◆ getProjectInfo

object getProjectInfo ( )
function

Get project informations as JavaScript object. If no project is opened, most values will be empty.

Returns
{
"ErrorMessage":"",
"ExpireCode":"",
"FileName":"",
"ID":"03619e29-5faa-4a7b-964e-910557c1cde1",
"LongDescription":"",
"NumberCode":"",
"SavedBy":"",
"SavedTimestamp":"",
"SavedWithVersion":"",
"ShortDescription":"",
"ThumbData":""
}
Since
2.2.3, 20 Sep 2018

◆ getProjectLocation

object getProjectLocation ( ) const
function
Deprecated:
This method will be removed in future versions of DESITE and should not be used for new scripts anymore.

Get geographic location of a project.

Returns
Location as JavaScript object.
Since
2.2
3.3.0, 29 Jun 2023 : deprecated, removed all parameters due to location data layout changes
Deprecated:
Use getLocation() instead.

◆ getProjectName

string getProjectName ( )
function
Returns
The name of the currently opened project. If no project is opened, then there will be an empty string.
Since
1.3.6, 26 Apr 2014

◆ getPropertySource

var getPropertySource ( string  objId,
string  propName,
string  propType,
bool  inh = true 
)
function

If the property is a formula, return the formula. Otherwise the value is returned.

Since
1.9.0, 13 may 2016, jh

◆ getPropertyTypeList

array< object > getPropertyTypeList ( string  domain = "all",
string  filterPattern = "*",
bool  activeOnly = false 
)
function

Get available property types for a given domain combination and a specified filter pattern.

Parameters
domainDomain or domains (semicolon-separated) for lookup (default "all")
filterPatternFilter properties by name. Wildcards are supported.
activeOnlyIf set to true, the returned list will only contain Property Types which are active in at least one of the given domains.
var ptList = desiteAPI.getPropertyTypeList( 'activities', 'TEST*' );

Example for return format:

[
{
"DataType": "xs:string",
"DisplayName": "TEST:TEXT",
"Domain": "all",
"Name": "TESTTEXT",
"Unit": ""
},
{
"DataType": "xs:double",
"DisplayName": "TEST-ATTR",
"Domain": "activities",
"Name": "TEST-ATTR",
"Unit": "m"
}
]
Since
2.0.0
2.6.1, 2020-08-27, ah : optional parameter "activeOnly"

◆ getPropertyTypeListByObject

array< object > getPropertyTypeListByObject ( string  objId,
string  filterPattern = "*" 
)
function

Get available property types for a given object ID and a specified filter pattern.

Parameters
objIdID of the object to look up property types for.
filterPatternFilter properties by name. Wildcards are supported.
var taskId = '3d16b4b7-4e1e-4d0f-8729-ed0e0c96e590';
var ptList = desiteAPI.getPropertyTypeListByObject( taskId, 'TEST*' );

Example for return format:
Analogous to getPropertyTypeList() :

[
{
"DataType": "xs:string",
"DisplayName": "TEST:TEXT",
"Domain": "all",
"Name": "TESTTEXT",
"Unit": ""
},
{
"DataType": "xs:double",
"DisplayName": "TEST-ATTR",
"Domain": "activities",
"Name": "TEST-ATTR",
"Unit": "m"
}
]
Since
2.0.16, 17 oct 2017, ah
Remarks
2.4.8, 30 jan 2020, sl: fixed an error concerning inherited project repository properties

◆ getPropertyTypeMetaData

object getPropertyTypeMetaData ( string  propName,
string  propType 
)
function

Get meta data of property type such as display name and unit.

Parameters
pNameName of property type
pTypeData type of property type
Returns
Object containing property type meta data. If an errors occurs, the object contains ERROR and ERROR_NUMBER.
{
"DataType" : "xs:string",
"DisplayName" : "cp:Name",
"Domain" : "all",
"Inheritable" : false,
"Name" : "cpName",
"Unit" : ""
}
Since
2.0.13, 13 May 2017
2.8.7, 22 Mar 2022: added option 'Inheritable'

◆ getPropertyUnit

string getPropertyUnit ( string  propName,
string  propType 
)
function

Get unit of measurement (unit code)

Since
2.2.1, 26 Jun 2018

◆ getPropertyValue

var getPropertyValue ( string  objId,
string  propName,
string  propType,
bool  inh = true 
)
function

Get property value for a loop of visible objects.

var vis = desiteAPI.getVisibleElements('geometry');
for (var i = 0; i < vis.length ; i++) {
var vol = desiteAPI.getPropertyValue( vis[i], 'cpVolume', 'xs:double' );
if (vol == undefined) continue;
console.log(vol);
}

To access project properties use 'GlobalProject' as objId. Built-in properties can be retrieved as well as user defined properties.

Built-in global project properties:

- ShortDescription, xs:string
- LongDescription, xs:string
- NumberCode, xs:string
- ProjectDirectory, xs:string
- VariantNumber, xs:long
- ID, xs:ID
- ProjectUser, xs:string
- ProjectName, xs:string

Example

var prjname = desiteAPI.getPropertyValue( 'GlobalProject', 'ProjectName', 'xs:string' );
Parameters
inh: Check inherited property values. Default is 'true'
Since
1.0.16, 2.7.3 2021-01-13 ek: Example corrected

◆ getPropertyValueRange

string getPropertyValueRange ( string  idList,
string  propName,
string  propType,
string  domainFilter = "geometry" 
)
function
Deprecated:
This method will be removed in future versions of DESITE and should not be used for new scripts anymore.

Get property values/range for a list of objects for specified domain(s).
A range is formatted as [<minValue>/<maxValue>], e.g. [-3,000/2,000].
The values of different domains are concatenated and separated by ';'.

Since
1.0.16
3.2.1, 01 Feb 2023 : deprecated
Deprecated:
Use AutomationAPI::getPropertyValuesByObjectList() in combination with Math.min() and Math.max() - or whatever is required for processing the values.

◆ getPropertyValuesByObject

array< object > getPropertyValuesByObject ( string  objId,
string  filterpattern = "*" 
)
function

Get properties of an object.

Parameters
filterpatternGet only property values of types which name fits filterpattern. Default = '*' (all properties)
Returns
List of objects, see example below for structure

Example:

var idList = desiteAPI.strToIdList(desiteAPI.getSelected());
for( var i in idList ) {
console.log("ID: " + idList[i] );
var pl = desiteAPI.getPropertyValuesByObject( idList[i], '*BBox*' );
console.log( JSON.stringify(pl) );
}

Return:

[
{
"DisplayName": "cp:BBoxMaxX",
"Name": "cpBBoxMaxX",
"Type": "xs:double",
"Unit": "m",
"Value": 49.43439188232422,
"isInherited": false
},
{
"DisplayName": "cp:BBoxDX",
"Name": "cpBBoxDX",
"Type": "xs:double",
"Unit": "m",
"Value": 24.25000120239258,
"isInherited": false
},
]
Since
2.2.2, 13 sep 2018, jh
Remarks
2.4.8, 30 jan 2020, sl: fixed an error concerning inherited project repository properties

◆ getRangesOfRegion

array< object > getRangesOfRegion ( string  alignmentID,
string  regionID 
)
function

Get all ranges of a regions.

Parameters
alignmentIDID of the alignment object
regionIDID of the region
Returns
List of ranges, e.g. [[100.0,120.0],[160.5,180.2]]
See also
int addRangeToRegion( string regionID, double fromStation, double toStation, string alignmentID = string() );
Since
2.2.1, 20 apr 2018, sl

◆ getRegionsOfAlignment

array< string > getRegionsOfAlignment ( string  alignmentId)
function

Get a list with regions (represented by their IDs) of an alignment with given ID.

Parameters
alignmentIdID of the alignment object
Returns
ID list of regions.
See also
string addRegionToAlignment( string alignmentId, object setting );
Since
2.2.1, 20 apr 2018, sl

◆ getStationOfProjectedPoint

double getStationOfProjectedPoint ( string  alignmentId,
double  x,
double  y,
double  z = 0.0 
)
function

Get station (distance from start) of point on alignment. If point is not part of alignment, it will be projected on alignment first!

Station start is not taken into account and must be added. See desiteAPI.getPropertyValue(alignmentId, "Alignment:StationStart", "xs:double");

Parameters
alignmentIdAlignment Object ID
xx-coordinate of point to check
yy-coordinate of point to check
zz-coordinate of point to check (optional)
Returns
Distance from alignment start, -1 if the point cannot be projected onto the alignment or 'alignmentId' is no valid id.
Since
2.0.10, 07 mar 2017, sl

◆ getTaskMode

int getTaskMode ( string  taskID)
function
Return values
1manually scheduled
2automatically scheduled
-1unable to get task 'taskId'
-2unable to get task mode
Since
2.1.6, 15 mar 2018, jh

◆ getTaskRestrictionsByTask

string getTaskRestrictionsByTask ( string  taskID)
function

Get task restrictions assigned to a task.

Parameters
taskIDID of task
Returns
ID of task restrictions (empty if task has no restrictions set)
Since
2.8.5, 14 Oct 2021

◆ getTaskVisualisation

string getTaskVisualisation ( string  taskID)
function

Get task visualisation configuration assigned to a task. Also inherited visualisations are checked. Note: If no visualisation is explicitly assigned to a task, the ID of the default visualisation (named "...") will be returned.

Parameters
taskIDID of task
Returns
ID of task visualisation (empty if task has no visualisation set)
Since
2.2.1, 04 Aug 2018, jh

◆ getUserName

string getUserName ( )
function
Returns
The name of the user.
Since
1.0.17, 15 jun 2012, jh

◆ getValueOfAlignmentRegion

double getValueOfAlignmentRegion ( string  alignmentID,
string  regionID 
)
function

Get the value assigned to a region.

Parameters
alignmentIDID of the alignment object
regionIDID of the region
Returns
value assigned to region.
See also
string addRegionToAlignment( string alignmentID, object setting );
Since
2.2.1, 20 apr 2018, sl

◆ getVersion

object getVersion ( )
function

Get DESITE version information as an object.
Example:

{"major": 2,"minor": 2,"patch": 2,"build": 196}
Since
2.2.2, 31 Aug 2018, ah

◆ getVersionAsString

string getVersionAsString ( )
function

Get DESITE version information as a string, for example "2.2.1".

Since
2.0

◆ idListToStr

string idListToStr ( array< string >  idList)
function

Build a semicolon-separated string from a list of IDs.

Since
2.2.1, 17 jun 2018, jh

◆ isLocked

bool isLocked ( string  objId)
function

Check if an object is locked.

Since
1.9.0, 13 may 2016, ar

◆ isPropertyInherited

bool isPropertyInherited ( string  objId,
string  propName,
string  propType 
)
function

Check if a property value is inherited.

Since
1.3.5, 21 apr 2014, jh

◆ isSelected

bool isSelected ( string  objId)
function

Check if an object is selected.

Since
1.0.20, 24 nov 2012, jh

◆ isVisible

bool isVisible ( string  objId)
function

Objects status which can be visible/hidden, selected/unselected, wireframed, blocked.

Check if an object is visible.

Since
1.0.20, 24 nov 2012, jh

◆ isWired

bool isWired ( string  objId)
function

Check if an object is in wireframe mode.

Since
1.9.0, 13 may 2016, ar

◆ mapFromExternalIDs

var mapFromExternalIDs ( const array< string >  cpExternalIDs)
function

Look up DESITE IDs (cpID) by external IDs (cpExternalID).

Parameters
cpExternalIDsArray of cpExternalIDs
Returns
Object with key = cpExternalID and value = array of cpIDs. Note that the cpIDs are returned as an array because the cpExternalID may not be unique.
Since
3.4.2, 29 May 2024

◆ mapToExternalIDs

var mapToExternalIDs ( const array< string >  cpIDs)
function

Look up external IDs (cpExternalID) by DESITE IDs (cpID).

Parameters
cpIDsArray of cpIDs
Returns
Object with key = cpID and value = cpExternalID. If a cpID of the input is missing in the output, the object was not found or has no cpExternalID.
Since
3.4.2, 29 May 2024

◆ prepareJsCode

string prepareJsCode ( string  code,
string  id,
int  dec = -1,
string  frmt = "%L1",
int  fieldWidth = 10,
QChar  fillChar = QChar() 
)
function
Deprecated:
This method will be removed in future versions of DESITE and should not be used for new scripts anymore.

Prepare a formula, i.e. JavaScript code, by replacing variables.

Parameters
codeCode of formula
idID of object which provides property values.
decNumber of decimals, -1 = all decimals
frmtFormat to format numbers (see Qt)
Since
2.0.14, 12 Jul 2017
3.2.1, 07 Feb 2023 : deprecated
Deprecated:
This method will be removed in future versions of DESITE and should not be used for new scripts anymore.

◆ requireVersion

bool requireVersion ( int  major,
int  minor,
int  patch 
)
function

Returns true if version of current application is equal or higher than required.

Since
2.0

◆ strToIdList

array< string > strToIdList ( string  strIDList)
function

Turn a string of semicolon-separated IDs into a list.

Since
2.2.1, 17 jun 2018, jh

◆ uncompressFromIfcGuid

string uncompressFromIfcGuid ( string  ifcGuid)
function
Parameters
ifcGuId- ID in IFC format (base64 encoded, 22 characters)
Returns
ID in the format: 4F3E15A2-0000-2A06-3133-323934363838
Since
2.0.4, 11 oct 2016, jh

Created: Wed Oct 30 2024 09:33:04