Shapes: SLICE and PROJECTION
Measuring a set of objects as one shape — a horizontal SLICE at a height or a PROJECTION onto a plane, unioned before it is measured — its options, its members (area, outline as WKT or GeoJSON, the figure the viewer draws), where it can stand in a query, and how it behaves over several models.
Most of BQL reads one object at a time. A shape reads a set of objects as one: SLICE(0 mm) cuts them horizontally at a height, PROJECTION() projects them onto the ground, and the pieces are merged into one shape before anything is measured. Overlaps count once, so the plot of a building is the area of the merged ground plan, not the sum of its walls and slabs.
GET attribute.Name, allChildren(SLICE(0 mm).area AS plot, PROJECTION().area AS footprint) WHERE type = IFCBUILDINGThe two shapes#
SLICE(<height> [, <option> ...]).<member>
PROJECTION([<option> ...]).<member>| Shape | What it is |
|---|---|
SLICE(<height>) |
The horizontal section of the objects at a height above the IfcSite placement: SLICE(0 mm) is the ground plan, SLICE(1500 mm) the plan at window height. A product that ends within 5 mm of the plane is still cut, just inside its body, so a floor slab whose top is the cut counts. |
PROJECTION() |
The objects projected onto the ground and merged: everything seen from above, so roofs and balconies that overhang the walls count. With DIRECTION it is an elevation instead. |
Without a WHERE of its own, a shape is made of the building envelope and structure: walls and curtain walls, columns, beams, slabs, roofs, stairs and ramps, plates and members, windows and doors, footings and piles, and the spaces — except spaces marked as external (terraces: InteriorOrExteriorSpace or PredefinedType EXTERNAL). A WHERE names the objects instead, and then only those count:
GET attribute.Name, allChildren(SLICE(1000 mm).area AS walls WHERE type = IFCWALL) WHERE type = IFCBUILDINGOptions#
| Option | Shape | Meaning |
|---|---|---|
FROM SITE / ABSOLUTE / LOWEST / ELEVATION |
both | What heights are measured from: the IfcSite placement (the default), the model's z = 0, the lowest point of the objects, or the elevation of the storey or building the relation runs on. |
TOLERANCE <length> |
SLICE |
A product ending within this distance of the plane is cut just inside its body (default 5 mm). |
FILL_HOLES / FILL_HOLES <area> |
both | Only the outer outline, holes filled; with an area, only the holes smaller than it (shafts), so a courtyard stays a hole. |
ABOVE <h> / BELOW <h> / BETWEEN <h> AND <h> |
PROJECTION |
Only what lies in that height band is projected: PROJECTION(ABOVE 0 mm) leaves out footings below the ground. |
DIRECTION(x, y, z [, local]) |
PROJECTION |
The normal of the plane, in world coordinates: DIRECTION(0, -1, 0) is the elevation seen from the south. local turns it with the object the relation runs on. |
MINIMUM_RECTANGLE |
both | The smallest rectangle around the shape instead of the shape — the rectangle .length and .width measure. |
Heights take a unit (1.5 m, 1500 mm; without one, millimetres) or a check parameter: SLICE($height).
GET attribute.Name, children(SLICE(1500 mm, FROM ELEVATION, FILL_HOLES 2 m2).area AS floor) WHERE type = IFCBUILDINGSTOREYMembers#
A shape is read through a member. The numbers can be compared and computed with; the others can only be selected with GET.
| Member | Value |
|---|---|
.area |
The area of the shape, holes subtracted, in m² (USING AREA_UNIT converts). |
.perimeter |
The length of every ring, holes included, in m. |
.parts, .holes |
How many separate polygons and how many holes. |
.length, .width |
The long and the short side of the smallest rectangle around the shape, in m. |
.wkt, .wkt("EPSG:…") |
The outline as WKT: in metres in the model's coordinates, or placed with the version's Geo reference in that system — "EPSG:4326" gives longitude latitude. No value for a version without a geo reference. |
.geojson, .geojson("EPSG:…") |
The same as a GeoJSON geometry (RFC 7946). |
.figure |
The outline as the 3D viewers draw it: polygons in metres in the model's world frame, simplified to at most 10,000 points. |
Without a member, GET answers the measures in one record — area, perimeter, parts, holes, length, width, the height of a slice's cut and how many products contributed.
GET attribute.Name, allChildren(PROJECTION(MINIMUM_RECTANGLE).geojson("EPSG:4326") AS rectangle, SLICE(0 mm).wkt AS plan) WHERE type = IFCBUILDINGAn alias cannot be a keyword: AS area is a syntax error, AS plotArea is fine.
Where a shape can stand#
- In a relation's
GET:allChildren(SLICE(0 mm).area AS plot)measures the children of every matched object, one shape per object. - In a
WHERE, through a numeric member of a relation: the buildings whose plot is over 1,200 m². - At the top of a
GET: the matched objects of the whole query as one shape. Over several models, one record per model: a shape never spans models. - In a check (Check a building's plot): a
requireon a shape explains itself with the value it measured, the outline it measured, and aSHOW allChildren(SLICE(0 mm))draws that outline on every result.
GET attribute.Name WHERE type = IFCBUILDING AND allChildren(PROJECTION(ABOVE 0 mm).area) - allChildren(SLICE(0 mm).area) > 20 m2GET PROJECTION().geojson("EPSG:4326") AS footprint, PROJECTION().area AS outlineAreaCost#
A shape is computed from the 3D geometry when it is first asked for — milliseconds for an ordinary building, up to a few seconds for the largest models — and kept, so every member of the same shape over the same objects, and the same query again, is answered from memory. A shape over more than 250,000 products, or one whose merge would exceed 5 million vertices, is refused rather than slowed down to minutes.