Skip to main content
It shows one saved plan view and lets the user edit walls and openings. Each edit goes through a BuildingSession, so undo and redo work.

Import

Example

Notes

  • The view must be a saved plan in the project.
  • Give the same session to each plan editor and to the 3D editor. Then all of them show the same building.
  • save() returns the project text with the current building.
  • Set onError to show an edit that Floorkit rejected.
  • startWallDrawing(wall) starts the wall tool with the settings wall, and the plan takes the keyboard unless a text field of the page has it. Until the first point, the field by the cursor says Click or type x Tab y. The user clicks each point, or types the start as x, Tab and y (y is up the plan, toward -Z), then Enter, and each next point as a length in metres, Tab and an angle in degrees (0 is +X and a positive angle turns counter-clockwise, so 90° points up the plan, toward -Z), then Enter. The value being typed is in bold, in a box; the field stands off the draft line. A minus sign or a zero length is ignored; the length is in metres. Enter without a value finishes the wall as one create-wall. The first Escape clears a typed value; the next one cancels the draft.
  • const drawing = plan.startOutlineDrawing({ curves: true }) starts a free outline with curved sides. plan.setWallDrawingMode('arc') curves the next sides: click a point the side passes through, then its end. plan.setWallDrawingMode('line') goes back. await drawing gives { points, arcs }, or undefined when the user cancels. arcs has one entry per side, null for a straight side; the last entry is the closing side. arcs is absent when every side is straight. If the user closes the outline after a point on the arc, the last side is curved through that point.
  • If you give a session, you own it. Dispose the editors first, then the session. If you give none, the editor makes one and disposes it.

Constructor

BuildingSession
Share one saved building session across several plans and a 3D view.
Pick<BuildOptions, "assetSources" | "massColors" | "stampMembership">
number
Metres from every wall beyond which a dragged door or window leaves its wall; default 0.35.
ManagedEditHistory
Undo and redo through another history, such as a project manager; default is the session.
((command: BuildingEditCommand) => void)
Refuse a command before a gesture of this plan saves it; throw to refuse. A project manager passes its storey-in-use rule, as it does to a bound 3D editor.
((storeyId: string) => boolean)
Whether a saved view names the storey; Delete of a part of a mass keeps such a storey.

Properties

BuildingSession
Read-only.
string
Read-only.
(error: unknown) => void
unknown
ModelScreenRenderer | undefined
Read-only. The renderer of the plan. Assign renderer.onDrag for live figures during a grip drag (the same rules as GUIEditor.onDrag), renderer.onChange for each saved edit, and renderer.onGestureEnd to draw again from the session at the end of each press of a grip or a body (a session draw refuses with live-edit-open while the press is open).

Methods

selectedPart

mount

Mount the editable plan once; callers may mount session.root in their 3D scene.

startWallDrawing

Collect a saved wall axis on this plan.

setWallDrawingMode

Draw the next segments of the open wall draft, or the next sides of an outline or a path started with curves: true, straight or curved.

startOutlineDrawing

Let the user draw a closed outline on this plan and resolve with it, in site XZ metres (the plan’s model coordinates), without saving anything; undefined when the user presses Escape or the draft ends otherwise (another gesture, a change of the model, dispose).

startInstancePlanSymbolDrawing

Draw a plan symbol for the single selected block on the mounted storey plan.

finishInstancePlanSymbolDrawing

Finish the active instance symbol draft, as with Enter.

cancelInstancePlanSymbolDrawing

Cancel the active instance symbol draft without saving.

resetInstancePlanSymbol

Remove the single selected block’s own plan symbol in one edit.

startMassDrawing

Let the user draw the outline of a new building with one mass, then save it as one step (add-building from massBuildingCommand; renderer.onChange gets a create) and resolve with the id of the new mass.

startBeamDrawing

Let the user draw beams by two points each, as Revit “Sketch a Beam” does, and resolve with the ids of the saved beams when the chain ends (Escape or Enter).

startRailingDrawing

Let the user draw a railing by points and save it as one step (add-element in railings; renderer.onChange gets a create), then resolve with its id.

startPlacement

Show outline (plan XZ metres about the insertion point, unturned) as a ghost that follows the cursor, snapped against this storey’s walls and the plan’s snap points, and call onPlace with where it stood for each click — return true to place another.

placeHostedOpening

Save opening where a placement started with it showed its ghost (placed.host), as one step (add-hosted-opening at placed.host.station; renderer.onChange gets a create), select it and return its id.

setWorkingGrid

Snap the wall, outline and segment drafts and a free placement (a block, a column) to the nodes of grid when no geometry is in reach (12 px): the cue reads “250 mm grid”.

setPolarIncrements

Track 15°, 30°, 45° and 90° turns in the wall, outline and segment drafts, from the world, the working grid and the previous segment (“+30° from wall”).

setLengthFormat

Write every length the plan’s snap, guide and measurement labels show in one format: a draft’s run, an equal gap, the working grid (“250 mm grid”), the move of an opening to fit and measureTo, the arrange spacings, the size and opening width readouts and the typed length of a wall draft.

lockDirection

Lock the direction the open draft is tracking (“+30° from wall”): its next point runs exactly along it until releaseDirection, Escape or the point is placed.

releaseDirection

Release the draft’s locked direction.

guides

This plan’s construction guides, in the order they were added.

addGuide

Add a view-local construction line through origin along direction (plan XZ metres) and return its id.

addGuideFromEdge

Add a guide parallel to a straight edge, rightAsDrawn metres to its right going from start to end (negative: to its left): a wall of this plan’s storey by id (its first segment’s axis) or a segment.

offsetGuide

Duplicate a guide rightAsDrawn metres to its right along its direction (negative: to its left) and return the new id; undefined when no guide has id.

moveGuide

Put a guide on another line.

deleteGuide

Remove a guide.

clearGuides

Remove every guide and the division points of divideSpan.

setGuidesVisible

Show or hide the guides and division points; hidden, they do not snap either.

divideSpan

Divide the span from start to end into n equal bays: the n - 1 points between them are marked on the plan and snap until clearGuides or the next division, and are returned.

measureTo

Measure the clearance between two drawn elements of this plan (placed blocks, wall segments, columns…), by their footprints: between parallel facing faces (“866 mm”), else between the closest points (“closest 1.25 m”), or their overlap (“overlap 40 mm”).

selection

The selection set of the plan: its members (authored ids) and the anchor of an alignment.

setSelection

Select ids in the plan, with anchorId the member an alignment keeps fixed (else the first).

onSelectionChange

Call callback on every change of the selection set; the renderer’s select event still fires for a single selection.

setAnchor

Fix the member an alignment keeps in place.

previewArrange

Preview an arrangement of the selection in the working grid’s frame (else the world’s): align an edge or the centres to the anchor, distribute by equal clear gap or centre pitch (outer members fixed; with value, the first fixed and the rest stepped by it), or repeat each member count times by step.

commitArrange

Save the previewed arrangement as one undo step, keeping the selection.

cancelArrange

Clear the arrangement preview; nothing is saved.

projectSnapshot

save

setProject

Replace the saved views, sheets and markers of this plan; a mounted plan draws again.

undo

Undo one step of history, or of the session; renderer.onChange gets a changed building.

redo

Redo one step of history, or of the session; renderer.onChange gets a changed building.

dispose

resolveHostedPlacement

Resolve opening asked at run station requestedStation on segment segmentIndex of wall against the resolved element of that segment: the station add-hosted-opening saves, nearest to the asked one, where the wall cuts it clear of its openings and of a T seam.

Types

PlanMeasurement

A measured clearance between two drawn elements, as ManagedPlanEditor.measureTo returns it.
'face' | 'closest' | 'interference'
required
face between parallel facing faces, closest between the nearest points, or interference.
number
required
Metres; negative for an interference, its depth.
string
required
“866 mm”, “closest 1.25 m” or “overlap 40 mm”.
Point2
required
Where the label stands, in plan XZ metres.
SnapWitness
The measured span, absent for an interference.
readonly Point2[]
The footprint of the element measured to, in plan XZ metres; the plan outlines it.

WallDrawingAbandon

Why a wall draft ended without a commit: escape (the user pressed Escape), tool (another draft, placement or gesture started), model (the model changed under it: an edit elsewhere, undo, redo, delete or a redraw), resize (the plan resized or was fitted) or dispose.

PlanSelection

The members of a plan’s selection, in the order they were added, and the fixed anchor.

ArrangeOperation

An arrangement of the selection: align to the anchor, distribute, or repeat.

ArrangePreview

An arrangement preview, as ManagedPlanEditor.previewArrange returns it.
ArrangementMove[]
required
{ id: string; footprints: Footprint[]; }[]
required
ArrangeMemberStatus[]
required
number[]
required
The clear gaps or centre pitches along the axis, in metres, in order.

ArrangeMemberStatus

What happens to one member of the selection in an arrangement preview.

ConstructionGuide

A view-local construction line of a managed plan: through origin along the unit direction, in plan XZ metres.

ManagedPlanEditorOptions

WallDrawingTemplate

The package does not export this type by name.

OutlineDrawingOptions

How ManagedPlanEditor.startOutlineDrawing collects the outline.
'free' | 'rectangle'
free (the default): each click adds a corner; a click on the first corner, Enter or a double click closes the outline once it has three corners. rectangle: two clicks at opposite corners.

MassDrawingOptions

The new building of ManagedPlanEditor.startMassDrawing, and how its outline is drawn.

BeamDrawingTemplate

The beams that ManagedPlanEditor.startBeamDrawing draws: every beam of one chain is alike.
BmBeam['shape']
The section shape; the build’s default when absent.
number
Section width in metres, for a rectangular section.
number
Section depth in metres, for a rectangular section.
number
Section radius in metres, for a circular section.
BmBeam['material']
The structural material.
number
required
Metres above the storey; the y of the start and the end of each beam.

RailingDrawingOptions

The railing that ManagedPlanEditor.startRailingDrawing saves.
number
Rail height above the base path in metres; the build’s 1 m when absent.
number
Metres above the storey for every point of the base path; default 0.
BmRailing['balusterSpacing']
Centre distance between balusters in metres.
BmRailing['balusterSize']
Side of the square baluster section in metres.
BmRailing['topRail']
Section of the top rail in metres.
BmRailing['useTopRail']
BmRailing['panel']

PlacementSnap

What a placement settled on for one cursor position.
[ number, number ]
required
The insertion point, in plan XZ metres.
number
required
The outline’s turn about at, radians, counter-clockwise seen from above (+X toward −Z), as an asset instance’s rotationYDeg turns: a ghost turned by it stands where the instance saved at that turn stands.
{ kind: 'wall-axis' | 'point' | 'wall-face'; point: [ number, number ]; }
What it locked onto; absent when the ghost simply follows the cursor.
number
The wall a wall-axis snap is on, by its index in walls.
ResolvedHostPlacement
Where a placement started with an opening saves it on that wall; at is its position.
BodyAlignment

WorkingGrid

GuideInput

The package does not export this type by name.

ArrangementCommit

ResolvedWallRun

The package does not export this type by name.

ResolvedHostPlacement

Where a hosted opening asked at a run station is saved, and whether it moved or is refused.

SnapWitness

Footprint

The package does not export this type by name.

ManagedEditHistory

The package does not export this type by name.

ResolvedStoreyWalls

The package does not export this type by name.

FillHostRefusal

The package does not export this type by name.

XZ

The package does not export this type by name.

OrientedRect

The package does not export this type by name.

StoreyWallRun

The package does not export this type by name.
Last modified on December 4, 2026