ReferenceRequires BCOL

BCOL

The BIM.works Compare Language — how two models are matched, rules that classify every added, removed or changed object (first match wins), which features count as a change and with what tolerance, what is reported, and how each outcome is shown.

BCOL describes a comparison of two models, left and right (for two versions of one model, left is the older one). A definition says how objects are matched across the two, which rules classify each unit — a matched pair, an added object (right only) or a removed object (left only) — which features count as a change and with what tolerance, what is reported for each unit, and how each outcome is shown. Conditions and feature paths are BQL; the visualisation is BVL, so the grammar builds on both (BCOL grammar).

Nothing is compared unless it is named: a pair is changed only when one of the features in its watch list differs beyond its tolerance. Every unit lands in exactly one rule and one outcome, so the counts add up.

A first definition#

BCOL#
match attribute.GlobalId;
compare (attribute.Name, property.Pset_WallCommon.FireRating, geometry);

Everything a definition does not say comes from the built-in default: the matching, the colours, the outcome blocks and the scope (products without openings).

Matching#

Text#
match <key> [then <key> ...];
<key> ::= <feature> | (<feature>, <feature>, ...) [FOR (<condition>)]

Each key pairs the objects that are still unpaired and whose key has a value; a tuple is a composite key. A key value that occurs more than once on a side is ambiguous: those objects fall through to the next key, and are reported as added or removed (with a duplicate_key warning) when nothing pairs them. FOR limits a key to the objects that satisfy a condition on their own side.

BCOL#
match attribute.GlobalId then attribute.Tag FOR (type = IFCDOOR) then (type, attribute.Name, buildingStorey.attribute.Name);

When the right model was made from the left one by edits (transactions or a schema conversion), objects are paired by their object id first: within one chain of edits the same oid is the same object. When less than half of the objects pair, the result carries a low_match_rate warning — usually a sign that the GlobalIds were regenerated.

By geometry#

BCOL#
match attribute.GlobalId then geometry WITHIN 50 mm;
compare (attribute.Name, geometry);

geometry WITHIN <distance> pairs what the keys before it left unpaired by where it is: one to one, an object with an object of the same type whose box centre lies within the distance and whose size agrees, the closest and most alike first. Use it last, for a model exported again with new GlobalIds. Objects without geometry are not paired by it. A record of such a pair says matched_by: "geometry" and carries a confidence, 1 for the same place, size, type and name.

Fixed by hand#

What no key pairs can be paired by a person. The compare panel's Review tab lists the removed objects, with for the one you select the added objects that could be it (best first: place, size, type, name), and the added objects. Link pairs a removed object with the added object it became; Confirm removed and Added say that an object really went or is really new. The compare runs again, and every later compare of the two versions keeps it: pairs fixed by hand come before every key (matched_by: "manual"), and a confirmed object is paired by none. Undo takes one away again. Through the API: GetMatchCandidates ranks the candidates of a stored result, SetComparePairOverride, ListComparePairOverrides and DeleteComparePairOverride keep the pairs of two versions.

Scope#

BCOL#
WHERE type != IFCSPACE;
right WHERE property.Status.Phase = "New";

WHERE limits both sides, left WHERE and right WHERE one side each. An object outside its side's scope does not take part: with a right-side scope, a left object whose partner falls outside it is reported as removed.

Only products take part. Without a WHERE of its own a definition takes the default's, type != IFCFEATUREELEMENTSUBTRACTION: openings are hidden in the viewer, and what moves an opening shows on its wall and its window or door. A definition with its own WHERE compares openings when its condition lets them in.

Rules#

Text#
rules on any|left|right|both;                     // optional default for every select
select (<condition>) [on any|left|right|both] {
    [name "<label>"]
    [ignore [{ <BVL> }];]
    [compare (...);] [report (...);]
    <outcome blocks>
} [else select (...) { ... }] [else { ... }]

The first select whose condition matches takes the unit; the rest of the chain does not see it. For a pair, the side decides which object the condition is judged on:

side a pair matches when the condition holds on
any (default) the left or the right object
left the left object
right the right object
both both objects

Added and removed objects are always judged by the one object they have. left. and right. pin a single test to one side, and compare the two sides with each other: select (left.type = IFCBUILDINGELEMENTPROXY AND right.type != IFCBUILDINGELEMENTPROXY). ignore; drops the units of a rule from the result; ignore { HIDE; } also styles them.

Watch lists and tolerances#

BCOL#
compare (attribute.Name, aabb.width WITHIN 50 mm, calculated.quantity.volume WITHIN 1 %,
         property.Pset_WallCommon.*, geometry.translation WITHIN 10 mm, geometry.rotation WITHIN 0.5 deg)
    except (property.Pset_WallCommon.Reference);

A rule watches the features of its own compare and changed (...) lists; a rule with neither watches the top-level list. compare (); watches nothing. Values are compared in canonical units, so a model exported in metres does not differ from the same model in millimetres; WITHIN gives an absolute tolerance in a unit, or a relative one in %. Defaults: tolerance length 0.1 mm;, tolerance angle 0.01 deg;, tolerance relative 0.0001 %;.

Geometry is watched in facets: geometry (any of the following except appearance), geometry.presence, geometry.placement (moved or rotated), geometry.translation, geometry.rotation, geometry.scale, geometry.shape and geometry.appearance (colours only).

A shape is judged in the object's own frame: a mesh that was triangulated again, or whose vertices come in another order, is not a change, and neither is a move or a turn. A box that keeps its size but turns is a rotation; a shape that grows alike in every direction is a scale, not a new shape. Where the outline stays the same but the surface does not, such as a dent, the two surfaces are sampled and the largest distance between them is measured.

A building or a storey has no geometry of its own: the box the viewer draws around it grows with its contents, so it is compared without geometry, and a moved wall is reported on the wall only.

Two relations compare as a whole:

BCOL#
compare (buildingStorey, children);

buildingStorey (or another relation without a feature after it) counts a pair as changed when its objects relate to objects that are not each other's counterparts: moved to another storey, not a renamed storey. children counts a parent as changed when one of its decomposition parts was added, removed or changed under its own rule, so a changed stair flight shows on its stair, and the record says how: changes.children is {left, right, added, removed, changed}.

Outcomes#

Text#
added     ["<label>"] { <BVL> [report (...);] }
removed   ["<label>"] { <BVL> [report (...);] }
changed   [(<watched features>)] [when (<condition>)] ["<label>"] { <BVL> [report (...);] [left { <BVL> }] [right { <BVL> }] }
unchanged ["<label>"] { <BVL> [left { ... }] }
others    { <BVL> }                                  // loaded objects that are not part of the compare

Several changed blocks are tried top to bottom; the first that matches gives the pair its category (the label is the legend entry). A block missing from a rule comes from the top level, then from the built-in default; writing it overrides the default, colours included. In a changed or unchanged block the actions style the right object; the left object is hidden when both are shown in one viewer (so they do not fight over the same surfaces) unless a left { } block styles it.

BCOL#
select (type = IFCWINDOW) {
    added ignore;
    removed ignore;
    changed (buildingStorey.attribute.Name) when (right.calculated.property.level > left.calculated.property.level) "Moved up a storey" {
        COLOR "blue";
        report (buildingStorey.attribute.Name);
    }
    changed (geometry.placement WITHIN 10 mm) "Moved" {
        COLOR "#EFB920";
        left { COLOR "#EC4339" 70%; }
    }
} else select (type = IFCPRODUCT) {
    compare (attribute.Name, attribute.ObjectType, geometry);
    report (type, attribute.Name);
}

report (...) lists features returned for a unit whether or not they changed — both sides for a pair. What changed is reported separately, so a consumer never has to work it out again. group by (type, buildingStorey.attribute.Name); adds the counts per category for each value of those features to the summary (summary.groups). The summary also lists similar changes (summary.clusters): units that changed in the same way — moved by the same distance in the same direction, or one property changed from the same value to the same value — as one line each, "36 objects moved 500 mm along X".

Change values#

What changed in a pair can be tested and shown. change. reads the pair's changes in a changed when (...) condition and in the labels of a changed block:

BCOL#
changed when (change.geometry.translation.length > 1000 mm) "Moved far" {
    COLOR "#EC4339";
    annotate(text("Moved " + change.geometry.translation.length) hover) DISPLACEMENT;
}
changed when (change.property.Pset_WallCommon.FireRating.delta > 0) "Fire rating up" { COLOR "green"; }
value what it is
change.geometry.translation.length, .x, .y, .z the move of the object's centre, a length
change.geometry.translation the move as text, (500, 0, 0) mm
change.geometry.rotation.angle the turn, an angle
change.geometry.scale the uniform scale, a factor
change.geometry.shape.volume.delta, change.geometry.shape.area.delta right − left
change.geometry.facets the geometry facets that changed
change.count how many watched features changed
change.<watched feature> its two values as text, 60 → 90; with .delta right − left of a number

A value the pair does not have (a pair that did not move has no translation) makes a test false and a label empty.

DISPLACEMENT draws an arrow from where the left object was to where the right object is, in a changed or unchanged block; a label(...) or annotate(...) in its action set labels the arrow, SHOW DISPLACEMENT; draws it without one.

A transparency may be a parameter, COLOR "#DDDDDD" $ghost;. The compare applies 50 % until it is moved; the compare panel shows a slider for every parameter of the definition, and moving it styles the objects again without running the compare.

A shared move#

When most matched objects moved by one and the same move — a model exported with another base point, say — the result says so (alignment: the move as a translation and a rotation, and how many of the measured objects share it).

BCOL#
align auto;
compare (geometry);

align auto; judges the right side with that move undone, so only the other changes remain, and the viewer moves the right model back by it. The request option align: "auto" (or "none") does the same for any definition: it is what Align in the compare panel sends.

Federations#

A side can be several models: the discipline models of a project, compared with the same models as they were. The objects of all models of a side are matched with the other side's as one set, so an object that went from one model to another is one pair. The site, building and storeys that every model repeats with the same GlobalIds pair per model instead of being ambiguous.

JSON#
{
  "left":  { "models": [{ "type": "VersionModelIdentifier", "uuid": "7a6f8454-4f1c-4a99-bb85-d2d3952ec2eb" },
                        { "type": "VersionModelIdentifier", "uuid": "c41d5e0b-2a7f-4e55-9f0e-6b3a1d2c8e90" }] },
  "right": { "models": [{ "type": "VersionModelIdentifier", "uuid": "3f8f1c2a-6d4e-4b8a-9c1d-2e5f7a8b9c0d" },
                        { "type": "VersionModelIdentifier", "uuid": "9b2e6f41-0c3d-4a7e-8f15-d6c2b8a4e731" }] },
  "definition": "default"
}

In the result vids lists every model of both sides, the left side's first, and left.models and right.models name them. An object is its oid and the version it is in: next to the oids the object sets carry left_v and right_v, a record l_v and r_v, a layer oids_v — each the index of the object's version in vids. The SDK's CompareResult resolves them: objects(...), counterpart(qid) and recordQid(record, side) give qids of each object's own version, leftVids and rightVids the sides' models.

In the viewer, load two versions of each model and run a Compare action, or choose The loaded models (the newest loaded version of each) and The versions before them as the sides in Choose what to compare. A federation is matched by its keys, never by oid lineage, and MapQids maps between two versions, not through a federation's result.

The default#

BCOL#
match attribute.GlobalId;
WHERE type != IFCFEATUREELEMENTSUBTRACTION;

compare (type, attribute.Name, attribute.ObjectType, buildingStorey.attribute.Name,
         classification.identification, material.name, geometry);

added     "Added"            { COLOR "#7CB82F"; }
removed   "Removed"          { COLOR "#EC4339"; }
changed (geometry) "Geometry changed" {
    COLOR "#EFB920";
    left { COLOR "#EC4339" 70%; }
}
changed   "Data changed"     { COLOR "#7EC8E8"; }
unchanged "Unchanged"        { COLOR "#DDDDDD"; }

Next to the default, three definitions are built in: everything (every attribute, property, quantity, classification and material, and geometry including appearance), inventory (what was added and removed, and what moved to another storey) and geometry (moves, rotations and reshapes only, within 1 mm and 0.1°).

Running a compare#

A compare runs on two models — usually two versions of one node — with a definition: the default, a built-in one, a stored Compare action, or BCOL text. CompareModels (POST /ifc/CompareModels) returns the result; GetCompareResult reads it again, page by page:

JSON#
{
  "left":  { "models": [{ "type": "VersionModelIdentifier", "uuid": "7a6f8454-4f1c-4a99-bb85-d2d3952ec2eb" }] },
  "right": { "models": [{ "type": "VersionModelIdentifier", "uuid": "3f8f1c2a-6d4e-4b8a-9c1d-2e5f7a8b9c0d" }],
             "where": "type = IFCWALL" },
  "bcol": "compare (attribute.Name, geometry WITHIN 1 mm);",
  "options": { "details": "summary" }
}
  • The result carries the sides, statistics (matched, matched_by, lineage, same_content), warnings, the categories in legend order with their counts, the similar changes and the groups, a shared move (alignment), and, with more details, the object sets per category and per cluster (objects, clusters), the records of the added, removed and changed objects with what changed (records, paged with category, offset and limit), the BVL layers that colour each category in a viewer (layers) and the pairs that moved (moves: from and to of each, at most 2,000). Unchanged pairs are in the object sets only.
  • Edits are quick to compare: between two versions of one chain of edits, only the objects the edits touched (and the walls of a moved opening, the assembly of a moved part) have their geometry measured; stats.fast_path says how many objects that was.
  • Stored: a result has a result_uuid and is kept for 30 days. The same request is answered from the store (cached) until either side is reindexed; force computes it again. With wait_ms a long compare answers RUNNING and goes on in the background.
  • In the SDK: client.ifc.compareModels({left, right, bcol}) returns a CompareResult with objects(category, side) and clusterObjects(cluster, side) as QidSets, counterpart(qid), alignment, clusters, groups, moves and loadRecords(...); client.fs.previousVersion(version) finds the version to compare with.
  • What changed per version: GetVersionChanges (POST /ifc/GetVersionChanges, client.ifc.versionChanges(uuids)) gives, per version, the counts of the default compare with the version before it — added, removed, changed, unchanged, ignored — and the result_uuid to read the rest. A new upload is compared with its predecessor automatically while the server setting compare.auto_on_upload is on (the default); with only_stored nothing is computed.
  • Following objects to a new version: MapQids (POST /ifc/MapQids, client.ifc.mapQids({from, to, qids})) maps objects of one version to their counterparts in another, from a stored compare of the two or a new one, and lists the objects without one. Use it to re-point stored references — issues, notes, saved selections — after an upload. Comments do this by themselves: an open comment on an object of an earlier version shows on that object's counterpart in the newest loaded version of the model (ListConversations with follow: true); one on an object that is gone stays with its own version.
  • Two chosen objects: CompareObjects (POST /ifc/CompareObjects) compares any two objects as one pair, by default with everything, and answers what differs (changes) and what the definition watches.
  • Downloads: ExportCompareResult (POST /ifc/ExportCompareResult) writes a stored result as xlsx (a Summary and a Changes sheet with both sides' values and every changed feature with its two values and their difference), csv (the Changes sheet), json (the whole document) or bcf: a BCF 3.0 file with one topic per added, removed or changed object, its viewpoint showing the object in its category's colour — to hand the changes to a BCF tool, not to coordinate them.
  • A definition as JSON: bcol can also be a JSON object, {"lang": "bcol", "version": "3", "definition": {...}}, with the matching, scope, rules, watch lists, tolerances and outcomes as JSON and the conditions, features and styles as BQL and BVL text (the JSON Schema is ApiSpec/src/schemas/bcol-v3.schema.json). It is read as the BCOL it stands for; an error is reported at its JSON path, and an unknown field is refused.
  • In a change report: the BRL value bcol("default") compares the report's model with the version before it, bcol("everything", 3) with version 3; the first argument is a built-in definition or BCOL text. The value has left, right, counts (added, removed, changed, unchanged, ignored), categories as rows for a table or a chart, the first 500 records and the similar changes (clusters).
  • In the chat: the assistant's compare_versions tool compares an attached model with an earlier version of it and answers from the counts, the categories, the similar changes and the first changed objects; it can show a card that opens the compare in the viewer. Asked to make a compare ("match on GUID, only property changes"), the assistant writes the definition as a BCOL chip, with or without a model loaded: clicking it compares like a Compare action, and Save to Actions… keeps it as one.
  • Rights: the caller needs read rights on both models; features the caller's feature visibility hides cannot be compared and are listed in hiddenFeatures.

Notes#

  • left, right, match, select, added, changed, change and the other BCOL words are reserved in BCOL texts: quote a property that is spelled the same (property.P."length").
  • The 3.0 form identification: … compare (…) is no longer accepted.

Used in#

Pages#

  • BCOL grammarThe Xtext grammar of BCOL as shipped in this release.