Check a building's plot
Hold every building's plot area — its walls, slabs and the rest merged at the ground — against a limit with a BCL check, see the outline each result measured in the 3D view, and read the measured value, the limit and the outline from code.
A zoning plan limits how much ground a building may cover. In BQL that is one shape: allChildren(SLICE(0 mm).area) cuts everything in the building at the ground and measures the merged plan, overlaps once (Shapes: SLICE and PROJECTION). Put in a require, every building of every model is checked against the limit, and each result says what it measured and draws the outline it measured.
Live demo#
Limit sets the maximum plot area and runs the check again. The outlines on the ground are what the check's SHOW draws; hover a building in the list to see the plot it measured, labelled with the value and the limit.
Before you start#
- A login with the
query:runScope and read rights on the versions. - An IFC model with an
IfcBuildingwhose walls, slabs and other elements are in it. The plot is measured at theIfcSiteplacement; a model whose ground floor is elsewhere takesFROM ABSOLUTEorFROM LOWEST.
1. Write the check#
select (type = IFCBUILDING) {
name "Plot"
SHOW allChildren(SLICE(0 mm));
require allChildren(SLICE(0 mm).area) <= 1200 m2;
}SLICE(0 mm)merges the building envelope at the site level: walls, columns, slabs and the rest, external spaces such as terraces left out.allChildren(SLICE(0 mm).area WHERE type IN (IFCWALL, IFCSLAB))names the objects instead.SHOW allChildren(SLICE(0 mm))draws the measured plot on every result, even though a building has no geometry of its own.- Other rules are the same shape with another member or option: the footprint with overhangs is
PROJECTION(ABOVE 0 mm), the building's lengthSLICE(0 mm).length, and= 1060 m2 WITHIN 2 %compares with a declared area.
2. Run it in BIM.works#
In the Actions panel, add a Model check, paste the check and press Check. The buildings over the limit are red, the others green, and each building is drawn as a ghost with the model inside it. Then:
- Hover a building in the 3D view, or its row in the results: the outline it measured is drawn on the ground, labelled Measured 1,342.5 m² · required ≤ 1,200 m². A card names the rule.
- Open a result: the requirement row draws the same outline while hovered, and its menu zooms to it, turns it into an area measurement — an independent check of the number — or copies it as WKT, in the model's coordinates or in WGS84.
- Measured in the check bar hides and shows what the check's
SHOWdrew.
3. Read the result from code#
const answer = await client.checks.runCheck3([versionUuid], check);
const walk = (results) => results.flatMap((r) => r.type == "ModelChecksContainer" ? walk(r.results) : [r]);
for (const result of walk(answer.results.checkResults.results)) {
const leaf = result.evaluationResults[0];
console.log(result.objectInfos[0].name, result.checkResult,
leaf.measured.value, leaf.expected.comparator, leaf.expected.value); // "Building A" "ERROR" 1342.5 "<=" 1200
// The outline it measured: the explanation says how to ask for it
const figure = leaf.figures[0];
const [record] = await client.bim.query([versionUuid], "GET " + figure.feature + ' WHERE qid = "' + result.objectInfos[0].qid + '"');
console.log(figure.path.reduce((value, key) => value?.[key], record)); // {kind: "polygon", primitives: [...]}
}Every leaf of a result's evaluationResults that compared a measured value carries:
| Field | What |
|---|---|
measured |
{value, unit}: the value the left side of the comparison had for this object. |
expected |
{comparator, value, unit} of the limit, with tolerance for WITHIN. |
figures |
One per shape in the comparison: feature is the GET feature that returns its outline for one object, path where it lands in the record, measure what was measured. |
The outline is a figure in metres in the model's world frame, the shape the 3D viewer draws with showQuantityFigure(key, figure, {vid}). Ask for .wkt("EPSG:4326") instead of .figure to get it on the map.
4. A height as a parameter#
A check parameter can stand for any height of a shape, so one check measures the plan at several heights:
select (type = IFCBUILDING) {
require allChildren(SLICE($cut).area WHERE type = IFCWALL) >= 5 m2;
}client.checks.runCheck3([versionUuid], check, {cut: 1000}) cuts at 1 m; a number is millimetres.
Check#
The outline of a building lies on its ground floor, around its walls, and the area in the label is the one in the result. If it lies elsewhere, the height reference is: try SLICE(0 mm, FROM LOWEST).