Skip to main content
It keeps the views, the sheets and the markers of the project, and it owns the one BuildingSession that builds the building. It mounts the plan editors, connects the 3D editor, saves the project and exports the sheets. Each change is one step in one history, so one undo works for the building and for the sheets.

Import

Example

Notes

Project commands

apply takes an edit command of the building, or one of these commands of the project lists. Each item has an id. An edit command of the building can be a batch. A batch of project list commands is one step too, and it can hold building edits as well (see below).

Several list changes as one step

Put the commands of the project lists in one batch when one change of the user changes a sheet and its markers. The manager applies the commands in order and adds one step to the history. One undo takes all of them back, and one redo puts them back.
A batch can hold building edits together with project list commands. Floorkit checks the final building, views and sheets together and publishes one revision and one history step; one undo takes back the building edits and the list changes together. A refused batch keeps the building, the lists, undo and redo as they were. BuildingSession.apply still takes building edits only.
  • A batch is all or nothing. If one command fails, apply throws the error of that command and nothing changes. The message starts with the place of the command, such as command 2 of 3:.
  • The checks of the project file run on the lists after the last command. Thus a marker can come before the view that it targets.
  • A batch can hold project list commands and building commands together. The building edits are checked as the session checks them, and the project file is checked on the final building and lists. A batch in a batch, a gap in the list or an item that is not a command gives ProjectFileError with the code invalid-command and the path of that item, such as $.commands[1].
  • A batch with no command goes to the building session, which refuses it with BmEditError and the code invalid-command.

Sheet order

Pass every existing sheet ID exactly once. The command keeps each sheet’s contents, viewports and resource references. Save/open and the default PDF export use the saved order. Duplicate, missing or unknown IDs give invalid-sheet-order; malformed command fields give invalid-command. An unchanged order returns the current revision without a history step or notification. A batch containing only reorders that ends in the original order has the same no-op behavior. A batch containing other commands keeps its normal history behavior.

Checks of a command

  • Floorkit checks a project command as save() checks the project. A command that fails throws ProjectFileError and changes nothing.
  • The value -0, the value undefined and an object that is not plain give the code invalid-json-value.
  • The other codes of a project command are duplicate-item, unknown-item, item-id-mismatch and invalid-command.
  • You cannot remove a view that a mounted plan editor shows, and you cannot make it a view that is not a plan. The code is view-in-use.
  • If a plan editor shows a view that you added in this session, an undo that reaches the “add view” step fails with view-in-use. Dispose that plan editor first.
  • Through manager.apply you cannot remove a storey while a plan view names it. The manager throws ProjectFileError with the code storey-in-use and the path of the view. Remove the view first. A remove-storey in a batch has the same check, also when the batch adds the storey again.
  • Through manager.apply you cannot remove a building while a saved view shows it: a plan view of one of its storeys, a section or elevation view with its buildingId, or a view whose elementIds lists anything the building holds. The code is building-in-use, with the path of the view. A bound 3D editor has the same check.
  • Through manager.apply you cannot remove the site, or give it a new id, while the elementIds of a view lists it. The code is site-in-use.
  • An undo or a redo of a step of the project lists is checked as save() checks the project. A step that fails throws ProjectFileError and changes nothing.

History

  • apply, undo and redo return the new revision. undo and redo return null when there is no step.
  • revision counts the steps of the building and the steps of the views, sheets and markers. session.revision is always the same number. Use revision; see The revision number.
  • A drag in an editor is a building step in the same history. The undo key in each editor undoes the last step of the manager.
  • subscribe reports each step with its revision, its part (building or project; a mixed batch is project) and its cause (apply, undo, redo or restore). A restore is no new step and the revision stays as it was: a step of the building failed after it changed built elements, and the session built them again from the saved model.
  • Do not call apply, undo or redo in a listener. The manager throws an error with the code reentrant-transition. dispose() in a listener during a building step throws the same code.
  • After a project step, the manager draws each mounted plan again. Thus one project step costs one plan draw for each mounted plan editor.
  • With a ProjectManager, call manager.apply, manager.undo and manager.redo. A direct manager.session.apply is counted as a step. A direct manager.session.undo or redo, and a storey command sent to the session while a view names that storey, can leave a step that the manager cannot undo, or a project that save() refuses. While a view names a missing storey, the undo of each project step is refused. To repair it, undo the building step, or remove the view with manager.apply.

Files and errors

  • ProjectManager.open throws ProjectFileError for a bad file. A file that is valid, but whose building does not compile, throws BmBuildError or Error.
  • A project file from an earlier version opens, and the project commands work on it. save() writes the current version.
  • Add root to your scene one time. It stays the same object after each edit.
  • You make the GUIEditor and you dispose it. dispose() of the manager removes the plan editors and the session.
  • After dispose(), exportPdf gives a promise that rejects.
  • A deployed site needs a valid hostname key for exports, including a non-commercial demo. See Licensing.

Constructor

Pick<BuildOptions, "assetSources" | "massColors" | "stampMembership" | "onProgress">
Build options of the one building session, for example the sources of external assets.
number
Metres from every wall beyond which a dragged door or window leaves its wall; default 0.35.
((error: unknown) => void)
Called when an editor rejects an edit, or cannot draw a step of the project lists.

Properties

BuildingSession
Read-only. The one building session of this project.
Group
Read-only. The built building. Add it to the Three.js scene one time.
number
Read-only. Goes up by one for each applied, undone or redone step, of the building or of the views, sheets and markers. session.revision is the same number.
boolean
Read-only. Whether the open project has a step to undo, including paper and building edits.
boolean
Read-only. Whether the open project has a step to redo, including paper and building edits.

Methods

open

Read project text, check it and build the building.

snapshot

The current views, sheets and markers, with the current building.

save

The current project as text.

apply

Apply one command.

undo

Undo the last step.

redo

Redo the last undone step.

subscribe

Call listener after each completed step.

mountPlanEditor

Mount a 2D plan editor for one saved plan view.

bindSceneEditor

Connect a 3D editor to this project; its edits pass the same storey checks as apply, and Delete of a part of a mass keeps a storey that a saved plan view shows.

replaceFields

Change some inspector fields of one managed element in place, as one saved step that undo reverts. Throws: {BmEditError} edit-not-available when the element has no saved fields to change; the refusal of an edit that cannot be saved (onError hears it first). Nothing changes then.

filletRadius

setBuildableEnvelope

Show or hide the buildable envelope of the site in the 3D scene (root).

renderSheetPreview

Render the sheet preview from the live build.

exportPdf

Export the given sheets, or each sheet, of the current project as one PDF, from the live build. Throws: {ProjectDrawingError} live-edit-open (the promise rejects) while a bound editor has a gesture open; export again in its onGestureEnd.

dispose

Remove the plan editors of this manager, then the session.

Types

ProjectManagerOptions

ProjectCommand

One command of a project manager: an edit of the building, a change of the project lists, or a batch that holds both.

ProjectListCommand

One change of the list of views, sheets, markers or map sources.

ProjectChange

One completed step of a project manager, as a subscriber gets it.
number
required
The revision of the manager after the step. A restore leaves the revision as it was.
'building' | 'project'
required
building edits only the session; project changes lists, possibly with building edits.
'apply' | 'undo' | 'redo' | 'restore'
required
What made the step. restore is no saved step: a step of the building failed after it changed built objects, and the session built them again from the saved model.
readonly string[]
The live ids of the built elements that the step built again, added or removed, where a removed id is in the list and not in the build; empty for a step of the project lists, and 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.

SelectedPart

EditorChange

Emitted after every write-back, via GUIEditor.onChange or createModelRenderer().onChange.
EditorChangeKind
required
EditableTarget
required
string
The EditAnchor id, for kind: 'anchor' only.
string
The edited element’s id, where the surface knows it — the 2D plan view always does, because it resolved the element from a picked ogid in the first place. This is what lets a host write the edit back to its own store without searching for which element changed. EditableTarget is a bare THREE.Object3D and carries no id of its own.
string[]
The elements whose built objects the step changed. ogid and target name the element of the last command of the step whose element changed.
BmIssue[]
Warnings of the step for the app to show, such as each void that a wall delete removed.

ManagerExportOptions

The export options of a ProjectManager: its own session gives what the export reads. The package does not export this type by name.

ProjectListBatchCommand

Several changes of the views, sheets, markers and paper settings as one step, in order: all of them or none.

ReorderSheetsCommand

Put every existing sheet id in its desired order, exactly once.

EditorChangeKind

Which channel of the target an edit wrote to.
Last modified on November 30, 2026