Application Query Options

n = APPLICATION_QUERY (extension_name, parameter_string, variable1, variable2, ...)

Below is a list of request functions can provide with the help of the APPLICATION_QUERY command.
These request options are given in the extension_name and the parameter_string parameter of the command.
Note, that the query options and return values of an APPLICATION_QUERY may vary according to the execution context.

Compatibility up to ARCHICAD 19: the use of the listed application queries in parameter scripts (or master scripts run as parameter script) could result in unreliable returned values, and causes GDL warnings.
Compatibility starting from ARCHICAD 20: the listed queries cause warnings in parameter scripts, and the return value is either 0 or empty string, according to variable type.

The above restriction applies to:

  • “document_feature”

Document feature


This command can return features of the active document/view.
Currently there is only one feature it can return – the view direction of the document.
These type of queries are restricted from the parameter script and cause GDL warnings.

View direction

n = APPLICATION_QUERY ("document_feature", "view_direction", type)


This command returns the viewing direction of the current document type in which the object is being visualized.
This command has no additional parameters.

type: Returned type values:
"vertical_only": for floor plan
"horizontal_only": for section and elevation generated from 3D (not when the object is placed into a S/E)
"free": for 3D and 3D document
"none"
"unset"

MEP System


This command returns MEP system types and information about MEP systems.
It has more functions which can be addressed via the parameter_string parameter:

Get MEP Systems

DIM d[2][]
n = APPLICATION_QUERY ("MEPSYSTEM", "GetMEPSystems(domain)", d)

domain: MEP classification index (DuctWork – 1, PipeWork – 2) (GDL defines the MEP classifications based on connector class)

d: Array of values:
[2*k-1]: MEP system index
[2*k]: MEP system name

n: Number of MEP systems multiplied by 2.

Get Domain

n = APPLICATION_QUERY ("MEPSYSTEM", "GetDomain(idx)", d)

idx: MEP system index

d: domains (integer)
1: DuctWork
2: PipeWork
3: Duct- and PipeWork
4: Cabling
5: DuctWork and Cabling
6: PipeWork and Cabling
7: DuctWork, PipeWork and Cabling

n: 1 if successful, 0 otherwise

Get Contour Pen

n = APPLICATION_QUERY ("MEPSYSTEM", "GetContourPen(idx)", pen)

idx: MEP system index

pen: contour pen index (integer)

n: 1 if successful, 0 otherwise

Get Fill Pen

n = APPLICATION_QUERY ("MEPSYSTEM", "GetFillPen(idx)", pen)

idx: MEP system index

pen: fill pen index (integer)

n: 1 if successful, 0 otherwise

Get Background Pen

n = APPLICATION_QUERY ("MEPSYSTEM", "GetBackgroundPen(idx)", pen)

idx: MEP system index

pen: background pen index (integer)

n: 1 if successful, 0 otherwise

Get Fill Type

n = APPLICATION_QUERY ("MEPSYSTEM", "GetFillType(idx)", filltype)

idx: MEP system index

filltype: fill type index (integer)

n: 1 if successful, 0 otherwise

Get Center Line Type

n = APPLICATION_QUERY ("MEPSYSTEM", "GetCenterLineType(idx)", line)

idx: MEP system index

line: center line type index (integer)

n: 1 if successful, 0 otherwise

Get Center Line Pen

n = APPLICATION_QUERY ("MEPSYSTEM", "GetCenterLinePen(idx)", pen)

idx: MEP system index

pen: center line pen index (integer)

n: 1 if successful, 0 otherwise

Get System Material

n = APPLICATION_QUERY ("MEPSYSTEM", "GetSystemMaterial(idx)", material)

idx: MEP system index

material: system material index (integer)

n: 1 if successful, 0 otherwise

Get Insulation Material

n = APPLICATION_QUERY ("MEPSYSTEM", "GetInsulationMaterial(idx)", material)

idx: MEP system index

material: insulation material index (integer)

n: 1 if successful, 0 otherwise

MEP Modeler


This command returns whether MEP modeler is active.
It has one function which can be addressed via the parameter_string parameter:

Is Available

n = APPLICATION_QUERY ("MEPMODELER", "IsAvailable()", isavailable)

isavailable: MEP Modeler is present (integer)

n: 1 if successful, 0 otherwise

MEP Connection Type


This command returns the connection types and the styles of connection types.
It has two functions which can be addressed via the parameter_string parameter:

Get Connection Types

DIM d[2][]
n = APPLICATION_QUERY ("MEPCONNECTIONTYPE", "GetConnectionTypes(connectorClass)", d)

connectorClass: connector class (Duct – 1, Pipe – 2, Cable carrier – 3)

d: Array of values:
[2*k-1]: connection type GUID
[2*k]: connection type name

n: Number of connection types multiplied by 2.

Get Connection Type Style

DIM d[]
n = APPLICATION_QUERY ("MEPCONNECTIONTYPE", "GetConnectionTypeStyle(connectorClass)", d)

connectorClass: connector class (Duct – 1, Pipe – 2, Cable carrier – 3)

d: Array of values:
[]: connection type styles

n: Number of connection types.

MEP Flexible Segment


This command returns the geometry of flexible segments.
It has four functions which can be addressed via the parameter_string parameter:

Start Sectioning

n = APPLICATION_QUERY ("MEPFLEXIBLESEGMENT", "StartSectioning()", r)


Indicates that sectioning has begun.

r: not used

n: 1 if successful, 0 otherwise

Add Control Point

n = APPLICATION_QUERY ("MEPFLEXIBLESEGMENT", "AddControlPoint(x; y; z)", r)


Provides a control point to the add-on.

AddControlPoint:
x: X coordinate of the control point
y: Y coordinate of the control point
z: Z coordinate of the control point

r: not used

n: 1 if successful, 0 otherwise

Add Direction and Width Vector

n = APPLICATION_QUERY ("MEPFLEXIBLESEGMENT", "AddDirectionAndWidthVector(i; dx; dy; dz; wx; wy; wz)", r)


Provides the direction and side vectors of the ends of spline to add-on. It is called twice.

AddDirectionAndWidthVector:
i: id of port (1: 0. port, 2: 1. port etc.)
dx: X component of direction vector of the port
dy: Y component of direction vector of the port
dz: Z component of direction vector of the port
wx: X component of side vector of the port
wy: Y component of side vector of the port
wz: Z component of side vector of the port

r: not used

n: 1 if successful, 0 otherwise

End Sectioning

DIM d[]
n = APPLICATION_QUERY ("MEPFLEXIBLESEGMENT", "EndSectioning(res)", d)


Getting of the result of sectioning.

res: resolution of sectioning

d: Array of values:
[9*k-8]: X position of k segment
[9*k-7]: Y position of k segment
[9*k-6]: Z position of k segment
[9*k-5]: X component of tangent vector of k segment
[9*k-4]: Y component of tangent vector of k segment
[9*k-3]: Z component of tangent vector of k segment
[9*k-2]: X component of normal vector k segment
[9*k-1]: Y component of normal vector k segment
[9*k]: Z component of normal vector k segment

n: Number of segments

MEP Bend


This command returns the geometry of flexible segment.
It has four functions which can be addressed via the parameter_string parameter:

Start Sectioning

n = APPLICATION_QUERY ("MEPBEND", "GetBendTypeNames()", d)

d: Bend Type Names (examples of INT version)
"Radius"
"Square Throat"
"Mitered"
"45° Throat with 45° Heel"
"45° Throat with 90° Heel"
"45° Throat with Radius Heel"
"Radius Throat with 90° Heel"
"Pleated"
"Stamped"
"Segmented"
"Segmented Standing Seam"

n: 1 if successful, 0 otherwise

Parameter Script


This command can return various conditions of the parameter script.
Currently there is only one feature it can return – the distinction of the first run.

First Occasion in Progress

n = APPLICATION_QUERY ("parameter_script", "firstoccasion_in_progress", isFirstRun)


This command returns whether the current run is the first run
or a consequence of a previous execution of the parameter script which changed some parameters.
This command has no additional parameters.


The distinction may be important when a part of the parameter script executes a triggered event
– e.g. it handles the pushing of a function button.

isFirstRun: The returned value shows whether the current run is the first run

Core & IFC Properties


These commands return the folder names, parameter names and parameter values of Core & IFC properties on the “Classification and Properties” tabpage (ID and Categories, Renovation, IFC Properties). No data is returned from 3d script and the expression result is 0.

Compatibility: up to ARCHICAD 19 the tabpage was called “Tags and Categories”. It was renamed “Categories and Properties” in ARCHICAD 20 with adding user-defined properties. These queries don’t return user-defined properties.

The order of parameters is the same as on the tabpage.
There are two possible extension_names in these commands:

  • “OwnCustomParameters” returns parameters of the object
  • “ParentCustomParameters” returns parameters of the object’s parent
    Compatibility: in ARCHICAD 20 the data of the parent element (for labels) has been made available with REQUEST “Properties_Of_Parent” too. These queries return the properties corresponding to “COREPROPERTY” and “IFCPROPERTY” property types.

Get Parameter Folder Names

DIM folderNamesArray[] ! idString1, shortNameString1, longNameString1,
                       ! ...
                       ! idStringi, shortNameStringi, longNameStringi
n = APPLICATION_QUERY (extension_name, "GetParameterFolderNames()", folderNamesArray)

Returns the folder names of core & IFC properties.

folderNamesArray: String array which contains the foldernames of the properties
n / 3: Number of folders

Get Parameter Names

DIM parNamesArray[] ! idString1, shortNameString1, longNameString1,
                    ! ...
                    ! idStringj, shortNameStringj, longNameStringj
n = APPLICATION_QUERY (extension_name, "GetParameterNames(folderID)", parNamesArray)

Returns the names of core & IFC properties.

GetParameterNames:
folderID: The ID string of the folder returned from “GetParameterFolderNames”.
parNamesArray: String array which contains the names of the properties
n / 3: Number of parameters

Get Parameter

n = APPLICATION_QUERY (extension_name, "GetParameter(parID)", parValue)

Returns the value of a core or IFC property.

GetParameter:
parID: The ID string of the parameter returned from “GetParameterNames”.
parValue: String which contains the value of the property
n: 1 if successful, 0 otherwise
Example: Querying all core & IFC property values
DIM folderNamesArray[]
n = APPLICATION_QUERY ("OwnCustomParameters", "GetParameterFolderNames()", folderNamesArray)

for i = 1 to vardim1(folderNamesArray) step 3

    DIM parNamesArray[]
    querystring = "GetParameterNames(" + folderNamesArray[i] + ")"
    n = APPLICATION_QUERY ("OwnCustomParameters", querystring, parNamesArray)
    text2 0, 0, querystring
    add2 1, -1

    _nLines = 1
    for j = 1 to vardim1(parNamesArray) step 3

        parValue = ""
        querystring = "GetParameter(" + parNamesArray[j] + ")"
        n = APPLICATION_QUERY ("OwnCustomParameters", querystring, parValue)
        text2 0, 0, querystring + ": " + parValue
        add2 0, -1
        _nLines = _nLines + 1

    next j

    del _nLines
    add2 0, -_nLines

next i

Library manager


This command can return various features of the library manager.

Ies files

n = APPLICATION_QUERY ("LIBRARY_MANAGER", "IES_FILES", ies_files_list)


This command returns the list of file names with .ies extensions loaded with the active libraries.

User image files

n = APPLICATION_QUERY ("LIBRARY_MANAGER", "USER_IMAGE_FILES", image_files_list)


This command returns the list of user-provided image file names loaded with the active libraries (image files which are not in the dedicated folders with
names containing [TImg]*, [BImg]*, [UImg]*, or [HImg]*)