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 cannot hold a command of the project lists.
Checks of a command
- Floorkit checks a project command as
save()checks the project. A command that fails throwsProjectFileErrorand changes nothing. - The value
-0, the valueundefinedand an object that is not plain give the codeinvalid-json-value. - The other codes of a project command are
duplicate-item,unknown-item,item-id-mismatchandinvalid-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
undothat reaches the “add view” step fails withview-in-use. Dispose that plan editor first. - Through
manager.applyyou cannot remove a storey while a plan view names it. The manager throwsProjectFileErrorwith the codestorey-in-useand the path of the view. Remove the view first. Aremove-storeyin abatchhas the same check, also when the batch adds the storey again. - Through
manager.applyyou cannot remove a building while a saved view shows it: a plan view of one of its storeys, a section or elevation view with itsbuildingId, or a view whoseelementIdslists anything the building holds. The code isbuilding-in-use, with the path of the view. A bound 3D editor has the same check. - Through
manager.applyyou cannot remove the site, or give it a new id, while theelementIdsof a view lists it. The code issite-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 throwsProjectFileErrorand changes nothing.
History
apply,undoandredoreturn the new revision.undoandredoreturnnullwhen there is no step.- 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.
subscribereports each step with itsrevision, itspart(buildingorproject) and itscause(apply,undo,redoorrestore). Arestoreis 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,undoorredoin a listener. The manager throws an error with the codereentrant-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, callmanager.apply,manager.undoandmanager.redo. A directmanager.session.applyis counted as a step. A directmanager.session.undoorredo, 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 thatsave()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 withmanager.apply.
Files and errors
ProjectManager.openthrowsProjectFileErrorfor a bad file. A file that is valid, but whose building does not compile, throwsBmBuildErrororError.- A project file from an earlier version opens, and the project commands work on it.
save()writes the current version. - Add
rootto your scene one time. It stays the same object after each edit. - You make the
GUIEditorand you dispose it.dispose()of the manager removes the plan editors and the session. - After
dispose(),exportPdfgives 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">
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.
Methods
open
snapshot
save
apply
undo
redo
subscribe
listener after each completed step.
mountPlanEditor
bindSceneEditor
apply, and Delete of a part of a mass keeps a storey that a saved plan view shows.
setBuildableEnvelope
root).
exportPdf
dispose
Types
ProjectManagerOptions
ProjectCommand
One command of a project manager: an edit of the building or a change of the project lists.ProjectListCommand
One change of the list of views, sheets or markers.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 is an edit of the session; project is a change of the project lists.'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.