Turning Stair — an ArchLang floor plan example
A small house with a quarter-turn stair: one stair of flights and a landing, the same block on both floors.
Level 1 (Ground floor) compiles to 2 rooms, 30.4 m² of floor area and 2 windows; every room is reachable from the entrance.
This is a 2-level plan: a storey is a drawing, so the compiler produces one sheet per level and the drawing above is level 1. The command line writes one file per level, and the playground's preview has a storey switcher. Each storey measures:
- Level 1 (Ground floor) — 2 rooms, 30.4 m² of floor area, 2 windows.
- Level 2 (First floor) — 2 rooms, 30.4 m² of floor area, 2 windows.
The source
This is the whole plan. The drawing above is what the compiler produced from it — nothing was drawn by hand.
# A small house with a quarter-turn stair: one `stair` of flights and a landing, not two stairs.
#
# THE BLOCK IS WRITTEN TWICE AND CHANGES ONE WORD. Pieces are in climbing order on every storey,
# so the upper level copies the block and says `dir down`: `dir up` boards the first flight's foot,
# `dir down` the last flight's head. Each flight's direction comes from what it touches, never from
# its long side, and the same id on both levels is one shaft, as it is for a straight stair.
#
# THE FLOOR IN THE NOTCH IS FLOOR. The box round the pieces holds the corner the hall is walked
# through, and nothing reads that box: the walk, the rooms and lint all read the pieces.
#
# THE HEIGHT DRAWS NOTHING. `height 2750` is 13 risers of 220 mm at most, so a straight flight owes
# 12 goings, 2640 mm. A flight ends on its landing as the top flight ends on the floor above, so this
# one owes 11 goings and a landing, 2420 mm of flights, and each flight must hold its goings whole.
# These two hold 6 goings each, because the lint profiles ask for more: 12 goings of 254 mm in
# `us-residential-advisory` is 3048 mm, and 1530 + 1530 is 3060. Cut both flights to 1210 and they
# still sum to 2420 mm, but hold 5 goings each, so `W_STAIR_TOO_STEEP` reports the whole stair, once.
# `arch describe --json --facts clearances` prints the two figures, and `describe` reports the
# flights, the landing and the turn. These are arithmetic on the plan's own numbers, and no statement
# that it complies.
plan "Turning stair" {
units mm
grid 10
height 2750
paper A3 landscape
north up
dims auto all
level 1 "Ground floor" {
room id=hall at (0,0) size 3700x3800 label "Hall" at (1700,1900) uses hall
room id=living at (3700,0) size 4300x3800 label "Living" uses living
walls from rooms exterior 200 partition 100
door on hall.bottom at 1100 from start width 900 swing inward
door between hall and living at 3100 from start width 900 swing into living
window on living.right width 1600
window on hall.left width 900
stair id=s dir up width 1000 {
flight at (2630,1100) size 1000x1530
landing at (2630,100) size 1000x1000
flight at (1100,100) size 1530x1000
}
}
level 2 "First floor" {
room id=gallery at (0,0) size 3700x3800 label "Landing" at (1700,1900) uses hall
room id=bed at (3700,0) size 4300x3800 label "Bedroom" uses bedroom
walls from rooms exterior 200 partition 100
roof overhang 300
door between gallery and bed at 3100 from start width 900 swing into bed
window on bed.right width 1600
window on gallery.left width 900
stair id=s dir down width 1000 {
flight at (2630,1100) size 1000x1530
landing at (2630,100) size 1000x1000
flight at (1100,100) size 1530x1000
}
}
}