---
title: BCL
summary: The BIM.works Check Language — select blocks over BQL conditions, check blocks with success/error/warning/info results, require shorthands, BVL actions inside a check, programmed checks, IDS conversion, and where checks run.
order: 40
terms: [bql, check, action]
see-also: [reference/bql/where, reference/bvl, how-to/using-bimworks/use-the-actions-tree, explanation/checking-and-ids]
---

# BCL

BCL evaluates rules per object and produces a [[term:check|check result]] for each: `success`, `error`, `warning` or `info`, with a message. A check first *selects* its scope with a BQL condition, then *checks* each object with another. The grammar builds on BVL and BQL ([[bcl:grammar]]): conditions are BQL boolean expressions, and BVL action sets can colour the scope and the results.

## Where it runs {#where}

- **Actions tree** — a *Model check* action (type `CHECK3`) stores a BCL script; running it evaluates the loaded models and opens the results tree ([[page:how-to/using-bimworks/use-the-actions-tree]]). The chat proposes the same kind for pass/fail questions.
- **API** — [[openapi:Check]] takes `models` and a `bcl` definition (or an IDS document, or the `action_uuid` of a stored check action) and returns, by its `format`, every checked object with its result, only the counts, or the results as a BCF ZIP; from the SDKs, `client.modelChecks.runCheck(bcl, versionUuids)` in Java runs a script through the `RunCheck3` task (the method is marked deprecated), and `downloadCheckResultsAsBcfDirect(versionUuids, "Check3", bcl)` on `client.checks` in JavaScript and `client.modelChecks` in Java returns the results as a BCF. The SDKs' `runChecks` runs stored check definitions, the older form, not a BCL script ([[page:explanation/checking-and-ids]]).
- **IDS** — the `IdsToBcl` and `BclToIds` tasks convert between an IDS document and a BCL script. In the UI, *Convert to IDS* in the BCL editor ([[feature:BCL_TO_IDS]]) saves a script as a new IDS action; an `.ids` file dropped on the Actions tree becomes an IDS action, not BCL.

## Structure {#structure}

```text {#bcl-structure}
select (<condition>) {
    [name "<rule label>"]
    [<BVL action sets>]
    [pick ["<hint>"] { <BVL action sets> }]   // what a click on a result shows
    [if (...) { ... }]              // BVL conditions
    [select (...) { ... }]          // nested selects narrow the scope
    <checks> | <requires>           // one of the two
} [else select (...) { ... }] [else { ... }]

check (<condition>) { [<BVL action sets>] [pick { ... }] <result>; } [else check (...) { ... }] [else { ... }]
require <condition>;
```

Inside a `select` block the order is fixed: `name`, action sets, `pick`, `if` blocks, nested selects, then the checks or the requires. A check block holds its action sets, then its `pick`, then the result. A `check` yields exactly one result per object of the scope: the block's result when the condition holds, the first `else check` whose condition holds otherwise, then the `else` block (an object that fails a check without `else` gets no result). `require <condition>;` is the shorthand for a check that succeeds when the condition holds and errors when it does not; several requires may follow each other, but a block holds checks or requires, not both. How several verdicts on one object combine is in [Verdicts](#verdicts).

```bcl {#bcl-check}
select (type = IFCWALL AND property.Pset_WallCommon.IsExternal = true) {
    name "External walls have a fire rating"
    check (property.Pset_WallCommon.FireRating != null) {
        success;
    } else {
        error("Missing FireRating");
    }
}
```

```bcl {#bcl-require}
select (type = IFCDOOR) {
    name "Doors are fully quantified"
    require quantity.Qto_DoorBaseQuantities.Width != null;
    require quantity.Qto_DoorBaseQuantities.Height != null;
}
```

## Results {#results}

`success`, `error`, `warning` and `info` each take an optional `(<message>)` or `(<keyword>, <message>)`. The message is a `"string"`, a feature, or `"prefix " + feature`, evaluated per object; the keyword is an identifier that tags the result so results can be grouped and filtered by cause.

```bcl {#bcl-keyword}
select (type = IFCSPACE) {
    name "Spaces have a plausible floor area"
    check (calculated.quantity.floorArea > 1 m2) {
        success;
    } else {
        warning(SMALL_SPACE, "Implausibly small floor area: " + attribute.LongName);
    }
}
```

## Verdicts {#verdicts}

- **Several `require`s** in one `select` give each object one result, and the most serious verdict wins: `error` over `warning` over `info` over `success`. An object therefore fails when any of the requires fails, whatever their order. The result carries one evaluation per require, which is what the drill-down on an object shows.
- **Several `check`s** in one `select` are judged independently: each gives the object a result of its own.
- **A condition that cannot be evaluated**, because a feature is not enabled on the instance or the query part has an error, fails the whole run with `The condition "…" could not be evaluated: …` and the query's error code. The check does not pass or fail objects on a condition it could not read.
- A result title that comes from a feature shows its prefix, value, unit and postfix, and `-` when the object has no value.

## Actions {#actions}

BVL action sets ([[page:reference/bvl#actions]]) inside a `select` block apply to the scope, inside a `check` or `else` block to the objects with that result; `if` blocks give conditional styling within the scope.

```bcl {#bcl-actions}
select (type = IFCWALL) {
    name "Walls carry the NL-SfB classification"
    COLOR "gray" 80%;
    check (classification.system.name = "NL-SfB") {
        COLOR "green";
        success;
    } else {
        COLOR "red";
        error("No NL-SfB reference on " + attribute.Name);
    }
}
```

### Colour by result {#color-result}

`COLOR RESULT [<n>%]` gives each object the colour of its own result, the viewer's colour for `error`, `warning`, `info` or `success`, at the given transparency. It is a BVL colour action ([[page:reference/bvl#actions]]) that only means something in a check, where every object has a result to take the colour from.

## Pick: what a click on a result shows {#pick}

A `pick` block holds action sets that the 3D viewer applies to a result object while it is clicked, on top of what the check already shows. A click on another result object replaces them; a click on empty space, on an object without a pick, or `Escape` takes them away. The click does not select the object.

- A `pick` in a `select` block applies to every result of the select, one in a check block to the results of that branch. When both are there, the select's actions come first.
- An action set without a subject applies to the clicked object itself, and a figure subject (`OUTLINE`, `FOOTPRINT`, `DIMENSION`, `MAXIMUM_INSCRIBED_CIRCLE`, `PATH`) draws the clicked object's figure.
- A pick may only change what it can take away again: colours (`COLOR`, `COLOR RESULT`, `COLOR RESET`), `ON_TOP`, `SHOW` and annotations. The viewer ignores other actions in a pick, with a warning in the console.
- The optional text after `pick` is a hint the viewer shows while a result object with a pick is hovered, for example "Click a space to show its escape route". It also appears under the result's counts.

```bcl {#bcl-pick}
select (type = IFCSPACE) {
    name "Spaces have a floor area of 4 m2 or more"
    COLOR RESULT 50%;
    pick "Click a space to see its outline" {
        COLOR RESULT 20%;
        SHOW OUTLINE;
    }
    require calculated.quantity.floorArea >= 4 m2;
}
```

In the result, an object with a pick carries `pick` (its `resolvedActions` and `overlays`), and the results as a whole carry `interaction` with the hint.

## Nested selects and else {#nested}

A nested `select` narrows the scope; `else select` and `else { ... }` handle the objects the first select did not take.

```bcl {#bcl-nested}
select (type IN (IFCDOOR, IFCWINDOW)) {
    name "Openings on the ground floor are rated"
    select (buildingStorey.calculated.property.level = 0) {
        require property.*.FireRating != null;
    } else {
        check (ALL) { info("Not on the ground floor"); }
    }
}
```

## Programmed checks {#programmed}

`class <Name> { <json> }` runs a check built into the server: the Java class registered under that name (the `ListChecks` task lists them), with the JSON object as its configuration, whose keys are the fields of that check's input. The name must be one the server's check registry knows; sandboxed Java checks ([[feature:JAVA_ACTIONS]]) are actions of their own and cannot be named here. A name the registry does not know is refused with [[error:UNKNOWN_MODEL_CHECK]], whose message lists the registered checks, and a configuration that does not fit the check's input (an unknown key, a value of the wrong type) with [[error:CHECK_ERROR]]. A script is either select blocks or one `class` check.

```bcl {#bcl-programmed}
class MaxFileSizeCheck { "maxByteSize": 104857600 }
```

## Common mistakes {#mistakes}

- A `check` block without a result, or with two.
- Checks and requires in the same `select` block.
- `name` or action sets after the checks — the block order is fixed.
- Selecting `*TYPE` classes instead of occurrences ([[bql:types#occurrences]]).

## Used in {#used-in}

- [[page:how-to/using-bimworks/use-the-actions-tree]] — storing and running a check.
- [[page:explanation/checking-and-ids]] — how BCL relates to IDS and to the older check definitions.
