Skip to main content

Import

Example

Notes

  • Profile points are [x, z] in metres. pitch and ridgeDirection are in degrees. elevation is the wall-plate height where the roof crosses its outline; a pitched eave is overhang × tan(pitch) lower.
  • A flat roof can have holes. A pitched roof cannot.
  • Gable and hip roofs build on any simple footprint of up to 200 corners, convex or not, at any angles. Their planes come from the straight skeleton of the eave outline and meet in valleys at the inner corners. A gable roof on a non-convex footprint has its gable ends at the wing ends and does not use ridgeDirection. A saved gable roof with no clear wing end builds as a hip roof with a gable-built-as-hip warning.
  • A saved roof with eaveCut: 'square' ends at right angles to its slope. Draw its outline on the outer face of the walls: eave-cut-past-wall measures from the outline and does not read the walls. A shed roof is cut along its low edge and the edges in line with it.
  • overhang moves the roof edge outward. thickness is measured at a right angle to the roof plane.
  • massStyle fills the volume below the roof planes.
  • The pitch setter keeps the value between 5 and 75 degrees.
  • Start the geometry kernel before you create this object. See Floorkit.
  • This object is live geometry. To save a building, write it in a building model.
Inheritance: extends OPElement implements IShape, IPlaceable, PlanVectorExportable

Constructor

string
string
ElementType.ROOF
PolygonProfile
Wall-line footprint in the world XZ plane (the eave ring is this ring offset outward by overhang). Holes are honored by FLAT only; pitched types throw on holes.
{ outerRing?: (BmWallArc | null)[]; holes?: (BmWallArc | null)[][]; }
{ outerRing?: (number | null)[]; holes?: (number | null)[][]; }
RoofType
number
Slope in degrees from horizontal (GABLE/HIP/SHED). Clamped to 5–75.
number
Horizontal eave overhang beyond the footprint (m).
number
Plate thickness measured perpendicular to the roof plane (m).
number
World Y of the wall plate: the underside of the roof where it crosses the footprint. A pitched roof’s eave underside is overhang × tan(pitch) lower; a FLAT roof’s underside is here everywhere.
number
Plan direction of the ridge in degrees, counter-clockwise seen from above from +X (GABLE: edges within 45° of this direction slope; SHED: the high side is on this direction’s right, seen from above: +Z for 0, +X for 90). Defaults to the direction of the footprint’s longest edge. A GABLE on a non-convex outline ignores it: its gable ends are the wing ends.
boolean
When true, build the filled “attic mass” under the roof planes instead of a constant-thickness plate — half the boolean work, and exactly what massing shells need.
"square" | "plumb"
How a slope ends at its eave, as BmRoof.eaveCut.
number
RoofMaterial
(BmRoofEdge | null)[]
The kind and pitch of each outline edge, as BmRoof.edges.
number
Metres above elevation to the top of a flat plate where the slopes stop.
{ edge: number; drop: number; }
FLAT only: the plate falls to this outline edge, as BmRoof.fall.
BmRooflight[]
The roof windows in its slopes, as BmRoof.rooflights.
BmDormer[]
The dormers on its slopes, as BmRoof.dormers.
readonly ChimneyStack[]
The chimney stacks of its building, from BmStorey.chimneys: each one that passes through the roof cuts it.
BmRoofTrim
Fascia, soffit, bargeboards, gutters and downpipes along its edges, as BmRoof.trim.
Partial<Record<RoofTrimPart, number>>
The colours of the trim parts with a saved material. Absent: the plain ones.
((point: Point2) => number)
World Y of the ground under a plan point, where a downpipe stands. Absent: 0.
PropertySets

Properties

ElementType
string
Map<string, OPGeometry>
Map<string, OPGeometry>
boolean
boolean
boolean
boolean
Read-only. True when a GABLE on a non-convex outline has no clear wing end to put a gable on (none, or two gables on one corner), so its edges without an entry in edges are built as a HIP.
boolean
Read-only. True when flatTopHeight is at or above the highest point the slopes reach.
RoofOptions
string
RoofProfile
RoofType
number
number
number
number
number | undefined
boolean
number
RoofMaterial
boolean
boolean
Show the plan view: the eave polygon and the ridge or slope lines. They sit inside the roof solid, so they show only while modelView is off.
boolean
Show the roof solid. While it is on, the plan view objects stay hidden.
PointXZ[]
Read-only. The eave ring: the plan outline the roof covers.

Methods

editableSchema

Self-describing editable surface; a host inspector renders this generically.

move

Translate this element by delta (world-space, meters).

rotate

Rotate this element by angleDeg around axis (default Y-up), pivoted at anchor (default the element’s own centroid).

setOPGeometry

undersideAt

The world Y of the roof’s underside above a plan point [x, z], or undefined outside the eave ring.

getExportRoots

Vector-export roots (RFC §7).

toDrawing

The roof plan symbol: the eave region; the lines where two slope planes meet (the GABLE ridge, the HIP ridge and hips); and on each sloped plane a slope arrow pointing down the slope with the pitch beside it; the outline and the glass of each rooflight that fits; the outline of the roof of each dormer that fits and its ridge and hips; the stack outline and the pots of each chimney that passes through it, with no ridge or hip line over the stack.

planSlopes

The slopes of the roof in plan: the way each falls, a unit [x, z], and the part of it the roofs it joins leave seen.

setOPMaterial

getOPConfig

setOPConfig

beginEdit

Start one live edit; a second beginEdit before endEdit keeps the first start.

endEdit

End the live edit; its exact undo and redo, or undefined when no option changed.

getEditAnchors

Draggable handles: one grip per footprint vertex and per hole corner of a FLAT roof (v:hole:&lt;hole&gt;:&lt;corner&gt;; move on the XZ plane), and a wall-plate elevation grip at the footprint centroid (raise/lower along +Y).

applyEditAnchor

dispose

Types

RoofOptions

RoofProfile

Polygon profile for a Roof — alias of PolygonProfile.

RoofType

RoofMaterial

ChimneyStack

The stack of a saved chimney in world units, as the roofs it passes through cut and draw it.
string
required
The id of the saved chimney.
PointXZ[]
required
The plan outline of the stack in the world XZ plane.
number
required
World height of the foot of the chimney, metres.
number
required
World height of the top of the stack, pots excluded, metres.
{ ring: PointXZ[]; bottom: number; top: number; }
The cap: the plan outline of its outermost course and the world heights of its foot and top, metres; absent with no cap.
number
required
World height of the foot of each pot: the top of a capping slab, else the stack top.
PointXZ[]
required
The plan centre of each pot.
number
required
The radius of each pot, metres.
number
required
The height of each pot, metres.
BmPhase
The phase of the saved chimney.

RoofTrimColors

The package does not export this type by name.

RoofTrimPart

A part of the trim that takes a saved material. The package does not export this type by name.
Last modified on November 30, 2026