Row Houses (knobs) — an ArchLang floor plan example
A terrace of two-storey houses written once and placed along the street: change one of three numbers and every house follows.
Level 1 (Ground floor) compiles to 10 rooms, 222 m² of floor area and 17 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) — 10 rooms, 222 m² of floor area, 17 windows.
- Level 2 (First floor) — 20 rooms, 222 m² of floor area, 22 windows.
What this plan uses
The parts of the language this plan's source writes, each linked to its section of the language reference.
- Paper and scale
- Site and orientation
- The lot line (boundary)
- Bindings (let)
- Components
- Placing instances (place)
- Control flow (for, if, while)
- Walls from rooms
- Rooms
- Polygonal rooms
- Doors
- Windows
- Furniture
- Dimensions
- Stairs, elevators and escalators
- Voids
- Outdoor ground
- Fences
- Title block
- Sheet tables (schedules, legend, notes)
- Levels (storeys)
The source
This is the whole plan. The drawing above is what the compiler produced from it — nothing was drawn by hand.
# Row Houses: a terrace of identical two-bedroom houses, two storeys each, written ONCE and
# placed along the street. The street is to the north, so every bedroom and the living room
# face the gardens and the south sun, and the street side holds the hall and stair, the
# kitchen and the bathroom. Alternate houses are mirrored, so the bathrooms (and the kitchens
# under them) pair across one party wall, and the stairs across the next.
#
# CHANGE ONE NUMBER. The three knobs below drive everything else: rooms, walls, stairs,
# doors, windows, furniture, gardens, fences and dimensions all follow.
plan "Row Houses" {
units mm
grid 25
paper A2 landscape
scale 1:100
north up
schedule rooms
# ---- the knobs ---------------------------------------------------------------------------
let HOUSES = 5 # how many houses in the terrace (2 to 6)
let WIDTH = 6000 # plot width = house width, party wall to party wall (6000 or more)
let DEPTH = 7400 # house depth, street front to garden front (7200 or more)
# ---- fixed by the design -----------------------------------------------------------------
let FB = 3200 # the street band: hall and stair, kitchen, landing and bathroom
let FRONT = 3500 # front garden, street to front wall
let BACK = 4500 # back garden, garden wall to back fence
let SIDE = 2500 # the side garden each END house gains past its free gable
let T = 250 # exterior and party wall thickness
let ROW = HOUSES * WIDTH
# The local left gable (x = 0) is free on the first house, and on the last one when it is
# mirrored (odd places are); the local right gable is free on the last unmirrored house.
let freeL(k, n) = k == 0 || (k == n - 1 && k % 2 == 1)
let freeR(k, n) = k == n - 1 && k % 2 == 0
# ======================================================================================
# ONE HOUSE, in its own coordinates: (0,0) is its street-front corner on the local left,
# the party wall it shares its stair with. k is its place in the row, n the row's length.
# ======================================================================================
component ground(w, d, k, n) {
room id=r_hall at (0,0) size 2200 x FB label "Hall" at (1600,1550) uses entry hall floor timber
# An L: the kitchen-dining arm on the street, the living room across the garden front.
room id=r_living polygon (2200,0) (w,0) (w,d) (0,d) (0,FB) (2200,FB)
label "Living / kitchen" uses living kitchen dining floor timber
walls from rooms exterior 250 partition 100
# Up from the hall: along the party wall, four winders in the corner, then across.
stair id=st dir up width 900 {
flight at (125,1025) size 900x1150
landing at (125,2175) size 900x900 winders 4
flight at (1025,2175) size 1125x900
}
door id=d_front on r_hall.top at 1575 from start width 900 swing inward
door id=d_hall between r_hall and r_living at 1500 from r_hall.top width 800 swing into r_living
door id=d_garden glazed_sliding on r_living.bottom at 3600 from start width 2400
window fixed on r_hall.top at 575 from start width 600
window casement on r_living.top width 1400
window casement on r_living.bottom at 1300 from start width 1400
if freeL(k, n) {
window fixed on r_living.left at d - FB - 950 from start width 900
}
if freeR(k, n) {
window casement on r_living.right at 5300 from start width 1000
}
# ---- kitchen run on the party wall (the same wall as the bathroom above) ----
furniture fridge against r_living.right offset 500 size 700x650 in r_living
furniture counter against r_living.right offset 1150 size 600x600 in r_living
furniture stove against r_living.right offset 1750 size 600x600 in r_living
furniture counter against r_living.right offset 2250 size 400x600 in r_living
furniture kitchen_sink against r_living.right offset 2950 size 1000x600 in r_living
# ---- dining in the street arm (the dining_table draws its own chairs), the sofa facing the garden ----
furniture id=t_dine dining_table at (3100,1650) size 1400x900 in r_living
furniture id=f_sofa sofa against r_living.left offset 1800 size 2000x850 in r_living
furniture coffee_table at (1400,FB + 1500) size 600x1000 in r_living
furniture armchair at (2600,FB + 1800) size 800x800 facing f_sofa in r_living
# ---- front garden: a path to the door, bins and a bicycle on the paving, a lawn ----
outdoor paving at (0,-FRONT) size 3000 x FRONT
outdoor lawn at (3000,-FRONT) size w - 3000 x FRONT
furniture bin at (150,-FRONT + 150) size 600x700
furniture bin at (850,-FRONT + 150) size 600x700
furniture bicycle at (2300,-FRONT + 200) size 600x1800
furniture hedge at (3100,-FRONT + 100) size w - 3200 x 500
furniture shrub at (w - 1300,-FRONT + 900) size 900x900
# ---- back garden: a patio off the living room, then lawn and a tree ----
outdoor patio at (0,d) size w x 2000
outdoor lawn at (0,d + 2000) size w x BACK - 2000
furniture tree at (w - 2700,d + 2100) size 2200x2200
furniture shrub at (500,d + BACK - 1300) size 900x900
# ---- an end house's bigger garden: a side strip past its free gable ----
if freeL(k, n) {
outdoor lawn at (-SIDE,-FRONT) size SIDE x FRONT + d + BACK
furniture tree at (-SIDE + 200,d + 1500) size 2100x2100
}
if freeR(k, n) {
outdoor lawn at (w,-FRONT) size SIDE x FRONT + d + BACK
furniture tree at (w + 200,d + 1500) size 2100x2100
}
}
component upper(w, d, k, n) {
room id=r_land at (0,0) size 4300 x FB label "Landing" uses hall circulation floor timber
room id=r_bath right-of r_land align top gap 0 size w - 4300 x FB label "Bath" uses bath floor tile
room id=r_bed1 below r_land align left gap 0 size 3200 x d - FB label "Bedroom 1" uses bedroom floor timber
room id=r_bed2 right-of r_bed1 align top gap 0 size w - 3200 x d - FB label "Bedroom 2" uses bedroom floor timber
walls from rooms exterior 250 partition 100
stair id=st dir down width 900 {
flight at (125,1025) size 900x1150
landing at (125,2175) size 900x900 winders 4
flight at (1025,2175) size 1125x900
}
void id=v_stair polygon (125,1025) (1025,1025) (1025,2175) (2150,2175) (2150,3075) (125,3075) rail 0 1 2
door id=d_bed1 between r_land and r_bed1 at 2650 from start width 800 swing into r_bed1
door id=d_bed2 between r_land and r_bed2 at 550 from start width 800 swing into r_bed2
door id=d_bath between r_land and r_bath at 650 from start width 800 swing into r_bath
window fixed on r_land.top at 2600 from start width 1000
window tilt on r_bath.top at 600 from start width 600 sill 1500
window casement on r_bed1.bottom width 1400
window casement on r_bed2.bottom width 1400
# A study corner under the landing window, and the linen cupboard.
furniture id=f_desk desk against r_land.top offset 2600 size 1200x600 in r_land
furniture office_chair at (2350,900) size 500x500 facing f_desk in r_land
furniture tall_cabinet against r_land.top offset 1450 size 700x500 in r_land
if freeL(k, n) {
window fixed on r_land.left at 1600 from start width 900
}
if freeR(k, n) {
window tilt on r_bath.right at 2500 from start width 600 sill 1500
}
# ---- bedroom 1: a double bed off the gable or party wall, room both sides ----
furniture double_bed against r_bed1.left offset 2100 size 1400x2000 in r_bed1
furniture nightstand against r_bed1.left offset 1150 in r_bed1
furniture nightstand against r_bed1.left offset 3050 in r_bed1
furniture wardrobe against r_bed1.top offset 800 size 1200x600 in r_bed1
# ---- bedroom 2: a single bed on the party wall ----
furniture bed against r_bed2.right offset 2200 size 900x2000 in r_bed2
furniture wardrobe against r_bed2.top offset w - 3200 - 750 size 1200x600 in r_bed2
# ---- bathroom: the bath on the party wall, backing onto the neighbour's ----
furniture bathtub against r_bath.right offset 1050 size 1700x700 in r_bath
furniture wc against r_bath.bottom offset 450 size 400x700 in r_bath
furniture basin against r_bath.bottom offset 1250 size 600x450 in r_bath
}
# ======================================================================================
# THE ROW. Even places sit as drawn; odd places are mirrored, and so are placed at their
# far edge. A `place` name is a plain identifier (it cannot be built inside a `for`), so
# the row is unrolled to six and every house past the second is switched on by the knob.
# ======================================================================================
level 1 "Ground floor" height 2700 {
place ground(WIDTH, DEPTH, 0, HOUSES) as h1 at (0,0)
place ground(WIDTH, DEPTH, 1, HOUSES) as h2 at (2 * WIDTH,0) mirror x
if HOUSES > 2 {
place ground(WIDTH, DEPTH, 2, HOUSES) as h3 at (2 * WIDTH,0)
}
if HOUSES > 3 {
place ground(WIDTH, DEPTH, 3, HOUSES) as h4 at (4 * WIDTH,0) mirror x
}
if HOUSES > 4 {
place ground(WIDTH, DEPTH, 4, HOUSES) as h5 at (4 * WIDTH,0)
}
if HOUSES > 5 {
place ground(WIDTH, DEPTH, 5, HOUSES) as h6 at (6 * WIDTH,0) mirror x
}
# Checked for any knob value, never solved.
keep align h1.r_hall.bottom h2.r_hall.bottom
keep min clear h1.r_hall 1100
# Fences: one between every pair of gardens, front and back; the back and side boundary.
for i in 1..HOUSES {
fence picket { (i * WIDTH,-T / 2) (i * WIDTH,-FRONT) }
fence panel { (i * WIDTH,DEPTH + T / 2) (i * WIDTH,DEPTH + BACK) }
}
fence panel { (-SIDE,-FRONT) (-SIDE,DEPTH + BACK) (ROW + SIDE,DEPTH + BACK) (ROW + SIDE,-FRONT) }
# Dimensions on the building: one link per house along the street front, the overall
# length on the garden front, the depth on the west gable.
for i in 0..HOUSES {
let lo = i * WIDTH - T / 2 + T / 2 * min(i, 1)
let hi = (i + 1) * WIDTH + T / 2 - T / 2 * min(HOUSES - 1 - i, 1)
dim (hi,-T / 2)->(lo,-T / 2) offset 600
}
dim (-T / 2,DEPTH + T / 2)->(ROW + T / 2,DEPTH + T / 2) offset 900
dim (-T / 2,-T / 2)->(-T / 2,DEPTH + T / 2) offset 900
}
level 2 "First floor" height 2700 {
place upper(WIDTH, DEPTH, 0, HOUSES) as h1 at (0,0)
place upper(WIDTH, DEPTH, 1, HOUSES) as h2 at (2 * WIDTH,0) mirror x
if HOUSES > 2 {
place upper(WIDTH, DEPTH, 2, HOUSES) as h3 at (2 * WIDTH,0)
}
if HOUSES > 3 {
place upper(WIDTH, DEPTH, 3, HOUSES) as h4 at (4 * WIDTH,0) mirror x
}
if HOUSES > 4 {
place upper(WIDTH, DEPTH, 4, HOUSES) as h5 at (4 * WIDTH,0)
}
if HOUSES > 5 {
place upper(WIDTH, DEPTH, 5, HOUSES) as h6 at (6 * WIDTH,0) mirror x
}
keep equal width h1.r_bed1 h2.r_bed1
keep equal depth h1.r_bed1 h1.r_bed2 h2.r_bed1 h2.r_bed2
keep min clear h1.r_bed2 2400
dim (ROW + T / 2,-T / 2)->(-T / 2,-T / 2) offset 900
dim (-T / 2,-T / 2)->(-T / 2,DEPTH + T / 2) offset 900
}
# The stair is one shaft through both storeys in every house.
keep stacked h1.st on levels 1 2
site {
street north
hemisphere north
boundary (-SIDE,-FRONT) (ROW + SIDE,-FRONT) (ROW + SIDE,DEPTH + BACK) (-SIDE,DEPTH + BACK)
}
title {
project "Row Houses"
drawn_by "ArchLang"
date "2026-12-03"
number "SR-08"
revision "A"
}
}
More in Scripting & composition
- Kit of Parts (components): A three-bedroom flat assembled from a library of parts: bathrooms, a kitchen and furniture sets written once as components.
- Relational (right-of): Rooms positioned relative to one another with right-of, below and align; the walls and doors are derived from the rooms, so they reflow with them.
- Parametric (for loop): A row of studio units generated by a for loop over a range: change one constant and the whole row regenerates.
- Resizable Flat (knobs): A one-bedroom flat sized by three numbers at its top: change one and the walls, doors, fixtures and dimensions follow.
- Accessible (accTitle): A two-room plan carrying accTitle and accDescr, the keywords that supply the accessible SVG title and description.