Some expressions might provide more than one value, e.g. the materials in a multi-skin wall (retrieved with material). Any expression that can potentially reply with more than one value always responds with a list, so cannot be treated as if it were a single value. Instead, Quantities provides expressions that searches for values in a list:
-
includes
element.material includes “Brick”
Searches for an item in the list exactly matching the text. The sample expression would only find “Brick”, not “Red Brickwork” or “Brick – Engineered” etc.
contains
element.material contains “Brick”
Searches for an item in the list containing the text. The sample expression would find “Brick”, “Red Brickwork” or “Brick – Engineered” etc.
The items in some lists, including materials, properties, parameters etc, have associated values, e.g. a material has an area and volume. To reference a single item in a list, add the name of the item in parenthesis, e.g.:
element.material(“Red Brick”)
Note that no errors or problems arise if the name can’t be found in the list – it simply means that any calculations using that item are void, i.e. the result will always be zero. If the item has multiple values, it can be followed with the expression for the required value, e.g. the volume of a specific material would be:
element.material(“Red Brick”).volume
Some list items are also arranged in groups, including ARCHICAD properties (section 4.4.7) and IFC properties (section 4.4.11). The item name might only be unique within its own group, in which case it can be prefixed with the group name as follows:
element.property(“Common::Description”)
This example would retrieve a property called “Description” from a group called “Common”. Properties with the same name in other groups will be ignored. In this case, the result is a single value and can be used like this:
element.property(“Common::Description”) startsWith “Fixtures”
This example will only calculate as true if the element has a property called “Description” in a group called “Common” and its value starts with “Fixtures”, e.g. “Fixtures::Sanitary”. If the element doesn’t have that property or the value doesn’t match, the result is false. An expression like this can be used as the basis for automatically attached recipes (section 4.5) or taking optional measurements (section 4.6).
It is also possible to enter a list of values to be compared to data from ARCHICAD in order to avoid long, repetitive statements like:
(element.type = “Wall”) or (element.type = “Column”) or (element.type = “Beam”)
Statements like this can be much longer, rapidly becoming tedious to write and difficult to read. Quantities provides two expressions to condense these statements:
-
in
element.type in (“Wall, “Column”, “Beam”)
Searches the list of values for an exact match to the data value. In the example, only an element type of “wall”, “column” or “beam” is a match.
has
element.material has (“Brick”, “Concrete”)
Searches the list of values for a partial match to the data value. In the example, any material name containing the word “brick” or “concrete” is a match including “Brickwork”, “Structural Concrete”, “Masonry – Engineered Brick-2”
Note that both these expressions can be used to find a match to a single data value (element.type) or a list of values (element.material).
Comments
0 comments
Please sign in to leave a comment.