ReferenceRequires BUL

BUL

The BIM.works Update Language — SET, DEL, DELETE OBJECT and TRANSFORM statements over a BQL WHERE, CONVERT SCHEMA and GEOREFERENCE for the whole model, feature addressing for attributes, properties, quantities and classifications, values and units, and the transaction that commits them.

BUL changes model data. A BUL transaction is one or more statements, each with a BQL WHERE that selects the objects to change; committing it creates a new version of the model. The grammar builds on BQL (BUL grammar): every condition is a BQL boolean expression, and the feature paths are the BQL ones without wildcards.

Where it runs#

  • Model editing in the UI — the features panel records edits as BUL and commits them as a transaction; a Model edit action (type BUL) in the Actions tree stores a script to run on demand (Use the Actions tree). The chat proposes BUL actions for changes the user confirms. Needs the BUL feature.
  • API — CommitTransaction takes the head version of a node and an array of bul statements, applies them atomically and returns the new version; dry_run: true reports per statement how many objects match and how many would change, without persisting anything. A comment is stored with the version.

Statements#

Text#
SET <feature> = <value> [, <feature> = <value> ...] WHERE <condition>
DEL <feature> [, <feature> ...] WHERE <condition>
DELETE OBJECT WHERE <condition>
TRANSFORM [MOVE(x, y, z)] [ROTATE(AXIS(x, y, z), <angle>[, PIVOT(x, y, z)])] [WITH OPENINGS | WITHOUT OPENINGS] WHERE <condition>
CONVERT SCHEMA TO <schema>
GEOREFERENCE CRS "EPSG:<code>" ORIGIN (e, n, h) XAXIS (a, o) | ROTATION <degrees> [...]
GEOREFERENCE REMOVE

A transaction may hold several statements one after the other; each WHERE is resolved once, at commit time, against the version the transaction starts from. CONVERT SCHEMA is the exception: it is a transaction of its own. GEOREFERENCE has no WHERE either; it applies to the whole model.

SET#

Writes values. Several assignments after one SET share the WHERE. A property or quantity that does not exist yet is created in its set; a set that does not exist is created.

BUL#
SET property.Pset_WallCommon.FireRating = "REI 60" WHERE type = IFCWALL AND property.Pset_WallCommon.IsExternal = true
BUL#
SET attribute.Name = "Wall-001", property.Custom.Checked = true, property.Custom.Remark = "ok" WHERE qid = "797e993c-a87f-4aa7-9587-c59d30ec5c4e-1316"

A feature as the value#

The value can be a feature of the object itself instead of a literal. Every matched object gets its own value, which makes one statement enough to copy a measured quantity into the model's quantity set:

BUL#
SET quantity.BaseQuantities.NetVolume = calculated.quantity.netVolume
WHERE type = IFCWALL AND quantity.BaseQuantities.NetVolume != calculated.quantity.netVolume WITHIN 1 %
BUL#
SET property.Location.Storey = buildingStorey.attribute.Name WHERE type = IFCSPACE
  • Read once, from the version the transaction starts from, like the WHERE: never from what an earlier statement or assignment of the same transaction wrote. SET attribute.Name = attribute.Description, attribute.Description = attribute.Name swaps the two.
  • An object without that value is left alone. The dry run counts the matched objects and adds a warning that says how many of them have no value.
  • Converted like a literal with its unit: a measured volume is written in the model's volume unit. An existing quantity of another kind is refused rather than overwritten (a length into an area quantity). A quantity takes a number; a property keeps its IFC type when the value fits it, and a new one gets the measure of the value's unit.
  • Which features: attribute, property, quantity, calculated (quantities, properties, geometry, aabb, obb) and aabb values, and the same of a related object such as buildingStorey. A wildcard, a .meta feature, calculated.figures or calculated.details has no single value per object and is refused. The target is an attribute or a property's or quantity's value; a classification and a member's .description take a literal.
  • Recorded per object: the transaction stores each object's value, so replaying it gives the same model even after the calculated values change.

DEL#

Removes members; a property set named without a member removes the whole set (this zero-member form is legal in DEL only).

BUL#
DEL property.TempSet.Remark WHERE type = IFCWALL
BUL#
DEL property."TempSet" WHERE type = IFCWALL

DELETE OBJECT#

Removes the matched objects themselves: they are unlinked from the model and entities only they referenced are removed with them.

BUL#
DELETE OBJECT WHERE type = IFCFURNISHINGELEMENT AND attribute.Name CONTAINS "temp"

TRANSFORM#

A rigid world-space move and/or rotation of the matched objects' placements. Coordinates are project coordinates in millimetres unless a length unit is given, the angle is in degrees, AXIS is a direction, and PIVOT defaults to each object's own placement origin. At least one of MOVE and ROTATE is required; there is no scaling. Objects placed relative to a transformed object move with it.

BUL#
TRANSFORM MOVE(0, 2 m, 0) WHERE type = IFCWALL AND attribute.Name = "Wall-003"
BUL#
TRANSFORM ROTATE(AXIS(0, 0, 1), 90, PIVOT(12 m, 3.4 m, 0)) WHERE type = IFCDOOR AND attribute.Name = "D-12"

Doors and windows take their openings along#

A door or window fills an opening that cuts its wall (IfcRelFillsElement, IfcRelVoidsElement). TRANSFORM moves that opening with it, so the hole goes along: the wall is cut again where the door is now and counts as changed, but stays where it is. WITH OPENINGS is the default; WITHOUT OPENINGS moves the doors and windows alone and leaves their holes where they were.

BUL#
TRANSFORM MOVE(600 mm, 0, 0) WITHOUT OPENINGS WHERE type = IFCDOOR AND attribute.Name = "D-12"
  • All fillings or none. An opening moves only when the statement moves every door and window in it. When it moves one of two windows that share an opening, the opening stays, and the dry run and the commit say so in a warning.
  • An opening that the WHERE matches itself, or that is placed relative to a moved object, moves anyway, also with WITHOUT OPENINGS.
  • A hole that is part of another object's own shape, such as cladding modelled around the door, is no opening: it stays.
  • A transaction committed before openings went along replays as it was committed, its doors without their openings.

CONVERT SCHEMA#

Converts the whole model to another IFC schema and commits the result as a new version. One conversion exists: IFC2X3 to IFC4. Any other pair is refused with a message that lists the conversions that exist.

BUL#
CONVERT SCHEMA TO IFC4
  • The whole model. The statement has no WHERE, and it is the only statement of its transaction: a statement before it would be evaluated against one schema and one after it against the other. Commit other changes first, then convert.
  • Objects keep their id. Every object that is in both versions has the same oid, express id and GlobalId in both, also when its entity type changed (an IfcElectricDistributionPoint becomes an IfcElectricDistributionBoard). Selections, issues and check results stay with their objects. Objects that the conversion creates are numbered above the objects of the source.
  • Losses and additions are stated. The reply of the commit and of the dry run holds conversion: the numbers of losses and additions and of objects kept, retyped, turned into a value, dropped and created. Every single loss and addition is a finding in the validation report of the new version, in the group Schema conversion, and in the conversion log.
  • The new version is a file. Its download is the converted IFC4 file, the same bytes every time, with a header that names the conversion and the number of losses.
  • A model that has the schema already is refused; in a transaction over several models it is skipped.
  • In the web client the statement is behind Convert to IFC4… in the menu of a version. The entry is there for the newest version of an IFC2X3 model. It shows the numbers of losses and additions first, and makes the version when you press Convert.
  • To get the converted file without making a version, download the model with a target schema (how-to/models/download-a-model#converted).

GEOREFERENCE#

Writes the georeference of the whole model into its IFC data: an IfcMapConversion with an IfcProjectedCRS on the 3D Model context, created when the model has none and overwritten when it has one. The new version's stored georeference, the one GEO mode and the map use, is computed from what was written.

BUL#
GEOREFERENCE CRS "EPSG:28992" ORIGIN (160071.588 m, 384156.389 m, 18.753 m) ROTATION 309.637
BUL#
GEOREFERENCE REMOVE
  • ORIGIN is the map position of the model's origin (0, 0, 0): eastings, northings and height. A value without a unit is in metres, because these are map coordinates; TRANSFORM coordinates are millimetres.
  • XAXIS (abscissa, ordinate) is the direction of the model's X axis in the map; ROTATION is the same as an angle in degrees, counter-clockwise from east. One of the two is required. Copying the georeference of another model is exact with XAXIS.
  • Optional, in this order: GRIDSCALE (the combined scale factor, default 1), CRSDESCRIPTION, GEODETICDATUM, VERTICALDATUM, MAPPROJECTION, MAPZONE. The description and the geodetic datum are filled from the EPSG registry when left out.
  • The CRS must be a projected EPSG system, such as EPSG:28992 or the compound EPSG:7415; EPSG:4326 is refused. For a system in feet (a US state plane such as EPSG:2263) the map unit is that foot: the file gets an IfcConversionBasedUnit, and ORIGIN, given in metres, is written in feet.
  • The file gets the CRS's own unit as MapUnit (the metre for most systems) and a Scale from the model's length unit to it (0.001 for a model in millimetres on a metre map). TrueNorth, the placements and IfcSite's latitude and longitude are not touched; the dry run warns when TrueNorth disagrees with the conversion.
  • IFC4 and later only: an IFC2X3 model has no IfcMapConversion. Convert it first with CONVERT SCHEMA TO IFC4.
  • In the web client the statement is behind Write to IFC file… in the Location section of a model, and Set georeference… in the menu of a version. The dialog copies the values from another model and applies them to the other models of the folder in one commit (how-to/using-bimworks/set-a-geo-reference#write).

Features#

Feature Forms Notes
attribute.<Name> SET, DEL IFC attributes, case-sensitive.
property.<Pset>.<Name> SET, DEL Concrete names only, no *; quote names with special characters. .description (SET only) writes the property's IFC Description, used to record a bSDD URI.
property.<Pset> DEL Removes the whole set.
quantity.<Qset>.<Name> SET, DEL Same rules as properties.
classification."<System>" = "<Identity>" SET Links the object to the code (creates or reuses the reference).
classification."<System>"."<Identity>".name, .location SET Fields on that reference.
classification."<System>"."<Identity>" DEL Unlinks one reference.
classification."<System>" DEL Unlinks every reference in the system.

References are addressed by system name and identity (ItemReference in IFC2X3, Identification in IFC4). The BQL keywords name, location and description must be quoted when they are an identity or a property name.

BUL#
SET classification."NL-SfB" = "21.22" WHERE type = IFCWALL AND property.Pset_WallCommon.IsExternal = true
BUL#
SET quantity.Qto_WallBaseQuantities.Height = 3 m WHERE type = IFCWALL AND buildingStorey.attribute.Name = "Level 1"

Values#

"strings", numbers with an optional unit (1.5 m, 250 mm, 20), true/false and null. A number with a unit is converted to the model's unit for that dimension. In a SET, the value can also be a feature of each object (a feature as the value).

Property value types#

A property's value also has an IFC type, such as IfcLabel or IfcPositiveLengthMeasure. A SET without a type keeps the type the property already has when the new value fits it, so SET property.Dimensions.Width = 1500 mm leaves an IfcPositiveLengthMeasure one. A new property takes the measure of the value's unit (IfcLengthMeasure, IfcAreaMeasure, IfcVolumeMeasure or IfcMassMeasure), and otherwise IfcLabel, IfcInteger, IfcReal or IfcBoolean. To write a particular type, put its name around the value:

BUL#
SET property.Dimensions.Width = IFCPOSITIVELENGTHMEASURE(1200 mm), property.Pset_WallCommon.Reference = IFCIDENTIFIER("W-01") WHERE type = IFCWALL

The type has to be a defined type of the model's schema that takes the value: a string type takes a string, an integer type an integer, a real type a number, IFCBOOLEAN true or false, and IFCLOGICAL those or "UNKNOWN". Only a length, area, volume or mass measure takes a unit, and only a unit of its own dimension. Attributes, quantities and a property's .description take no type.

Common mistakes#

  • property.*.X as a target — wildcards belong to BQL; name the set. As a value too: SET … = property.*.X has no single value per object.
  • SET property."Pset" = ... without a member — the zero-member form is DEL only.
  • TRANSFORM without MOVE or ROTATE.
  • CONVERT SCHEMA next to another statement, or with a WHERE.
  • GEOREFERENCE with ORIGIN in millimetres: a unitless value is metres.
  • A typed value whose type does not take it, such as IFCLENGTHMEASURE(5 m2) or IFCINTEGER(2.5).
  • Committing against a version that is not the head of its node — history is linear; the API answers 409.

Used in#

Pages#

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