Skip to main content
A pure edit applies one edit command to a building model and returns a new model. It needs no session, and it does not change the model that you give. Use it on a server, in a test, or when you do not need geometry.

Import

Example

Notes

  • Both functions take a BuildingEditCommand. applyBuildingEditResolved takes each kind. applyBuildingEdit rejects some wall and opening commands, such as create-wall and add-hosted-opening, with the code resolved-edit-required.
  • add-element, replace-element and remove-element change one entry of a list of a storey: slabs, roofs, spaces, stairs, columns, beams, railings or instances. add-element rejects an id that the list has. replace-element and remove-element reject an id that the list does not have. The new element of replace-element must have the same id.
  • add-asset, replace-asset and remove-asset change one asset of the model. add-asset rejects an id that exists. replace-asset and remove-asset reject an id that does not exist. remove-asset rejects an asset that an instance uses.
  • add-storey, remove-storey and replace-storey-settings change the storeys of one building. add-storey rejects a storey id that the building has. remove-storey rejects the last storey of a building. replace-storey-settings replaces the name, the elevation, the height, the usage and the areaKind together. The areaKind is what the plate of the storey counts as (gross, balcony, core, basement, parking or mechanical); a value that is not one of these is refused as invalid-command.
  • replace-mass sets the mass of one building and the settings of all its storeys. A storey id that stays keeps its elements, a new id adds an empty storey, and a storey that is left out is removed. It rejects the removal of a storey that holds an element. massSegmentHeightCommand(model, buildingId, segmentId, height) gives this command for a new height of one segment.
  • add-building adds a whole building, last in the list: its storeys, their elements and its optional mass. Each id in it must be new in the whole model. The smallest valid building has one storey, and for a massing study a mass with one segment whose storeyIds names that storey and whose height is the height of the storey. remove-building removes a building and all it holds; it rejects the last building of the model.
  • replace-site replaces the site whole: boundary, lotLines, elevation, geoAnchor, trueNorthDeg and the zoning rules. Without site, the model has no site any more. The model check refuses a self-intersecting boundary and a lotLines list that does not have one class per boundary edge. Run evaluateZoning again after the step; the command does not run it.
  • A batch applies its commands in order and returns one model. If one command fails, the error has the code of that command, and its message starts with the place of the command, such as command 2 of 3:. A batch cannot be empty and cannot hold a batch.
  • A rejected command throws BmEditError. The model that you gave is not changed.
  • The functions check the full result. For an edit in an app, use a BuildingSession. It also builds the geometry and keeps undo and redo.

applyBuildingEdit

Apply one saved edit of a building model, or one batch of edits, and return a validated new model.
Throws: {BmEditError} If the command, target, or resulting geometry is invalid.

applyBuildingEditResolved

Apply an immutable edit with exact junction-aware hosted-opening decisions.

massSegmentHeightCommand

The replace-mass command that gives one segment of a saved mass the height height, snapped to whole storeys at the pitch of its top storey; undefined when the snapped height is the saved one.

BmEditError

A rejected edit; issues carries model-validation details when available.

Types

BmEditErrorCode

Stable category for a rejected building edit.

ReplaceMassCommand

Replace the mass of a building and the settings of its whole storey list in one step.

MassStoreySettings

The settings of one storey in a replace-mass command; its elements are not part of it.
string
required
string
number
required
World Y of the floor of the storey, in metres.
number
required
Floor-to-floor height in metres.
string
AreaKind
What the plate of the storey counts as; see BmStorey.areaKind.

BuildingCommand

Add or remove a whole building of a model.

ReplaceSiteCommand

Replace the site of a model whole: boundary, lot lines, grade, geo anchor, true north and zoning rules.
Last modified on October 13, 2026