Import
Example
Notes
- Add
session.rootto your scene one time. It stays valid after each edit. - Read
session.revisionwhen an edit starts, and pass it toapply. If a different edit came first,applythrowsstale-revision. - An edit that fails changes nothing.
- A new edit clears the redo list.
undoandredoreturnnullwhen there is nothing to do. snapshot()returns a copy of the building model. Save this copy.- After an edit, get the elements again from
currentBuildby their ids. A changed element can be a new object, and Floorkit then disposes the old object. A changed wall, and a door, a window or a hole on a wall, can also stay the same object with new geometry. add-element,replace-elementandremove-elementchange one slab, roof, room, stair, column, beam, railing or instance. Anaddrejects an id that the list has. Areplaceor aremoverejects an id that the list does not have, and the new element of areplacemust have the same id.add-asset,replace-assetandremove-assetchange one asset of the model.remove-assetrejects an asset that an instance uses.add-storey,remove-storeyandreplace-storey-settingschange the storeys of a building.add-storeyrejects a storey id that the building has, andremove-storeyrejects the last storey.replace-masssets the mass of a building and the settings of all its storeys in one step.storeysis the new storey list, in its order. A storey id that stays keeps its walls and 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. Withoutmass, the building has no mass.massSegmentHeightCommand(model, buildingId, segmentId, height)gives this command for a new height of one segment, snapped to whole storeys.add-buildingadds a whole building, last in the list: its storeys, their elements and its optionalmass. Each id in it must be new in the whole model. The smallest valid building has one storey, and for a massing study amasswith one segment whosestoreyIdsnames that storey and whoseheightis the height of the storey.remove-buildingremoves a building and all it holds; it rejects the last building of the model.replace-sitereplaces the site whole:boundary,lotLines,elevation,geoAnchor,trueNorthDegand thezoningrules. Withoutsite, the model has no site any more. The model check refuses a self-intersecting boundary and alotLineslist that does not have one class per boundary edge. RunevaluateZoningagain after the step; the command does not run it. The session builds again only the storeys and the mass of the added or removed building, or only the site.- A
batchapplies several commands as one step: one revision, one build and one undo step. If one command fails, nothing changes, and the message of the error starts with the place of the command, such ascommand 2 of 3:. After a batch,lastEditCommandis the batch. - A session does not know the saved views of a project. Thus a
remove-storey, areplace-massor aremove-buildingthat removes a storey that a plan view names passes in a session.ProjectManager.applyrejects it. - The history is not saved in the project file.
Constructor
Record<string, string | OpenElementDefinition>
.op sources for the document’s external-op assets, keyed by their uri, as either a raw
buffer or an already-parsed definition. Fetching is the CALLER’s pre-step so this function stays
synchronous — the same split .opbase uses (OPBaseOptions.assetSources). An embedded-op asset
needs nothing here.Readonly<Record<string, string>>
The colour of a mass part by its use,
#rrggbb by use name, used for a part when neither it nor
its mass has a color. Replaces MASS_COLORS_BY_USE whole; a use it does not list takes
#a0b8c8. Pass it where the project is opened (ProjectManager build) so that the live build,
the plan drawings and the sheets take the same colours.boolean
Stamp
storeyId/buildingId onto every element’s propertySet. Default true.Properties
THREE.Group<THREE.Object3DEventMap>
Read-only. Stable scene node. The app may mount it once and retain it across edits.
number
Read-only.
boolean
Read-only.
boolean
Read-only.
boolean
Read-only.
BuildingEditCommand | undefined
Read-only. Caller-owned identity of the latest successfully published edit or history replay;
after a batch it is the batch.
BuildResult
Read-only.
Methods
snapshot
apply
undo
redo
subscribe
dispose
BuildingSessionError
Types
BuildingEditCommand
A single, serializable edit to an authored building model.BuildingSessionChange
'apply' | 'undo' | 'redo' | 'restore'
required
What made the step.
restore is no saved step: a step failed after it changed built objects, and
the session built them again from the saved model.number
required
The revision of the session after the step. A
restore leaves the revision as it was.readonly string[]
The live ids (keys of
currentBuild.elementsById and modelObjectsById) that the step built
again, added or removed, where a removed id is in the list and not in the build; absent when the
whole building was built again. An element that was built again is a new object, or the same
object with new geometry.BuildingSessionErrorCode
BatchCommand
Several edits as one step, in order: all of them or none.ModelObjectEditCommand
One complete saved object edit; replacement preserves authored identity and kind.ElementListCommand
One saved edit of a storey list; a replacement keeps the element id and its list.AssetCommand
One saved edit of the block definitions of a model; an instance names its definition by id.StoreyCommand
One saved edit of the storeys of a building; the settings of a storey are replaced whole.SlabTransformCommand
One saved slab transform in world XZ coordinates, retaining its vertical placement.SpaceTransformCommand
One saved space transform in world XZ coordinates, retaining its vertical placement.RoofTransformCommand
One saved roof transform in world XZ coordinates, retaining its vertical placement.StairTransformCommand
One saved stair transform in world XZ coordinates, retaining its vertical placement.ElementReshapeCommand
NetworkWallTranslateCommand
Translate one compiled segment by a world XZ delta through its storey’s WallNetwork.NetworkWallEndMoveCommand
Move one end of a compiled segment through its storey’s WallNetwork.WallCreateCommand
Append one complete authored wall run; openings require their own saved edit.WallDeleteCommand
Remove the complete authored run, including every segment of a closed wall.HostedOpeningRemoveCommand
Remove one authored opening from its exact wall without changing its wall axis.FreeOpeningRemoveCommand
Remove one exact storey-owned free door or window without changing any wall.HostedOpeningCreateCommand
Add one complete authored door or window to its explicitly chosen wall.FreeOpeningCreateCommand
Add one complete physical door or window at an explicit free pose in a storey.HostedOpeningDetachCommand
Explicitly remove a door/window from its host and place it in world XZ metres. The package does not export this type by name.HostedOpeningRehostCommand
Move one door, window or void from its wall to a place on another wall of the same storey.'rehost-hosted-opening'
required
string
required
string
required
string
required
string
required
string
required
number
required
Distance in metres along the saved centreline of the new wall.
ElementLists
The storey lists that the element commands edit, with the element type of each list.ProfileTransform
A rigid world XZ transform shared by authored polygon families. The package does not export this type by name.PointXZ
required
World XZ pivot in metres.
PointXZ
required
World XZ translation in metres, applied after rotation.
number
required
Relative degrees; positive yaw turns +X toward +Z.
SlabReshapeCommand
Replace one slab’s outline and thickness.'reshape-slab'
required
string
required
string
required
string
required
PolygonProfile
required
Outline and holes in world XZ metres.
number
required
RoofReshapeCommand
Replace one roof’s outline and its eave height above the storey.'reshape-roof'
required
string
required
string
required
string
required
PolygonProfile
required
Outline and holes in world XZ metres.
number
required
SpaceReshapeCommand
Replace one room’s outline and, when given, its height.'reshape-space'
required
string
required
string
required
string
required
PolygonProfile
required
Outline and holes in world XZ metres.
number