planscript 1.4.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LANGUAGE_REFERENCE.md +472 -4
- package/dist/ast/types.d.ts +84 -4
- package/dist/ast/types.d.ts.map +1 -1
- package/dist/cli.js +28 -6
- package/dist/cli.js.map +1 -1
- package/dist/exporters/svg.d.ts +3 -0
- package/dist/exporters/svg.d.ts.map +1 -1
- package/dist/exporters/svg.js +48 -2
- package/dist/exporters/svg.js.map +1 -1
- package/dist/geometry/index.d.ts.map +1 -1
- package/dist/geometry/index.js +7 -0
- package/dist/geometry/index.js.map +1 -1
- package/dist/geometry/types.d.ts +7 -0
- package/dist/geometry/types.d.ts.map +1 -1
- package/dist/lowering/index.d.ts +23 -1
- package/dist/lowering/index.d.ts.map +1 -1
- package/dist/lowering/index.js +374 -28
- package/dist/lowering/index.js.map +1 -1
- package/dist/parser/grammar.d.ts +52 -5
- package/dist/parser/grammar.d.ts.map +1 -1
- package/dist/parser/grammar.js +4927 -2026
- package/dist/parser/grammar.js.map +1 -1
- package/dist/validation/index.d.ts +5 -0
- package/dist/validation/index.d.ts.map +1 -1
- package/dist/validation/index.js +215 -0
- package/dist/validation/index.js.map +1 -1
- package/examples/advanced_positioning.psc +225 -0
- package/examples/advanced_positioning.svg +76 -0
- package/examples/courtyard_house.psc +141 -0
- package/examples/courtyard_house.svg +93 -0
- package/examples/orientation.psc +141 -0
- package/examples/orientation.svg +88 -0
- package/examples/zones.psc +275 -0
- package/examples/zones.svg +89 -0
- package/package.json +1 -1
- package/examples/casa_moderna.psc +0 -375
- package/examples/casa_moderna_v2.psc +0 -406
- package/examples/casa_moderna_v3.psc +0 -375
- package/examples/casa_moderna_v5.psc +0 -397
- package/examples/house2.psc +0 -156
- package/examples/house2.svg +0 -103
- package/examples/house3.svg +0 -139
package/LANGUAGE_REFERENCE.md
CHANGED
|
@@ -6,12 +6,16 @@ This document provides a complete specification of the PlanScript language for d
|
|
|
6
6
|
|
|
7
7
|
## Table of Contents
|
|
8
8
|
|
|
9
|
+
- [Quick Start](#quick-start)
|
|
9
10
|
- [File Structure](#file-structure)
|
|
10
11
|
- [Units](#units)
|
|
11
12
|
- [Origin](#origin)
|
|
12
13
|
- [Defaults](#defaults)
|
|
14
|
+
- [Site](#site)
|
|
13
15
|
- [Plan Block](#plan-block)
|
|
14
16
|
- [Footprint](#footprint)
|
|
17
|
+
- [Zones](#zones)
|
|
18
|
+
- [Courtyards](#courtyards)
|
|
15
19
|
- [Rooms](#rooms)
|
|
16
20
|
- [Rectangle with Two Corners](#rectangle-with-two-corners)
|
|
17
21
|
- [Rectangle with Position and Size](#rectangle-with-position-and-size)
|
|
@@ -30,6 +34,78 @@ This document provides a complete specification of the PlanScript language for d
|
|
|
30
34
|
|
|
31
35
|
---
|
|
32
36
|
|
|
37
|
+
## Quick Start
|
|
38
|
+
|
|
39
|
+
### Installation
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
npm install -g planscript
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Or use directly with npx (no installation required):
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
npx planscript myplan.psc --svg output.svg
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### CLI Usage
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
planscript <input.psc> [options]
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
**Options:**
|
|
58
|
+
|
|
59
|
+
| Option | Description |
|
|
60
|
+
|--------|-------------|
|
|
61
|
+
| `--svg <file>` | Write SVG output to file |
|
|
62
|
+
| `--json <file>` | Write JSON geometry output to file |
|
|
63
|
+
| `--dimensions` | Include dimension lines in SVG |
|
|
64
|
+
| `--no-labels` | Don't show room labels in SVG |
|
|
65
|
+
| `--no-svg` | Don't generate SVG (useful with --json) |
|
|
66
|
+
| `--help`, `-h` | Show help message |
|
|
67
|
+
|
|
68
|
+
**Examples:**
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
# Compile and generate SVG
|
|
72
|
+
planscript house.psc --svg house.svg
|
|
73
|
+
|
|
74
|
+
# Include dimension lines
|
|
75
|
+
planscript house.psc --svg house.svg --dimensions
|
|
76
|
+
|
|
77
|
+
# Generate both SVG and JSON
|
|
78
|
+
planscript house.psc --svg house.svg --json house.json
|
|
79
|
+
|
|
80
|
+
# Validate only (check for errors without generating output)
|
|
81
|
+
planscript house.psc --no-svg
|
|
82
|
+
|
|
83
|
+
# Use npx without installing
|
|
84
|
+
npx planscript examples/house.psc --svg output.svg
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### Validation Output
|
|
88
|
+
|
|
89
|
+
If compilation fails, PlanScript shows detailed error messages:
|
|
90
|
+
|
|
91
|
+
```
|
|
92
|
+
Compilation failed:
|
|
93
|
+
validate [E201]: Rooms "living" and "kitchen" overlap
|
|
94
|
+
validate [E130]: Room "bedroom" is outside the footprint
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
If successful:
|
|
98
|
+
|
|
99
|
+
```
|
|
100
|
+
Compilation successful!
|
|
101
|
+
SVG written to: house.svg
|
|
102
|
+
Rooms: 5
|
|
103
|
+
Walls: 12
|
|
104
|
+
Openings: 6
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
33
109
|
## File Structure
|
|
34
110
|
|
|
35
111
|
A PlanScript file (`.psc`) has the following structure. All top-level declarations are optional except for `plan`.
|
|
@@ -38,10 +114,13 @@ A PlanScript file (`.psc`) has the following structure. All top-level declaratio
|
|
|
38
114
|
units <unit> # Optional: set measurement units
|
|
39
115
|
origin (<x>, <y>) # Optional: set coordinate origin
|
|
40
116
|
defaults { ... } # Optional: default values for openings
|
|
117
|
+
site { ... } # Optional: site orientation (for solar/street context)
|
|
41
118
|
|
|
42
119
|
plan "<name>" { # Required: the floor plan definition
|
|
43
120
|
footprint ... # Required: building boundary
|
|
44
|
-
|
|
121
|
+
zone ... { ... } # Zero or more zones (grouped rooms)
|
|
122
|
+
room ... { ... } # Zero or more standalone rooms
|
|
123
|
+
courtyard ... { ... } # Zero or more courtyards (open spaces)
|
|
45
124
|
opening ... { ... } # Zero or more openings (doors/windows)
|
|
46
125
|
assert ... # Zero or more validation assertions
|
|
47
126
|
}
|
|
@@ -109,6 +188,51 @@ defaults {
|
|
|
109
188
|
|
|
110
189
|
---
|
|
111
190
|
|
|
191
|
+
## Site
|
|
192
|
+
|
|
193
|
+
Defines the site orientation, enabling context-aware design validation. This allows you to specify which direction the street faces and validate that rooms have appropriate solar orientation or proximity to the street.
|
|
194
|
+
|
|
195
|
+
### Basic Syntax
|
|
196
|
+
|
|
197
|
+
```planscript
|
|
198
|
+
site {
|
|
199
|
+
street <direction> # Required: which direction the street/front faces
|
|
200
|
+
hemisphere <hemisphere> # Optional: north (default) or south
|
|
201
|
+
}
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
**Directions:** `north`, `south`, `east`, `west`
|
|
205
|
+
|
|
206
|
+
**Hemispheres:** `north` (default), `south`
|
|
207
|
+
|
|
208
|
+
### Derived Information
|
|
209
|
+
|
|
210
|
+
When you specify `street south`, the compiler automatically derives:
|
|
211
|
+
|
|
212
|
+
| Concept | Meaning |
|
|
213
|
+
|---------|---------|
|
|
214
|
+
| `street` | South (where the entrance/front faces) |
|
|
215
|
+
| `back` | North (opposite of street, typically garden/yard) |
|
|
216
|
+
| `morning_sun` | East (sunrise direction) |
|
|
217
|
+
| `afternoon_sun` | West (sunset direction) |
|
|
218
|
+
|
|
219
|
+
### Example
|
|
220
|
+
|
|
221
|
+
```planscript
|
|
222
|
+
site {
|
|
223
|
+
street south # Front of house faces south (toward the street)
|
|
224
|
+
hemisphere north # Northern hemisphere (default)
|
|
225
|
+
}
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
With this configuration, you can use orientation assertions to validate your design:
|
|
229
|
+
- Bedrooms should have windows facing east (morning sun)
|
|
230
|
+
- Living room should face west (afternoon sun) or north (garden view)
|
|
231
|
+
- Garage should be near the street
|
|
232
|
+
- Service areas can be toward the street (don't waste good orientations)
|
|
233
|
+
|
|
234
|
+
---
|
|
235
|
+
|
|
112
236
|
## Plan Block
|
|
113
237
|
|
|
114
238
|
The main container for the floor plan. A file must have exactly one plan block.
|
|
@@ -170,6 +294,202 @@ footprint polygon [
|
|
|
170
294
|
|
|
171
295
|
---
|
|
172
296
|
|
|
297
|
+
## Zones
|
|
298
|
+
|
|
299
|
+
Zones are logical groupings of rooms that can be positioned as a unit. This allows you to think at a higher level - "place the social zone here, private zone there" - rather than calculating coordinates for each room individually.
|
|
300
|
+
|
|
301
|
+
### Basic Zone Syntax
|
|
302
|
+
|
|
303
|
+
```planscript
|
|
304
|
+
zone <id> {
|
|
305
|
+
room <id> { ... } # Rooms use local coordinates within the zone
|
|
306
|
+
room <id> { ... }
|
|
307
|
+
}
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
Rooms inside a zone use **local coordinates** (relative to the zone's origin at 0,0). When the zone is positioned, all rooms are translated together.
|
|
311
|
+
|
|
312
|
+
### Zone with Positioning
|
|
313
|
+
|
|
314
|
+
Zones can attach to other zones or standalone rooms:
|
|
315
|
+
|
|
316
|
+
```planscript
|
|
317
|
+
zone <id> {
|
|
318
|
+
attach <direction> <zone_or_room>
|
|
319
|
+
align <alignment>
|
|
320
|
+
gap <distance>
|
|
321
|
+
|
|
322
|
+
room <id> { ... }
|
|
323
|
+
room <id> { ... }
|
|
324
|
+
}
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
**Directions:**
|
|
328
|
+
| Direction | Description |
|
|
329
|
+
|-----------|-------------|
|
|
330
|
+
| `north_of` | Above the reference |
|
|
331
|
+
| `south_of` | Below the reference |
|
|
332
|
+
| `east_of` | To the right of the reference |
|
|
333
|
+
| `west_of` | To the left of the reference |
|
|
334
|
+
|
|
335
|
+
**Alignments:**
|
|
336
|
+
| Alignment | Description |
|
|
337
|
+
|-----------|-------------|
|
|
338
|
+
| `top` | Align top edges |
|
|
339
|
+
| `bottom` | Align bottom edges |
|
|
340
|
+
| `left` | Align left edges |
|
|
341
|
+
| `right` | Align right edges |
|
|
342
|
+
| `center` | Center alignment |
|
|
343
|
+
|
|
344
|
+
### Zone Example
|
|
345
|
+
|
|
346
|
+
```planscript
|
|
347
|
+
plan "House with Zones" {
|
|
348
|
+
footprint rect (0, 0) (25, 20)
|
|
349
|
+
|
|
350
|
+
# Entry area (standalone room)
|
|
351
|
+
room entry { rect (10, 0) (15, 4) }
|
|
352
|
+
|
|
353
|
+
# Social zone - living, dining, kitchen
|
|
354
|
+
zone social {
|
|
355
|
+
attach north_of entry
|
|
356
|
+
align center
|
|
357
|
+
gap 0
|
|
358
|
+
|
|
359
|
+
room living { rect (0, 0) (8, 6) }
|
|
360
|
+
room dining {
|
|
361
|
+
rect size (4, 6)
|
|
362
|
+
attach east_of living
|
|
363
|
+
align top
|
|
364
|
+
gap 0
|
|
365
|
+
}
|
|
366
|
+
room kitchen {
|
|
367
|
+
rect size (4, 6)
|
|
368
|
+
attach east_of dining
|
|
369
|
+
align top
|
|
370
|
+
gap 0
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
# Private zone - bedrooms
|
|
375
|
+
zone private {
|
|
376
|
+
attach north_of social
|
|
377
|
+
align left
|
|
378
|
+
gap 0
|
|
379
|
+
|
|
380
|
+
room master { rect (0, 0) (6, 5) }
|
|
381
|
+
room bedroom2 {
|
|
382
|
+
rect size (5, 5)
|
|
383
|
+
attach east_of master
|
|
384
|
+
align bottom
|
|
385
|
+
gap 0
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
```
|
|
390
|
+
|
|
391
|
+
In this example:
|
|
392
|
+
1. The `entry` room is placed first at fixed coordinates
|
|
393
|
+
2. The `social` zone attaches north of entry, containing living/dining/kitchen
|
|
394
|
+
3. The `private` zone attaches north of social, containing bedrooms
|
|
395
|
+
|
|
396
|
+
### Zone Labels
|
|
397
|
+
|
|
398
|
+
Zones can have optional labels:
|
|
399
|
+
|
|
400
|
+
```planscript
|
|
401
|
+
zone private {
|
|
402
|
+
label "Private Wing"
|
|
403
|
+
room master { ... }
|
|
404
|
+
}
|
|
405
|
+
```
|
|
406
|
+
|
|
407
|
+
---
|
|
408
|
+
|
|
409
|
+
## Courtyards
|
|
410
|
+
|
|
411
|
+
Courtyards define open spaces or voids within the building footprint. They are commonly used for central patios, atriums, light wells, or garden spaces in U-shaped or courtyard-style floor plans.
|
|
412
|
+
|
|
413
|
+
### Basic Courtyard Syntax
|
|
414
|
+
|
|
415
|
+
```planscript
|
|
416
|
+
courtyard <id> {
|
|
417
|
+
rect (<x1>, <y1>) (<x2>, <y2>)
|
|
418
|
+
}
|
|
419
|
+
```
|
|
420
|
+
|
|
421
|
+
Or with polygon geometry:
|
|
422
|
+
|
|
423
|
+
```planscript
|
|
424
|
+
courtyard <id> {
|
|
425
|
+
polygon [
|
|
426
|
+
(<x1>, <y1>),
|
|
427
|
+
(<x2>, <y2>),
|
|
428
|
+
...
|
|
429
|
+
]
|
|
430
|
+
}
|
|
431
|
+
```
|
|
432
|
+
|
|
433
|
+
### Courtyard with Label
|
|
434
|
+
|
|
435
|
+
```planscript
|
|
436
|
+
courtyard <id> {
|
|
437
|
+
rect (<x1>, <y1>) (<x2>, <y2>)
|
|
438
|
+
label "<display name>"
|
|
439
|
+
}
|
|
440
|
+
```
|
|
441
|
+
|
|
442
|
+
### Courtyard Examples
|
|
443
|
+
|
|
444
|
+
**Simple Central Patio:**
|
|
445
|
+
|
|
446
|
+
```planscript
|
|
447
|
+
plan "U-Shaped House" {
|
|
448
|
+
footprint rect (0, 0) (30, 40)
|
|
449
|
+
|
|
450
|
+
# Left wing
|
|
451
|
+
room wing_left { rect (0, 0) (10, 40) label "Left Wing" }
|
|
452
|
+
|
|
453
|
+
# Right wing
|
|
454
|
+
room wing_right { rect (20, 0) (30, 40) label "Right Wing" }
|
|
455
|
+
|
|
456
|
+
# Back connection
|
|
457
|
+
room back { rect (10, 30) (20, 40) label "Back" }
|
|
458
|
+
|
|
459
|
+
# Central courtyard (open space)
|
|
460
|
+
courtyard patio {
|
|
461
|
+
rect (10, 10) (20, 30)
|
|
462
|
+
label "Central Patio"
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
```
|
|
466
|
+
|
|
467
|
+
**Irregular Courtyard:**
|
|
468
|
+
|
|
469
|
+
```planscript
|
|
470
|
+
courtyard garden {
|
|
471
|
+
polygon [
|
|
472
|
+
(12, 15),
|
|
473
|
+
(22, 15),
|
|
474
|
+
(22, 28),
|
|
475
|
+
(17, 32),
|
|
476
|
+
(12, 28)
|
|
477
|
+
]
|
|
478
|
+
label "Garden"
|
|
479
|
+
}
|
|
480
|
+
```
|
|
481
|
+
|
|
482
|
+
### Courtyard Rendering
|
|
483
|
+
|
|
484
|
+
In SVG output, courtyards are rendered with:
|
|
485
|
+
- Light green fill color (to indicate open/outdoor space)
|
|
486
|
+
- Dashed border stroke
|
|
487
|
+
- Italic label text in green
|
|
488
|
+
|
|
489
|
+
This distinguishes them visually from enclosed rooms.
|
|
490
|
+
|
|
491
|
+
---
|
|
492
|
+
|
|
173
493
|
## Rooms
|
|
174
494
|
|
|
175
495
|
Rooms define the interior spaces. Each room has a unique identifier and a shape.
|
|
@@ -225,7 +545,7 @@ room <id> {
|
|
|
225
545
|
| `east_of` | To the right of the reference room |
|
|
226
546
|
| `west_of` | To the left of the reference room |
|
|
227
547
|
|
|
228
|
-
**Alignments:**
|
|
548
|
+
**Alignments (Simple):**
|
|
229
549
|
| Alignment | Description |
|
|
230
550
|
|-----------|-------------|
|
|
231
551
|
| `top` | Align top edges (for east_of/west_of) |
|
|
@@ -234,6 +554,16 @@ room <id> {
|
|
|
234
554
|
| `right` | Align right edges (for north_of/south_of) |
|
|
235
555
|
| `center` | Center alignment |
|
|
236
556
|
|
|
557
|
+
**Explicit Alignment:**
|
|
558
|
+
|
|
559
|
+
For more precise control, use explicit edge alignment:
|
|
560
|
+
|
|
561
|
+
```planscript
|
|
562
|
+
align my <edge> with <room>.<edge>
|
|
563
|
+
```
|
|
564
|
+
|
|
565
|
+
This allows aligning any edge of the new room with any edge of another room.
|
|
566
|
+
|
|
237
567
|
**Example:**
|
|
238
568
|
```planscript
|
|
239
569
|
room kitchen {
|
|
@@ -244,6 +574,65 @@ room kitchen {
|
|
|
244
574
|
}
|
|
245
575
|
```
|
|
246
576
|
|
|
577
|
+
**Example with explicit alignment:**
|
|
578
|
+
```planscript
|
|
579
|
+
room bathroom {
|
|
580
|
+
rect size (3, 2.5)
|
|
581
|
+
attach north_of bedroom
|
|
582
|
+
align my left with bedroom.left # Align left edges precisely
|
|
583
|
+
}
|
|
584
|
+
```
|
|
585
|
+
|
|
586
|
+
### Auto Dimensions
|
|
587
|
+
|
|
588
|
+
Use `auto` for width or height to calculate dimensions automatically:
|
|
589
|
+
|
|
590
|
+
```planscript
|
|
591
|
+
room <id> {
|
|
592
|
+
rect size (<width>, auto) # Auto-calculate height
|
|
593
|
+
attach <direction> <room_ref>
|
|
594
|
+
extend from <room>.<edge> to <room>.<edge> # Defines the auto dimension range
|
|
595
|
+
}
|
|
596
|
+
```
|
|
597
|
+
|
|
598
|
+
When `auto` is used:
|
|
599
|
+
- Without `extend`: Uses the target room's corresponding dimension
|
|
600
|
+
- With `extend`: Calculates the dimension from the specified edge range
|
|
601
|
+
|
|
602
|
+
**Example:**
|
|
603
|
+
```planscript
|
|
604
|
+
room hallway {
|
|
605
|
+
rect size (1.5, auto) # Width is 1.5, height calculated from extend
|
|
606
|
+
attach east_of living
|
|
607
|
+
extend from living.top to master.bottom # Height spans from living.top to master.bottom
|
|
608
|
+
}
|
|
609
|
+
```
|
|
610
|
+
|
|
611
|
+
### Fill Between Rooms
|
|
612
|
+
|
|
613
|
+
Automatically fills the gap between two rooms:
|
|
614
|
+
|
|
615
|
+
```planscript
|
|
616
|
+
room <id> {
|
|
617
|
+
fill between <room1> and <room2>
|
|
618
|
+
width <value> # Optional: explicit width
|
|
619
|
+
height <value> # Optional: explicit height
|
|
620
|
+
}
|
|
621
|
+
```
|
|
622
|
+
|
|
623
|
+
The fill geometry automatically:
|
|
624
|
+
- Detects whether rooms are separated horizontally or vertically
|
|
625
|
+
- Fills the gap between them
|
|
626
|
+
- Spans the overlapping dimension
|
|
627
|
+
|
|
628
|
+
**Example:**
|
|
629
|
+
```planscript
|
|
630
|
+
room corridor {
|
|
631
|
+
fill between living and bedrooms
|
|
632
|
+
width 1.2
|
|
633
|
+
}
|
|
634
|
+
```
|
|
635
|
+
|
|
247
636
|
### Rectangle with Span
|
|
248
637
|
|
|
249
638
|
Creates a room that spans between reference points from other rooms.
|
|
@@ -472,6 +861,81 @@ assert min_room_area <room_id> >= <value>
|
|
|
472
861
|
assert min_room_area bedroom >= 12.0
|
|
473
862
|
```
|
|
474
863
|
|
|
864
|
+
### Orientation Assertions
|
|
865
|
+
|
|
866
|
+
Orientation assertions require a `site` declaration. They validate that rooms have appropriate solar orientation or proximity to the street.
|
|
867
|
+
|
|
868
|
+
#### Has Window
|
|
869
|
+
|
|
870
|
+
Ensures a room has a window facing a specific direction:
|
|
871
|
+
|
|
872
|
+
```planscript
|
|
873
|
+
assert orientation <room_id> has_window <target>
|
|
874
|
+
```
|
|
875
|
+
|
|
876
|
+
**Targets:**
|
|
877
|
+
| Target | Description |
|
|
878
|
+
|--------|-------------|
|
|
879
|
+
| `north`, `south`, `east`, `west` | Cardinal direction |
|
|
880
|
+
| `morning_sun` | East (for bedrooms - wake up with natural light) |
|
|
881
|
+
| `afternoon_sun` | West (for living areas - evening light) |
|
|
882
|
+
| `street` | Same as the street direction from site |
|
|
883
|
+
|
|
884
|
+
**Examples:**
|
|
885
|
+
```planscript
|
|
886
|
+
assert orientation master has_window east # Morning light
|
|
887
|
+
assert orientation living has_window afternoon_sun # Evening light
|
|
888
|
+
assert orientation bedroom has_window morning_sun # Natural alarm clock
|
|
889
|
+
```
|
|
890
|
+
|
|
891
|
+
#### Near Street
|
|
892
|
+
|
|
893
|
+
Ensures a room is located near the street side of the building:
|
|
894
|
+
|
|
895
|
+
```planscript
|
|
896
|
+
assert orientation <room_id> near street
|
|
897
|
+
```
|
|
898
|
+
|
|
899
|
+
Use for rooms that need street access (garage, entry) or don't need premium orientations (service areas).
|
|
900
|
+
|
|
901
|
+
**Example:**
|
|
902
|
+
```planscript
|
|
903
|
+
assert orientation garage near street
|
|
904
|
+
assert orientation entry near street
|
|
905
|
+
```
|
|
906
|
+
|
|
907
|
+
#### Away From Street
|
|
908
|
+
|
|
909
|
+
Ensures a room is located at the back of the building (opposite the street):
|
|
910
|
+
|
|
911
|
+
```planscript
|
|
912
|
+
assert orientation <room_id> away_from street
|
|
913
|
+
```
|
|
914
|
+
|
|
915
|
+
Use for service areas that shouldn't waste street frontage.
|
|
916
|
+
|
|
917
|
+
**Example:**
|
|
918
|
+
```planscript
|
|
919
|
+
assert orientation laundry away_from street
|
|
920
|
+
assert orientation storage away_from street
|
|
921
|
+
```
|
|
922
|
+
|
|
923
|
+
#### Garden View
|
|
924
|
+
|
|
925
|
+
Ensures a room has a window facing the back (opposite the street):
|
|
926
|
+
|
|
927
|
+
```planscript
|
|
928
|
+
assert orientation <room_id> garden_view
|
|
929
|
+
```
|
|
930
|
+
|
|
931
|
+
Use for living areas that should have views of the yard/garden.
|
|
932
|
+
|
|
933
|
+
**Example:**
|
|
934
|
+
```planscript
|
|
935
|
+
assert orientation living garden_view
|
|
936
|
+
assert orientation dining garden_view
|
|
937
|
+
```
|
|
938
|
+
|
|
475
939
|
---
|
|
476
940
|
|
|
477
941
|
## Comments
|
|
@@ -693,13 +1157,16 @@ plan "Studio Apartment" {
|
|
|
693
1157
|
### Keywords
|
|
694
1158
|
|
|
695
1159
|
```
|
|
696
|
-
units, origin, defaults, plan, footprint, room, opening, assert,
|
|
1160
|
+
units, origin, defaults, site, plan, footprint, zone, room, courtyard, opening, assert,
|
|
697
1161
|
rect, polygon, at, size, attach, align, gap, span, from, to, label,
|
|
698
|
-
door, window, between, and, on, shared_edge, width, sill,
|
|
1162
|
+
door, window, between, and, on, shared_edge, width, height, sill,
|
|
699
1163
|
north_of, south_of, east_of, west_of,
|
|
700
1164
|
north, south, east, west,
|
|
701
1165
|
top, bottom, left, right, center,
|
|
702
1166
|
no_overlap, inside, all_rooms, min_room_area,
|
|
1167
|
+
orientation, has_window, near, away_from, garden_view,
|
|
1168
|
+
morning_sun, afternoon_sun, street, hemisphere,
|
|
1169
|
+
my, with, extend, fill, auto,
|
|
703
1170
|
m, cm, mm, ft, in
|
|
704
1171
|
```
|
|
705
1172
|
|
|
@@ -737,6 +1204,7 @@ Both syntaxes are equivalent. Bracketed syntax allows trailing commas.
|
|
|
737
1204
|
10 # Integer
|
|
738
1205
|
10.5 # Decimal
|
|
739
1206
|
50% # Percentage (for positions)
|
|
1207
|
+
auto # Auto-calculated dimension (for size)
|
|
740
1208
|
```
|
|
741
1209
|
|
|
742
1210
|
### Identifiers
|
package/dist/ast/types.d.ts
CHANGED
|
@@ -39,6 +39,13 @@ export interface DefaultsDeclaration extends ASTNode {
|
|
|
39
39
|
doorWidth?: number;
|
|
40
40
|
windowWidth?: number;
|
|
41
41
|
}
|
|
42
|
+
export type CardinalDirection = 'north' | 'south' | 'east' | 'west';
|
|
43
|
+
export type Hemisphere = 'north' | 'south';
|
|
44
|
+
export interface SiteDeclaration extends ASTNode {
|
|
45
|
+
type: 'SiteDeclaration';
|
|
46
|
+
street: CardinalDirection;
|
|
47
|
+
hemisphere?: Hemisphere;
|
|
48
|
+
}
|
|
42
49
|
export interface FootprintPolygon extends ASTNode {
|
|
43
50
|
type: 'FootprintPolygon';
|
|
44
51
|
points: Point[];
|
|
@@ -70,24 +77,49 @@ export interface RoomRectCenterSize extends ASTNode {
|
|
|
70
77
|
}
|
|
71
78
|
export interface RoomRectSizeOnly extends ASTNode {
|
|
72
79
|
type: 'RoomRectSizeOnly';
|
|
73
|
-
size:
|
|
80
|
+
size: SizeValue;
|
|
81
|
+
}
|
|
82
|
+
export type DimensionValue = number | 'auto';
|
|
83
|
+
export interface SizeValue {
|
|
84
|
+
x: DimensionValue;
|
|
85
|
+
y: DimensionValue;
|
|
86
|
+
}
|
|
87
|
+
export interface RoomFill extends ASTNode {
|
|
88
|
+
type: 'RoomFill';
|
|
89
|
+
between: [string, string];
|
|
90
|
+
width?: number;
|
|
91
|
+
height?: number;
|
|
74
92
|
}
|
|
75
|
-
export type RoomGeometry = RoomPolygon | RoomRectDiagonal | RoomRectAtSize | RoomRectCenterSize | RoomRectSizeOnly;
|
|
93
|
+
export type RoomGeometry = RoomPolygon | RoomRectDiagonal | RoomRectAtSize | RoomRectCenterSize | RoomRectSizeOnly | RoomFill;
|
|
76
94
|
export type RelativeDirection = 'north_of' | 'south_of' | 'east_of' | 'west_of';
|
|
77
95
|
export type AlignmentType = 'top' | 'bottom' | 'left' | 'right' | 'center';
|
|
96
|
+
export type AlignEdge = 'top' | 'bottom' | 'left' | 'right';
|
|
78
97
|
export interface AttachDirective extends ASTNode {
|
|
79
98
|
type: 'AttachDirective';
|
|
80
99
|
direction: RelativeDirection;
|
|
81
100
|
target: string;
|
|
82
101
|
}
|
|
83
|
-
export interface
|
|
102
|
+
export interface AlignDirectiveSimple extends ASTNode {
|
|
84
103
|
type: 'AlignDirective';
|
|
85
104
|
alignment: AlignmentType;
|
|
86
105
|
}
|
|
106
|
+
export interface AlignDirectiveExplicit extends ASTNode {
|
|
107
|
+
type: 'AlignDirective';
|
|
108
|
+
myEdge: AlignEdge;
|
|
109
|
+
withRoom: string;
|
|
110
|
+
withEdge: AlignEdge;
|
|
111
|
+
}
|
|
112
|
+
export type AlignDirective = AlignDirectiveSimple | AlignDirectiveExplicit;
|
|
87
113
|
export interface GapDirective extends ASTNode {
|
|
88
114
|
type: 'GapDirective';
|
|
89
115
|
distance: number;
|
|
90
116
|
}
|
|
117
|
+
export interface ExtendDirective extends ASTNode {
|
|
118
|
+
type: 'ExtendDirective';
|
|
119
|
+
axis: 'x' | 'y';
|
|
120
|
+
from: EdgeReference;
|
|
121
|
+
to: EdgeReference;
|
|
122
|
+
}
|
|
91
123
|
export interface SpanX extends ASTNode {
|
|
92
124
|
type: 'SpanX';
|
|
93
125
|
from: EdgeReference;
|
|
@@ -115,6 +147,7 @@ export interface RoomDefinition extends ASTNode {
|
|
|
115
147
|
attach?: AttachDirective;
|
|
116
148
|
align?: AlignDirective;
|
|
117
149
|
gap?: GapDirective;
|
|
150
|
+
extend?: ExtendDirective;
|
|
118
151
|
}
|
|
119
152
|
export type OpeningType = 'door' | 'window';
|
|
120
153
|
export type SwingDirection = string;
|
|
@@ -183,12 +216,58 @@ export interface AssertionMinRoomArea extends ASTNode {
|
|
|
183
216
|
export interface AssertionRoomsConnected extends ASTNode {
|
|
184
217
|
type: 'AssertionRoomsConnected';
|
|
185
218
|
}
|
|
186
|
-
export type
|
|
219
|
+
export type OrientationTarget = 'morning_sun' | 'afternoon_sun' | 'street' | CardinalDirection;
|
|
220
|
+
export interface AssertionOrientationHasWindow extends ASTNode {
|
|
221
|
+
type: 'AssertionOrientationHasWindow';
|
|
222
|
+
room: string;
|
|
223
|
+
target: OrientationTarget;
|
|
224
|
+
}
|
|
225
|
+
export interface AssertionOrientationNearStreet extends ASTNode {
|
|
226
|
+
type: 'AssertionOrientationNearStreet';
|
|
227
|
+
room: string;
|
|
228
|
+
}
|
|
229
|
+
export interface AssertionOrientationAwayFromStreet extends ASTNode {
|
|
230
|
+
type: 'AssertionOrientationAwayFromStreet';
|
|
231
|
+
room: string;
|
|
232
|
+
}
|
|
233
|
+
export interface AssertionOrientationGardenView extends ASTNode {
|
|
234
|
+
type: 'AssertionOrientationGardenView';
|
|
235
|
+
room: string;
|
|
236
|
+
}
|
|
237
|
+
export type OrientationAssertion = AssertionOrientationHasWindow | AssertionOrientationNearStreet | AssertionOrientationAwayFromStreet | AssertionOrientationGardenView;
|
|
238
|
+
export type Assertion = AssertionInsideFootprint | AssertionNoOverlap | AssertionOpeningsOnWalls | AssertionMinRoomArea | AssertionRoomsConnected | OrientationAssertion;
|
|
239
|
+
export interface ZoneDefinition extends ASTNode {
|
|
240
|
+
type: 'ZoneDefinition';
|
|
241
|
+
name: string;
|
|
242
|
+
label?: string;
|
|
243
|
+
rooms: RoomDefinition[];
|
|
244
|
+
attach?: AttachDirective;
|
|
245
|
+
align?: AlignDirective;
|
|
246
|
+
gap?: GapDirective;
|
|
247
|
+
}
|
|
248
|
+
export type CourtyardGeometry = CourtyardRect | CourtyardPolygon;
|
|
249
|
+
export interface CourtyardRect extends ASTNode {
|
|
250
|
+
type: 'CourtyardRect';
|
|
251
|
+
p1: Point;
|
|
252
|
+
p2: Point;
|
|
253
|
+
}
|
|
254
|
+
export interface CourtyardPolygon extends ASTNode {
|
|
255
|
+
type: 'CourtyardPolygon';
|
|
256
|
+
points: Point[];
|
|
257
|
+
}
|
|
258
|
+
export interface CourtyardDefinition extends ASTNode {
|
|
259
|
+
type: 'CourtyardDefinition';
|
|
260
|
+
name: string;
|
|
261
|
+
label?: string;
|
|
262
|
+
geometry: CourtyardGeometry;
|
|
263
|
+
}
|
|
187
264
|
export interface PlanDefinition extends ASTNode {
|
|
188
265
|
type: 'PlanDefinition';
|
|
189
266
|
name: string;
|
|
190
267
|
footprint: Footprint;
|
|
268
|
+
zones: ZoneDefinition[];
|
|
191
269
|
rooms: RoomDefinition[];
|
|
270
|
+
courtyards: CourtyardDefinition[];
|
|
192
271
|
openings: Opening[];
|
|
193
272
|
wallOverrides: WallThicknessOverride[];
|
|
194
273
|
assertions: Assertion[];
|
|
@@ -200,6 +279,7 @@ export interface Program extends ASTNode {
|
|
|
200
279
|
axis?: AxisDeclaration;
|
|
201
280
|
grid?: GridDeclaration;
|
|
202
281
|
defaults?: DefaultsDeclaration;
|
|
282
|
+
site?: SiteDeclaration;
|
|
203
283
|
plan: PlanDefinition;
|
|
204
284
|
}
|
|
205
285
|
//# sourceMappingURL=types.d.ts.map
|