Kit of Parts (components) — an ArchLang floor plan example
A three-bedroom flat assembled from a library of parts: bathrooms, a kitchen and furniture sets written once as components.
This plan compiles to 8 rooms, 99.63 m² of floor area and 7 windows; every room is reachable from the entrance.
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
- Bindings (let)
- Components
- Placing instances (place)
- Control flow (for, if, while)
- Walls from rooms
- Rooms
- Polygonal rooms
- Doors
- Windows
- Openings
- Furniture
- Dimensions
- Outdoor ground
- 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.
# Kit of Parts: a three-bedroom flat assembled from a shared library.
#
# The rooms and walls are this plan's own; everything fitted or furnished comes from lib/ as a
# `component`, imported by name and dropped in with `place`. A practice keeps one bathroom, one
# ensuite, one L kitchen, one bedroom set, and every project that uses them gets the same,
# checked, dimensioned parts. Change a part once in lib/, recompile, and every flat updates.
#
# The flat is a deck-access through unit on the third floor: entered from the access deck on the
# north (not drawn), bedrooms 2 and 3 and the kitchen on that side, the main bedroom and the living
# room on the south, the balcony off the living room to the east. The family bathroom and the
# ensuite sit back to back in the middle on ONE wet wall: two parts written to the same rule,
# placed once as drawn and once `mirror y`, so both plumbing runs land on the wall they share.
# The L kitchen is placed `mirror x` to turn its corner to the right.
plan "Kit of Parts" {
units mm
grid 50
paper A3 landscape
scale 1:50
north up
schedule rooms
import "lib/bathrooms.arch": bathroom, ensuite
import "lib/kitchens.arch": l_kitchen
import "lib/furniture-sets.arch": bedroom_set, single_bed_set, study_corner, living_set, dining_set
# ---- the grid: every room and every placed part is read off these numbers ----
let E = 250 # exterior wall
let P = 100 # partition
let W = 12300 # overall length, wall centre to wall centre
let D = 8100 # overall depth
let X1 = 3600 # bedroom 2 | bedroom 3, main bedroom | wet core
let X2 = 6300 # bedroom 3 | hall, wet core | living
let X3 = 8100 # hall | kitchen
let Y1 = 3400 # north rooms | corridor
let Y2 = 4500 # corridor | south rooms
let Y3 = 6300 # the shared wet wall
# inner faces
let e = E / 2
let p = P / 2
# The flat is one storey of a deck-access block: a `level` block so the title block names it.
level 3 "Third floor" height 2900 {
# ---- rooms ----
room id=r_bed2 at (0,0) size X1 x Y1 label "Bedroom 2" uses bedroom floor timber
room id=r_bed3 at (X1,0) size (X2 - X1) x Y1 label "Bedroom 3" uses bedroom floor timber
room id=r_hall polygon (X2,0) (X3,0) (X3,Y2) (0,Y2) (0,Y1) (X2,Y1)
label "Hall" at (7200,2000) uses hall entry floor timber
room id=r_kitchen at (X3,0) size (W - X3) x Y2 label "Kitchen / Dining" uses kitchen dining floor tile
room id=r_main at (0,Y2) size X1 x (D - Y2) label "Main bedroom" uses bedroom floor timber
room id=r_bath at (X1,Y2) size (X2 - X1) x (Y3 - Y2) label "Bathroom" uses bath floor tile
room id=r_ens at (X1,Y3) size (X2 - X1) x (D - Y3) label "Ensuite" uses bath floor tile
room id=r_living at (X2,Y2) size (W - X2) x (D - Y2) label "Living" uses living floor timber
walls from rooms exterior E partition P {
open between r_kitchen and r_living
}
# ---- the parts ----
# The wet core: one wet wall at y = Y3, a bathroom on its north side and an ensuite on its
# south side reflected onto it. Each part is placed at its room's inner corner.
place bathroom(X2 - X1 - P, Y3 - Y2 - P) as bath_fit at (X1 + p, Y2 + p)
place ensuite(X2 - X1 - P, D - Y3 - p - e) as ens_fit at (X1 + p, D - e) mirror y
# The L kitchen, its corner in the kitchen's north-east corner.
place l_kitchen(3200, 3000) as kit at (W - e, e) mirror x
place dining_set(3) as dining at (8600, 1600)
# Bedrooms: the heads of the double beds on the west wall.
place bedroom_set(1400) as bed2_set at (e, 500)
place bedroom_set(1600) as main_set at (e, 5150)
place single_bed_set() as bed3_set at (X1 + p, 200)
place study_corner(1200) as bed3_desk at (X2 - p, 1300) mirror x
# Living: the sofa backs onto the wet core.
place living_set() as lounge at (X2 + p, 5100)
# ---- doors ----
door id=d_front on r_hall.top at 900 from start width 1000 swing inward
door id=d_bed2 between r_hall and r_bed2 at 3050 from r_bed2.left width 800 swing into r_bed2
door id=d_bed3 between r_hall and r_bed3 at 2100 from r_bed3.left width 800 swing into r_bed3
door id=d_main between r_hall and r_main at 3050 from r_main.left width 800 swing into r_main
door id=d_bath between r_hall and r_bath at 550 from r_bath.left width 800 swing into r_bath
door id=d_ens between r_main and r_ens at 1100 from r_ens.top width 800 swing into r_ens
opening id=o_living between r_hall and r_living at 900 from start width 1200
opening id=o_kitchen between r_hall and r_kitchen at 3900 from r_kitchen.top width 900
door id=d_balcony glazed_sliding on r_living.right at 1800 from start width 2000
# ---- windows ----
window casement on r_bed2.top width 1400
window casement on r_bed3.top width 1200
window casement on r_kitchen.top at 2975 from start width 1200
window fixed on r_kitchen.top at 1300 from start width 1000
window tilt_turn on r_main.bottom width 1600
window tilt on r_ens.bottom at 1300 from r_ens.left width 700 sill 1500
window casement on r_living.bottom at 3600 from start width 2000
# ---- one-off pieces, written inline ----
furniture wardrobe against r_bed2.right offset 1050 size 1800x600 in r_bed2
furniture wardrobe at (X1 + p, 2750) size 1200x600 rotate 180 in r_bed3
furniture wardrobe against r_main.right offset 1500 size 1200x600 in r_main
furniture shoe_cabinet against r_hall.right offset 1500 size 900x350 in r_hall
furniture coat_rack at (6400, 2200) size 500x500 in r_hall
furniture sideboard against r_living.bottom offset 1500 size 1600x450 in r_living
furniture bookshelf against r_living.bottom offset 5300 size 1000x350 in r_living
furniture floor_lamp at (9450, 5450) size 400x400 in r_living
# ---- the balcony ----
outdoor id=g_balcony balcony at (W + e, 4800) size 1500x3000 label "Balcony"
furniture id=t_bal outdoor_table at (12750, 6000) size 800x800
furniture outdoor_chair at (12900, 5400) size 500x500 facing t_bal
furniture outdoor_chair at (12900, 6900) size 500x500 facing t_bal
# ---- dimensions, hand-placed on the building ----
# Overall length (north, over the access deck) and depth (west), outer face to outer face.
dim (W + e, 0 - e)->(0 - e, 0 - e) offset 1300
dim (0 - e, 0 - e)->(0 - e, D + e) offset 900
# A chain along the entrance facade: every jamb on the north wall.
let NORTH = [0 - e, 1100, 2500, 4350, 5550, 6700, 7700, 8900, 9900, 10475, 11675, W + e]
for i in 0..11 {
dim (NORTH[i + 1], 0 - e)->(NORTH[i], 0 - e) offset 600
}
}
title {
project "Kit of Parts"
drawn_by "ArchLang"
date "2026-12-03"
number "SR-13"
revision "A"
}
}
More in Scripting & composition
- Row Houses (knobs): A terrace of two-storey houses written once and placed along the street: change one of three numbers and every house follows.
- 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.