"""Derive the v010 concept plan from the v009 plan SVG. python3 source/samford-v010-pattern-language/make_plan_v010.py Plan mapping (same as v009): svg_x = 600 + 13 x, svg_y = 500 - 13 y (metres, X east, Y north). Coordinates below match add_pattern_language.py. """ from pathlib import Path root = Path(__file__).resolve().parents[2] src = root / 'plans/concept/wind-turbine-plan-v009.svg' dst = root / 'plans/concept/pattern-language-plan-v010.svg' t = src.read_text() X = lambda x: 600 + 13 * x Y = lambda y: 500 - 13 * y LINE = 'stroke="#657666" stroke-width="1.5"' APL = 'https://patternlanguage.cc/Patterns/' def rect(x0, x1, y0, y1, fill, dashed=False): dash = ' stroke-dasharray="5 5"' if dashed else '' return (f'') def text(x, y, body, size=10, anchor='middle', extra=''): return f'{body}' def replace(old, new): global t assert t.count(old) == 1, old t = t.replace(old, new) replace('A home held together by its garden.', 'A home that grows with its family.') replace('SAMFORD VALLEY / Aligned pavilions, soft garden curves and room to grow · Concept 009 · Wind turbine study', 'SAMFORD VALLEY / Three generations from day one · modules that can be added later · Concept 010 · A Pattern Language') # The east shadow is now the built elder cottage. replace('', '') replace('FUTURE', '') replace('PAVILION 1', '') replace('FUTURE', 'LATER') replace('PAVILION 2', 'Teen cottage' 'or studio' '154') replace('MAIN HOUSE', 'COMMON ROOM') replace('Kitchen · dining', 'Farmhouse kitchen') replace('Living / reading', 'Ceiling +0.6 m') replace('PARENTS', 'COUPLE’S REALM') replace('Bedroom + bath', 'Bedroom + bath · 136') replace('TABLE FOR TEN', 'TABLE FOR TEN') replace('Tea + matcha', 'Tea + matcha') replace('13 planted garden beds · Smooth pedestrian routes · Future pavilions remain shadows · Table-tennis deck removed', 'Couple, children and elders from day one · One common room at the heart · ' 'Solid = build now, dashed = add later on the same 1.2 m grid') add = [] # Children's realm wing, covered deck, link to the verandah, garden steps add.append(rect(-8.4, -6.0, 3.6, 5.4, '#c5cfb6')) add.append(rect(-16.8, -8.4, 4.8, 5.9, '#c5cfb6')) add.append(rect(-15.6, -14.6, 5.9, 7.9, '#cdbf9f')) add.append(rect(-16.8, -8.4, 0.0, 4.8, '#d9c5a5')) for x in (-14.4, -10.8): add.append(f'') add.append(text(X(-12.6), Y(3.1), 'CHILDREN’S REALM')) add.append(text(X(-12.6), Y(2.1), 'Bed alcoves · play room', 9)) add.append(text(X(-12.6), Y(1.2), '137 · 188', 9, extra=' class="sub"')) # Alcoves off the common room add.append(rect(2.52, 4.28, -4.32, -2.98, '#e3cfa9')) add.append(rect(-7.32, -6.1, .52, 2.68, '#e3cfa9')) add.append(f'') add.append(text(X(4.28) + 17, Y(-3.6) + 3, 'Study alcove · 179', 9, 'start')) add.append(f'') add.append(text(X(-7.32) - 16, Y(1.0) + 33, 'Window seat · 180', 9, 'end')) # Elder cottage, porch, level path to the dining terrace add.append(f'') add.append(rect(9.6, 14.0, 14.2, 15.4, '#c8c0aa')) add.append(rect(9.6, 16.8, 9.4, 14.2, '#d9c5a5')) add.append(f'') add.append(text(X(13.2), Y(12.6), 'ELDER COTTAGE')) add.append(text(X(13.2), Y(11.6), 'Step-free · own door', 9)) add.append(text(X(13.2), Y(10.6), '155 · 40 · 138', 9, extra=' class="sub"')) # Future: second elder cottage or rooms to rent add.append(rect(9.6, 16.8, 19.6, 24.4, '#e7ecdf', dashed=True)) add.append(text(X(13.2), Y(22.9), 'LATER', 9)) add.append(text(X(13.2), Y(22.0), 'Elder cottage 2 or', 9)) add.append(text(X(13.2), Y(21.1), 'rooms to rent · 153', 9)) # Entrance arbour add.append(rect(4.75, 7.1, -9.0, -7.1, 'none')) for x in (4.95, 6.85): for y in (-8.75, -7.35): add.append(f'') add.append(text(X(5.9), Y(-9.0) + 14, 'Entrance arbour · 112', 9)) # Right-hand legend: patterns used, linked to patternlanguage.cc patterns = [ ('Built today', None), ('Couple’s Realm', 136), ('Children’s Realm', 137), ('Old Age Cottage', 155), ('Common Areas at the Heart', 129), ('Farmhouse Kitchen', 139), ('Ceiling Height Variety', 190), ('Alcoves', 179), ('Window Place', 180), ('Bed Alcove', 188), ('Sleeping to the East', 138), ('Light on Two Sides of Every Room', 159), ('Connected Buildings', 108), ('Arcades', 119), ('Entrance Transition', 112), ('Intimacy Gradient', 127), ('Old People Everywhere', 40), ('Positive Outdoor Space', 106), ('South Facing Outdoors*', 105), ('Room to grow', None), ('Teenager’s Cottage', 154), ('Rooms to Rent', 153), ('Structure Follows Social Spaces', 205), ('Gradual Stiffening', 208), ] slug = {136: "Couple's-Realm", 137: "Children's-Realm", 155: 'Old-Age-Cottage', 129: 'Common-Areas-at-the-Heart', 139: 'Farmhouse-Kitchen', 190: 'Ceiling-Height-Variety', 179: 'Alcoves', 180: 'Window-Place', 188: 'Bed-Alcove', 138: 'Sleeping-to-the-East', 159: 'Light-on-Two-Sides-of-Every-Room', 108: 'Connected-Buildings', 119: 'Arcades', 112: 'Entrance-Transition', 127: 'Intimacy-Gradient', 40: 'Old-People-Everywhere', 106: 'Positive-Outdoor-Space', 105: 'South-Facing-Outdoors', 154: "Teenager's-Cottage", 153: 'Rooms-to-Rent', 205: 'Structure-Follows-Social-Spaces', 208: 'Gradual-Stiffening'} lx, ly = 1092, 268 add.append(f'A PATTERN LANGUAGE') add.append(f'Alexander et al., 1977 · patternlanguage.cc') y = ly + 46 for name, num in patterns: if num is None: add.append(f'{name.upper()}') y += 18 continue add.append(f'' f'{num} {name}') y += 16 if name == 'Positive Outdoor Space': pass add.append(f'*Southern hemisphere: outdoor rooms face north.') y += 34 add.append(f'INTIMACY GRADIENT') for i, line in enumerate(['Arrival → arbour → verandah', '→ common room and court', '→ children’s realm · elder cottage', '→ couple’s realm · meditation']): add.append(f'{line}') replace('', '\n'.join(add) + '\n') replace('viewBox="0 -220 1400 1400"', 'viewBox="0 -220 1420 1400"') replace('', '') replace('width="1400" height="1400" viewBox', 'width="1420" height="1400" viewBox') dst.write_text(t) print('PLAN_WRITTEN', dst)