Skip to main content
A roof starts from the outline of the walls below it. You select the roof type and the pitch, and Floorkit makes the roof planes.

Before you start

You have a session from Start a building.

Write the roof

This gable roof sits on the room from Draw a wall. Its outline is the outer face of the walls, 0.1 metres outside the wall path. Its wall plate is 3 metres above the storey elevation, at the top of the walls. The eave is overhang × tan(pitch) lower.

Add it to the storey

A roof is an entry in the roofs list of its storey.
The add-element command adds the roof to the list, and the session builds it. You keep the session and its undo history. The command rejects an id that the list has.

Roof types

In a JSON file, write the type as text: "GABLE". A gable or hip roof builds on any simple outline of up to 200 corners, convex or not. The planes meet in valleys at the inner corners. On a non-convex outline, a gable roof puts its gable ends at the wing ends and does not use ridgeDirection. A gable roof with no clear wing end builds as a hip roof, and the build gives a gable-built-as-hip warning.

Rules

  • pitch is in degrees. overhang and thickness are in metres.
  • baseOffset is the distance from the storey elevation to the wall plate at the outline.
  • overhang moves the roof edge outward from the outline.
  • A pitched roof cannot have holes.

Edge kinds, a pitch per edge and a flat top

edges gives each edge of the outline its own kind and pitch. Edge i runs from outerRing[i] to outerRing[i + 1], and the list has one entry per edge. An entry of null keeps the default of roofType for that edge. Use trim.ridge: { height: 0.035, width: 0.2, profile: 'half-round' } on a 40-degree gable for a semicircular ridge tile. Height is measured above the roof crest. The radius is half the width. Increase the height or reduce the width if the tile shoulders would sink into the roof. Omit profile to keep the square shape. flatTopHeight stops the slopes at that height above baseOffset and closes the roof with a flat top. A hip roof with a flat top is a crown roof; with a steep pitch it is a mansard. In a roof plan and a block plan the flat top is a region with the part name crown. It draws no ink unless the style fills it, such as "ROOF": { "parts": { "crown": { "fill": "#c0c0c0" } } }. In this hip roof on a four-edge outline, edge 0 slopes at 25°, edge 1 is a gable (a hip-to-gable end), edge 2 keeps the hip of roofType, and edge 3 is a half-hip that turns into a hip 0.6 metres below the ridge.
A crown roof is a hip roof with "flatTopHeight": 1.8: its hips stop 1.8 metres above the wall plate at a flat top.
  • pitch of an edge is in degrees, 5 to 75. Without it, the edge takes the pitch of the roof.
  • All eaves start at one level. An eave at another pitch than the roof crosses the outline higher or lower than baseOffset by overhang × (tan(edge pitch) − tan(roof pitch)).
  • The plate of a sloped plane has the vertical thickness of the roof pitch.
  • Two edges on one straight line must have the same kind and pitch (roof-edges-collinear-differ). They make one plane, so a slope carried over an extension along the same eave line is one plane.
  • A roof needs at least one eave (roof-without-slope). A rooflight, a dormer or a downpipe cannot sit on an edge that is a gable, by its entry or by the default of roofType.
  • A half-hip needs a drop above 0. A drop that reaches below the eaves cannot build, and neither can a hip that reaches past the ridge of the two slopes beside it: lower the drop or raise the pitch of the edge.
  • An edge pitch outside 5 to 75 builds at 5 or 75, as the roof pitch does.
  • A flat top above the highest point of the slopes gives the roof without a flat top and a flat-top-above-ridge warning.
  • reshape-roof keeps each entry, rooflight, dormer and downpipe on its edge when you add or remove a corner, also when the new outline runs the other way. Two edges that become one keep their entry when the entries are the same; when an entry or an item has no edge to go to, the command is refused (invalid-geometry).

A flat roof with a fall

fall tilts a FLAT roof toward one edge of its outline. That edge stays at baseOffset, and the plate rises drop metres at the point of the outline farthest from that edge. This garage roof falls 0.31 metres from the front to edge 0 at the rear:
  • The plate has the vertical thickness of its fall. Walls with topFollowsRoof, joined roofs and chimneys follow the tilted underside, and elevations and sections draw the slope. The roof plan draws the roof as a level flat roof does.
  • With trim, the gutter goes along the low edge, and the fascia goes along every edge: level at its own height on the high edge, and along the top of the plate on the sides. The soffit goes under the low and high edges, each at its own height. The high edge takes a gutter only when gutter.edges names it, and then its gutter and downpipes hang from that edge.
  • gutter.edges on a falling roof may name only level edges, the low edge and edges parallel to it; a sloping side edge is refused with bad-roof-edge. A downpipe goes on an edge that takes the gutter, the low edge when gutter.edges is not set, or it is refused with downpipe-without-gutter.
  • A rooflight on a falling roof sits in the slope when its edge is the low edge; on another edge it does not fit.
  • edge is an outline edge index with the whole outline on its inner side, so the concave edge of an L cannot take a fall (bad-roof-edge), and drop is a number above 0 (bad-fall). A fall needs a FLAT roof (fall-on-pitched-roof) with straight edges (fall-on-curved-roof). A fall steeper than 10° gives a fall-too-steep warning: use a pitched roof.
  • reshape-roof keeps the fall on its edge, as it keeps edges.

Rooflights

rooflights puts roof windows in the slopes. Each one sits in the slope of the outline edge edge: along is the metres along that edge from its first corner to the centre line of the rooflight, and up is the metres up the slope, in the slope plane, from the eave line to its bottom edge. width runs across the slope and length up it, both outside the frame; frameWidth defaults to 0.05.
  • The rooflight cuts a hole through the roof square to the slope. Its frame lines the hole and stands 0.06 metres proud of the roof; its glass is a part with the glazing role. On an attic-mass roof (massStyle) the cut is a pocket as deep as thickness, not a hole through the mass.
  • opening sets the dashed mark on the glass, drawn in plans and elevations whatever the view’s openingMarks: centre-pivot (the default) meets at the middle of the bottom edge, top-hung at the middle of the top edge, and fixed has no mark.
  • On a flat roof any edge gives the frame: up runs inward from that edge, level.
  • A rooflight that does not fit inside the slope of its edge (past the ridge, a hip, a valley, a half-hip or a flat top, or out of the outline), or whose frame leaves no glass, builds no hole and no rooflight and gives a rooflight-does-not-fit warning. The saved rooflight does not change.
  • The roof plan draws the outline and the glass of each rooflight. A storey plan draws it dashed when it is above the cut and as seen when it is below: the plan of the storey of its roof when the rooflight starts below the top of that storey, else the plans of the storeys above whose floors are below the rooflight. A plan above the rooflight that looks down on it draws it as seen. Elevations see it on the slope and sections cut it.
  • A rooflight is its own element: its drawings take its own phase. It moves with its roof, and an edit of its roof builds it again.

Dormers

dormers stands dormers on the slopes. Each one stands on the slope of the eave edge edge: along is the metres along that edge from its first corner to the centre line of the dormer, and setBack is the plan metres from that outline edge in to the outside of its face (0 puts the face on the wall plate). width is the outside width of the face, and faceHeight the metres from the foot of the face up to the eaves of the dormer. The foot of the face is where the outside of the face meets the top surface of the host slope, not the underside of the roof and not the loft floor. The cheeks and the face are built down to the underside of the roof, but their heights count from that top surface. On a roof 0.15 m thick at 45°, the underside is 0.21 m lower than the top surface, so a window with sillHeight: 0.9 has its sill 0.9 m above the top surface and 1.11 m above the underside. cheekThickness (default 0.1) is the thickness of the two cheeks and the face; overhang (default 0.1) is the eaves overhang of its roof.
  • roofType is the roof of the dormer: flat and shed fall to the face at pitch degrees (flat 0 to 10, default 0; shed 10 to 60, default 35), gable has its ridge running back into the slope, and hip adds a hipped end over the face. A pitched dormer roof (gable, hip) has its eaves at faceHeight on both cheeks. Its plate is as thick as the roof, square to its own slope.
  • The dormer cuts its footprint out of the roof, up to where its roof meets the slope. Its cheeks and face stand on the underside of the roof, their tops follow the underside of the dormer roof, and the dormer roof dies into the slope behind them.
  • windows are the windows in the face, each a window as in Add a window without bay, divisions, lights and sill included. offset is the metres from the left edge of the face, seen from outside, to the centre of a window, and sillHeight the metres from the foot of the face up to the sill. A window with its frame must fit between the cheeks (dormer-window-too-wide, and opening-does-not-fit at its offset when its frame runs past a cheek) and between the foot of the face and the eaves (opening-overruns-height, dormer-window-too-tall); two windows may not overlap (openings-overlap). A window is a part of the dormer and takes its own phase; it publishes as a window element of its own, and elevations draw its opening marks as they do for a wall window.
  • doors are the doors in the face, each a door as in Add a door without kind, with offset as for a window. Its threshold is baseHeight (default 0) above the foot of the face. doorQuadrant reads in the face: the near jamb is the left jamb seen from outside, and the door swings to your left (1, 2) into the loft or to your right (3, 4) out of it. A door with its frame must fit between the cheeks (dormer-door-too-wide, opening-does-not-fit) and between the foot of the face and the eaves (opening-overruns-height, dormer-door-too-tall), and may not overlap a window or another door (openings-overlap). It cuts the face, takes its own phase, and draws in plans, elevations and sections as a door in a wall does. A French door onto a balcony, with the balcony railing as a railing of its own:
  • A dormer whose footing (its cut and the strip where its roof rests on the slope) does not lie inside the slope of its edge (past the ridge, a hip, a valley or a flat top, or out of the outline), or whose roof never meets the slope because it is as steep as the slope, builds no body and no cut and gives a dormer-does-not-fit warning. The saved dormer does not change. A dormer cannot stand on a flat roof (dormer-on-flat-roof).
  • The roof plan draws the outline of the dormer roof with its ridge, hips and valleys, so the set-ins from the eaves and the ridge can be measured. The plan of the storey of its roof, and of a storey above it, draws the cheeks and the face where the cut passes through them, with the windows in the face. Elevations see the face, the cheeks and the dormer roof; sections cut them.
  • material names the cladding of the cheeks and the face by its key in the model’s materials: elevations draw its surfacePattern on them and sections hatch their cut with its cutHatch, as for a wall. The dormer roof, the trim and the windows and doors in the face do not take it. A material that is not a key draws as before.
  • A dormer is its own element: its drawings take its own phase. It moves with its roof, and an edit of its roof builds it again.
  • trim gives the dormer roof a fascia and a gutter on its eaves, as the trim of a roof does: the front eave of a flat or shed dormer, the two side eaves of a gable dormer and all three of a hip dormer. Each of downpipes hangs from the gutter of the eave side (left, right or front, seen from outside), along metres from the front end of that eave (the left end of the front eave), and runs down to where it meets the host roof slope; diameter defaults to 0.068. A pipe on a side that is no eave of its dormer roof is refused with downpipe-on-gable. One that passes the end of its eave, stands off the host slope or meets it above the gutter is not built, and the build warns downpipe-past-edge. With endsAt: 'roof-below' a pipe runs down to the highest roof of the building under it, the host roof included, and has a socket 0.22 m above that roof; where no roof lies under it, the build is refused with downpipe-no-roof-below at its endsAt. The trim parts draw in elevations and sections as the trim of a roof.
A flat roof takes a gutter on its low edge only with gutter.edges:

Change, move or remove the roof

To change a saved roof, send replace-element with the full new roof. The new roof must have the same id. This example sets a steeper pitch and a wider overhang.
  • transform-roof turns the outline by yawDeg about origin, then moves it by translation. Points are [x, z] in metres. A positive yawDeg turns counter-clockwise seen from above, +X toward −Z. The roof keeps its height, and a set ridgeDirection turns with the roof.
  • replace-element and remove-element reject an id that the list does not have.

Join two roofs

A roof that runs into another roof, such as a front gable let into a hipped main roof, is joined to it with join-roofs, as Revit’s Join Roof does. The part of the roof roofId inside the mass of the roof toRoofId goes. That mass is the space from the eave plane of toRoofId (the height of the underside at its eave line) up to the top of its slopes, over its eave outline. Below that eave plane, the part of roofId inside the outline of toRoofId (its profile, the wall line of the part of the building under it) goes too, and so does the overhang of that part, so a lower roof whose outline reaches under the higher roof ends at the higher part’s wall faces: no slab inside the rooms of the upper storey, no eave strip across its gable. The strip of a lower roof that runs on under the overhang, outside that outline, stays. A wall with topFollowsRoof does not follow roofId where it was cut away inside the higher part; it keeps its own height there. The line where the two roofs meet is a true edge: the valleys. The two roofs may stand on different storeys and have different eave heights and pitches. The join is saved as the id of toRoofId in trimTo of roofId. unjoin-roofs takes it back out and gives both roofs back as they were.
  • The roof plan draws the two roofs as one: each roof draws only the part of it that is on top, the valleys are drawn once from each side, and where a slope of one roof runs on in the plane of the other (the same pitch from the same eave line) no line is drawn. The slope arrows and pitches stay on the part of their plane that is on top. Elevations and sections draw the trimmed roof, its valleys and its cut at the other roof’s slope.
  • A roof that lies wholly inside the mass of the roof it is joined to builds no body and draws nothing. Roofs that only touch keep their bodies and draw as before: their outlines overlap by less than 0.1 mm across, or one rises less than 0.1 mm into the other.
  • A rooflight or a dormer must lie wholly in the part of its roof that is on top. One in a part that is cut away or under the other roof fits nowhere: it gets no hole and no body, and a rooflight-does-not-fit or dormer-does-not-fit warning. A chimney cuts only what is left of a joined roof. An edit of either roof builds both again.
  • Refusals: a roof id that the building does not have (unknown-roof), a roof joined to itself (roof-joins-itself), a join that is already saved (duplicate-roof-join), a join that closes a loop such as two roofs trimmed to each other (roof-join-cycle), unjoin-roofs of roofs that are not joined (roof-not-joined), and a list that is not one of roof ids (bad-roof-ids). Removing a roof or its storey takes its id out of every trimTo.
  • A roof with arc edges or rounded corners cannot be joined or be joined to: roof-join-arc, which names that roof.
  • A cross gable that dies into the slope of a higher main roof is modelled as one full gable whose outline reaches under the main roof, joined to it (trimTo: ['main-roof']), with the gable in the main roof’s cutBy so that the main roof’s eave and slope stop under the gable: the gable’s ridge runs on up the main slope to the valleys, and below the main roof’s eaves the gable ends at the main walls.
  • A small roof under the eaves of a higher roof, such as a bay roof against the main wall, is joined to it the same way (trimTo: ['main-roof']) even though it never reaches the higher roof’s slope: its overhang into the higher part’s wall goes, so it stops at the wall face. A roof has one overhang for all its edges.
  • A roof whose body lies inside the rooms of a higher storey of its building (inside the outer face of that storey’s walls, between its floor and its height, below the underside of the roofs over it) builds with a roof-inside-storey warning in warnings, which names the storey and the volume. It is a warning, so the file opens: join the roof to the roof over that storey (trimTo), which ends it there and so is not checked again, or end its outline at that storey’s walls.
  • cutBy lists roofs whose space under their underside removes the part of this roof inside it, such as a hipped main roof that runs on under a cross gable trimmed to it: with the gable in cutBy, the main roof stops at the gable underside, and a section along the gable no longer cuts it there. Each listed roof is sloped (roof-cut-by-flat); a roof listed in both trimTo and cutBy is duplicate-roof-join, two roofs that cut each other are roof-join-cycle, and the refusals of trimTo apply. Removing a roof takes its id out of every cutBy.

Walls under the roof

Set topFollowsRoof: true on a wall to cut its top at the underside of the roofs of its storey. Where no roof covers the wall, the wall keeps its height. A roof edit moves the wall top in the same step. An opening of such a wall must stay below the roof underside (opening-above-roof), or below the wall height where no roof covers it (opening-overruns-height). To follow roofs of another storey, such as a loft wall under a roof that sits on the storey below, name them in topFollowsRoofIds together with topFollowsRoof: true. The wall then follows only the named roofs, on any storey of the building, and an edit of a named roof moves the wall top in the same step. Under two roofs whose footprints overlap, the wall stops at the lower underside. A plan view draws the part of such a wall whose top is above the cut as cut, and the part whose top is below the cut, down to the storey floor, as a below-cut outline. An arc wall whose sloped top crosses the cut is not drawn yet: the plan leaves it out and names it in the drawing’s warnings. replace-wall-settings replaces every setting of a wall, so keep the other settings. The room is one closed wall, so its two gable end walls fill up to the roof.

In the plan

  • A floor plan, a sheet and the plan editor draw a roof above the cut as its dashed eave outline only.
  • A saved view of kind roof-plan shows every roof of a building from above: the ridge of a gable roof, the ridge and hip lines of a hip roof, the valleys, and on each sloped plane a down-slope arrow and the pitch, for example 30°. It also shows the roof of each bay window as its outline and its hip lines, with no slope arrow or pitch; a higher roof hides the part under its eave, and the bay roof hides the part of a lower roof under it. It also shows each part of a slab that stands outside the walls, such as a balcony, less the parts under a higher slab or under a higher roof that the roof plan draws. See drawProjectView.
  • A paper style styles the parts of a roof by name in classes.ROOF.parts. The region of a FLAT roof is flat, so parts.flat.fill tones flat roofs and no pitched roof, on a roof plan, a block plan and a storey plan that draws a roof below. The slope arrow is slope-arrow and slope-arrow-head and the pitch text is pitch: visible: false on the three hides the slope symbols.
  • With ridgeLines: { draw: 'band', bandMm: 1 } a roof plan or a block plan draws each ridge, hip and valley as two lines bandMm paper mm apart (default 1), centred on the line and mitred where they meet. draw: 'line', the default, draws one line. Each sizes the band at the scale of the first sheet viewport that shows the view: a roof plan on no sheet at 1:100, a block plan on no sheet at 1:200.
  • With roofPattern: 'none' a roof plan draws no surface pattern of the roof materials. The elevations and sections keep it. Absent, or 'material', the pattern draws. A block plan takes the same field.
  • With pitchMarks: 'omit' a roof plan or a block plan draws no slope arrows and no pitch. Absent, or 'draw', they draw.
  • With wallsBelow: 'omit' a roof plan draws no dashed walls under its roofs. Absent, or 'draw', it draws them. A block plan has no such field.
  • With blocks: 'draw' a roof plan draws the placed blocks of its building that stand clear of it; see Location and block plans.
  • With slopeShading: { lightDeg: 102, tones: ['#999999', '#4c4c4c'] } a roof plan or a block plan fills each slope by the way it falls. lightDeg is where the light comes from, in degrees clockwise from project north (90 lights the slopes that fall to the east). tones are two or more #rrggbb fills, the first on the slopes towards the light and the last on those away from it; absent, the two greys shown. A slope exactly between two tones takes the darker. The pitch does not change the tone. A flat roof takes none, and a dormer and a bay roof take the tone of the slope under them. The fills lie over the dashed footprint and under the roof lines.
  • On a plan cut above a roof, the roof hides the slab and the ceiling below it.

Edit in an editor

  • The panel fields of a roof (type, pitch, overhang, ridge direction, attic mass, thickness, elevation, material, colour, label) save in place as one undo step.
  • A hole in a flat roof has a grip on each corner. A drag reshapes the hole in one undo step.

Next

Add a stair

Connect two storeys.

Roof API

See each option of a roof.
Last modified on November 30, 2026