Before you start
You have a session from Start a building. You use one session for the whole guide.Write the storeys and the mass
This building has three storeys. The mass has two parts: a podium for the ground storey and a smaller tower for the two storeys above it.Set the site and the mass
Both go into the session as commands.replace-site gives the building a lot and its zoning rules. replace-mass sets the mass and its storeys in one step. A storey that is not in the list is removed, and a new storey id adds an empty storey.
Read the floor area
After the build, get the mass from the session and read its quantities.Change the mass
Each change below is one command and one undo step. Height.massSegmentHeightCommand gives the replace-mass command for a new height of one part. The height snaps to whole storeys, at the pitch of the top storey. It adds storeys with new ids, or removes empty top storeys, and it stacks every storey above again. It returns undefined when the height does not change.
areaKind: gross, balcony, core, basement, parking or mechanical. A parking storey does not count toward the floor area ratio, unless the zoning rules list that kind in countsTowardFAR. replace-storey-settings sets it. It replaces all the settings of the storey, so give them all.
color (#rrggbb), else the color of the mass, else the colour of its use (the use of the part, else of the mass, else the buildingType of the building), else #a0b8c8. The colours by use are in MASS_COLORS_BY_USE: they follow the land-use colours of US planning maps (residential yellow, retail red, office a lighter red, civic blue, industrial purple, parking grey). massSegmentColorCommand gives the replace-mass command that sets the colour of one part, or takes it away with undefined. The 3D model and the plan draw the part in that colour.
massColors where the project is opened: ProjectManager.open(text, myColours). The 3D model, the plans and the sheets of that project then use it. It replaces the whole table; a use that it does not list takes #a0b8c8.
replace-mass again with the new mass and the new storey list, as in setSiteAndMass.
Curve one edge. A footprint edge can be a circular arc. footprintArcs.outerRing has one entry for each edge of the outline: null for a straight edge, or { through }, a point on the arc between the two corners. In the podium below the right edge, from [12, 0] to [12, 8], bulges out through [16, 4]. The footprint is then a D: the 12 m by 8 m rectangle and a half circle of radius 4 m.
massToShell follow the arc. The podium covers 96 + 8π, which is 121.1327 m², and footprintArea gives that exact value. The floor area ratio of the whole mass is then 0.355, above the cap of 0.35, so the report names exceeds-far. One undo takes the arc back.
A new building. massBuildingCommand makes the add-building command from an outline in site coordinates. It checks the outline, stacks the storeys from the site grade and gives ids that are new in the whole model.
Edit the mass in 2D
A plan view does not draw the massing unless you ask: the switchshowMassing is off by default, so existing plans and sheets do not change. Turn it on with replace-project-item on the views of a ProjectManager (one undo step), then mount the plan editor for that view.
evaluateZoning. The parcel and the setbacks are only drawn; a click passes through them. The user clicks a part, drags a corner or edge dot to reshape it, drags the part to move it, drags the round grip to turn it, and presses Delete to remove it. Each gesture is one replace-mass and one undo step, as in 3D. The plan has no height grip: change the height in the 3D editor, or type it with massSegmentHeightCommand. onDrag is on both editors (GUIEditor.onDrag in 3D), so you can show live numbers while a drag is in progress. Sheets and PDFs show what the plan shows.
Draw it in the plan. plan.startMassDrawing({ storeyHeight: 3, storeyCount: 4 }) lets the user click the corners of the outline: a click on the first corner or Enter closes it, and Escape cancels. It saves the same add-building as one undo step and resolves with the id of the new mass, or with undefined if the user cancels. startOutlineDrawing returns the outline alone, as site XZ points, and saves nothing; an app can pass that polygon to massBuildingCommand or use it for something else.
ManagedPlanEditor API and Add a plan editor.
Draw a site plan
A site plan is a plan view with nostoreyId. It draws the parcel, the dashed setback line and each part of the mass of every building, in the order of the buildings. It draws no walls, doors, stairs or other storey content. It always draws the massing, so it does not need showMassing. cutHeightAboveStorey has no effect on a site plan.
showMassing does. The wall tool refuses on a site plan: draw walls on a storey plan. A model with no site and no mass gives an empty site plan.
Check the zoning rules
evaluateZoning is pure. It does not read the session, so you run it again after each step. Give it the lot, the masses and the rules.
exceeds-far. When you make the ground storey a parking storey, it counts 144 m² and the ratio is 0.24.
To change a rule, send replace-site with the new lot. It replaces the boundary, the grade and the zoning together. The podium is 4 m from the lot line, so a setback of 5 m puts it in violation:
session.undo(session.revision) to go back one step. See Undo and redo.
Edit the mass in 3D
With a 3D editor bound to the session (see Add a 3D editor), the user edits the mass with the pointer. A click selects a part, the podium or the tower. The push/pull grip changes its height, the move and turn grips move or turn it, and Delete removes it. Each gesture saves one command and one undo step.GUIEditor.onDrag gives the live target before the save, so that you can show live numbers such as the floor area. See the GUIEditor API and massSegmentHeightCommand.
Draw it in 3D. editor.startMassDrawing({ storeyHeight: 3.2, storeyCount: 5 }) lets the user click the corners of the outline on the ground, as in the plan: a click on the first corner, Enter or a double click closes it, and mode: 'rectangle' takes two opposite corners. It saves the same add-building as one undo step, selects the new mass with its grips and resolves with its id. Escape cancels and resolves undefined.
Turn the mass into walls, slabs and roofs
When the volume is correct,massToShell makes walls, slabs and roofs from it. Each storey gets an outer wall and a floor slab. The top storey of each part gets a flat roof. A mass of more than one part needs the geometry kernel to be initialized.
- Where the slab sits. A floor slab has
baseOffset: 0: its bottom face is at the elevation of its storey, and its top is one slab thickness above it. A roof hasbaseOffsetequal to the storey height: it sits on the top of the walls, at the elevation of the storey above. - A part on a part. The first storey of a part gets a
Floorslab where it stands on the part below, and anOverhangslab under each piece that reaches past the part below. A part clear of the part below gets only anOverhangslab, across its whole footprint. These slabs do not overlap, so the floor area of the storey is the area of its footprint. - The roof below stays whole. Where a part stands on the part below, its
Floorslab and the roof of the part below are at the same height.
Turn the mass into walls in the same session
Send onebatch: a replace-mass with no mass, which keeps the storeys and removes the mass, then a create-wall for each wall and an add-element for each slab and roof of the shell. The building keeps its id and its storeys, and the change is one undo step. For the podium and the tower of the mass tower example, the batch has 18 commands.
session.undo(session.revision) brings the mass back and removes the walls, slabs and roofs together. There is no way back from walls to a mass: once you edit the walls, the mass is gone for good.
Make a new building from the mass
massToShell also gives a whole new building. Pass massToElements to replaceBuilding. This opens a new session, and the undo history ends. The new building has no mass, and its id is the id of the mass plus -shell: here building-mass-shell. The storeys keep their ids. Use the new building id in your edit commands.
Rules
- A footprint is a list of
[x, z]points in metres. A hole in a footprint is a courtyard. - The parts stack from the bottom to the top. The first part starts at the
elevationof the mass. - The
heightof a part must be the sum of the heights of its storeys. If it is not, the model is not valid. - A storey belongs to one part only.
usecan beresidential,office,retail,hotel,civic,industrial,parking,mixedorother. A different word gives a warning.- The storeys of a mass can be empty. They do not need walls.
- A colour is a
#rrggbbstring. A command with another colour is refused withinvalid-command. - A plan view shows the mass when the view has
showMassing: true, or when it has nostoreyId(a site plan); the plan editor then edits it. See Add a plan editor. - A section or an elevation draws the masses when its view has
showMassing: true(off by default): a section cuts each part with its courtyards, and an elevation shows each part. Both draw the ground at the site elevation across the crop; a mass whose elevation is not the site grade sits above or below that line. A view that lists itselementIdsdraws only those.
Next
Define a room
Give names and areas to the spaces in a storey.
Building API
See each option and each quantity of a mass.