Change a model with BUL
Send BUL statements to CommitTransaction to change property values, move, rotate or delete objects, try them first as a dry run, and get the new version they create.
For an integration that corrects data in bulk — a fire rating for every load-bearing wall, a classification, a renamed room — or that replays edits made elsewhere. A Transaction is a list of BUL statements applied to a version; the commit creates a new version of the same model node, so the history stays complete and the uploaded file is never touched. The edits the app makes with its move gizmo and the Features panel are the same statements (Edit a model).
Live demo#
The panel offers a few statements written for this model: a fire rating for the load-bearing walls, a room name, a space category, a classification, a property set of your own, a set removed. Picking one colours the objects its WHERE selects. Dry run counts what would match and change without committing; Commit as a new version creates the version in your Demo folder, and the list of versions under the statement grows by one. Reset to version 1 deletes every later version again. The demo changes data only; moving and rotating objects is done in the app.
Before you start#
- Write rights on the model node, and the UUID of its head version.
- The BUL feature on the account. Without it, CommitTransaction refuses these statements with 403
USER_FEATURE_REQUIRED, dry runs included. - The statements:
SETandDELfor values,DELETE OBJECTandTRANSFORMfor objects, each over a BQLWHERE(reference/bul#statements).
1. Try it as a dry run#
CommitTransaction takes the version_uuid, the bul statements in order, a comment and optionally dry_run: true. A dry run resolves the statements and applies them in memory only: it reports per statement how many objects the WHERE matches and how many of those would actually change (a SET to a value an object already has is matched but not changed), and persists nothing. A dry run works against any version; is_head in the response says whether a real commit would be accepted.
Bearer <auth token>application/jsonAuthorization: Bearer <auth token>
Content-Type: application/json
Accept: application/jsoncurl -X POST "$BIMWORKS_URL/openapi/ifc/CommitTransaction" \
-H "Authorization: Bearer $BIMWORKS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"version_uuid": BIM_WORKS_FIRST_MODEL,
"bul": ["SET attribute.Name = \"Standard door\" WHERE type = IFCDOOR"],
"comment": "Normalise door names",
"dry_run": true
}'Which objects#
Add include_oids: true to the dry run and every update in the response also names its objects: matched_oids, what the WHERE selects, and changed_oids, those that would end up different — for a TRANSFORM also the objects that move with a matched one, for a DELETE OBJECT the deleted objects themselves, not what goes with them. statement_index numbers the statements from 0, so the assignments of one SET share it, and statement_lines gives the first and last line of the statement in the bul string. Combine each oid with the version UUID to colour the objects in a viewer. Above a server-side limit per model the lists are left out and the response says oids_truncated; the counts are always there. The app's transaction preview is built on this (Preview a transaction).
2. Commit#
Send the same request without dry_run. The version must be the head version of its node: history is linear, and a commit against an older version fails with 409. The commit is atomic and synchronous: the statements are applied to the indexed model and its geometry, and when the call returns the node has a new version whose origin is the transaction, with the comment. The response says whether the geometry changed, so a client knows it has to reload the model.
A changed value keeps the IFC type the property had, so a length stays an IfcPositiveLengthMeasure; BUL can also name the type, IFCPOSITIVELENGTHMEASURE(1200 mm) (reference/bul#value-types). A move or rotation is TRANSFORM MOVE(x, y, z) ROTATE(AXIS(x, y, z), angle, PIVOT(x, y, z)) WHERE qid … in world millimetres and degrees (reference/bul#transform).
Limits#
No scaling. Rotation takes exactly one object; moving takes any number. Only the placement changes: the shape of an object is untouched, and an object that shares a placement with an object outside the selection is refused. Moving an object up or down does not re-host it on another storey.
Check#
The dry run reports a match count above zero; after the commit, listing the node's versions (List the tree) shows one more, with your comment.