Spec to 3D -- Building Model Generator
Overview
Convert structured architectural data (from architectural-drawing-parser or manual specs) into 3D building models. Supports three output formats: Three.js (interactive web viewer), Pascal Editor JSON (BIM-style node graph), and plain JSON (for IFC/GLB conversion). Works as the final stage in a drawing-to-3D pipeline alongside architectural-drawing-parser and ibc-building-codes.
Instructions
Pipeline
Architectural Drawing (image/PDF)
| architectural-drawing-parser
Structured BuildingData JSON
| ibc-building-codes (validation)
Validated Building Data
| spec-to-3d (THIS SKILL)
3D Model Output:
- Three.js Group (web viewer)
- Pascal Editor JSON (BIM node graph)
- Building3D JSON (for IFC/GLB export)
Input Requirements
The generator expects a BuildingData object with:
- stories --
{ permitted, actual } (number of floors)
- units -- Array of
{ name, area: { sqft, sqm }, occupantLoad } (unit types per floor)
- height --
{ permitted, actual } in feet and meters
- occupancy and constructionType -- for IBC validation context
Generation Logic
- Floor-to-floor height: Default 9'-0" (2.74m) per IBC R-2 residential standard (7'-0" minimum habitable)
- Unit dimensions: Derived from area using 1:1.5 aspect ratio (width:depth). Override for corridor-loaded or deep units
- Wall thickness: 300mm exterior, 150mm interior partitions (US wood frame standard)
- Layout: Units placed side-by-side per floor with 150mm party walls, common corridor along one side (5'-0" / 1.52m wide)
- Stairs: Two stairwells at building ends, 4'-0" wide x 10'-0" deep
- Room subdivision: Automatic based on unit area -- studio (<50 sqm), 1-bed (50-70 sqm), 2-bed (>70 sqm)
Output Formats
| Format |
Use Case |
Description |
json (Building3D) |
IFC conversion, custom renderers |
Plain data: levels, units, rooms, walls, openings |
pascal (Pascal Editor) |
BIM workflows |
Node graph with site > building > level > wall/room hierarchy |
threejs (THREE.Group) |
Web-based 3D viewer |
Mesh geometry with materials for floors, walls, windows |
Key Interfaces
interface Building3D {
levels: Level3D[];
totalHeight: number; // meters
footprintWidth: number;
footprintDepth: number;
}
interface Level3D {
elevation: number; // meters above grade
height: number; // floor-to-floor in meters
units: Unit3D[];
corridors: Box3D[];
stairs: Stair3D[];
}
interface Unit3D {
type: string;
position: { x: number; y: number; z: number };
width: number; depth: number; height: number; // meters
rooms: Room3D[];
walls: Wall3D[];
openings: Opening3D[];
}
Examples
Example 1: Converting a Building Spec to a 3D Model
A developer has parsed data from an IBC compliance sheet for a 3-story R-2 apartment building and wants to generate a 3D model for visualization.
Input BuildingData:
occupancy: R-2, constructionType: V-B, sprinklerSystem: NFPA 13
stories: { permitted: 4, actual: 3 }
units:
- Type A: 834 SF (77.5 sqm), 5 occupants
- Type B: 645 SF (59.9 sqm), 4 occupants
Generated Building3D (format: "json"):
Level 0 (Ground Floor): elevation 0.00m, height 2.74m
Type A: 7.19m wide x 10.78m deep (2-bedroom layout: living, kitchen, master bed, bed 2, 2 baths)
Type B: 6.32m wide x 9.48m deep (1-bedroom layout: living, kitchen, bedroom, bath)
Corridor: full building width x 1.52m deep
2 stairwells at building ends
Level 1: elevation 2.74m, height 2.74m (same layout)
Level 2: elevation 5.49m, height 2.74m (same layout, no stairs above)
Total height: 8.23m
Footprint: ~13.66m x 10.78m
Wall count: 12 exterior + 8 interior per floor
Openings: 1 door + 2 windows per unit
Example 2: Generating IFC-Compatible Output
An architect needs to export the building data for use in an IFC/BIM workflow. They generate Pascal Editor JSON that maps to a site > building > level > element hierarchy.
Input: Same 3-story R-2 building as Example 1
Output format: "pascal"
Generated Pascal Editor JSON:
{
"nodes": {
"site_1700000000": { "type": "site", "parentId": null },
"building_1700000000": { "type": "building", "parentId": "site_...", "width": 13.66, "depth": 10.78, "height": 8.23 },
"level_0": { "type": "level", "name": "Ground Floor", "elevation": 0.00, "height": 2.74 },
"level_1": { "type": "level", "name": "Level 1", "elevation": 2.74, "height": 2.74 },
"level_2": { "type": "level", "name": "Level 2", "elevation": 5.49, "height": 2.74 },
"wall_0_0": { "type": "wall", "parentId": "level_0", "start": { "x": 0, "y": 0 }, "end": { "x": 7.19, "y": 0 }, "thickness": 0.30, "isExterior": true },
"room_0_0": { "type": "room", "parentId": "level_0", "name": "Living Room", "roomType": "living", "width": 4.31, "depth": 4.31 },
... (60+ nodes total across 3 levels)
},
"rootNodeIds": ["site_1700000000"]
}
This JSON imports directly into Pascal Editor or can be converted to IFC using ifcopenshell.
Guidelines
- Floor-to-floor height defaults to 9'-0" (2.74m); override if the source drawing specifies otherwise
- Unit aspect ratio defaults to 1:1.5; corridor-loaded or deep units may need 1:2 or higher
- Window and door positions are generated algorithmically; use
architectural-drawing-parser room extraction for actual positions from drawings
- The Three.js output creates simple box geometry -- suitable for massing models and spatial validation, not photorealistic rendering
- For production BIM use, export to Pascal Editor JSON and refine in a BIM tool
- Stair geometry is simplified (box representation); detailed stair modeling requires a dedicated BIM tool
- All dimensions are in meters internally; input data in feet is converted using 1 ft = 0.3048 m
1---2name: spec-to-3d3description: >-4 Generate 3D building models from architectural specifications, parsed drawings, or5 building code data. Outputs Three.js geometry, Pascal Editor JSON, or plain JSON for6 IFC conversion. Use when: converting floor plans to 3D, building spec-driven 3D models,7 generating architectural visualizations from structured data.8license: Apache-2.09compatibility: "Node.js 18+, Three.js or Pascal Editor"10metadata:11 source: https://skillmd.com/skills/eliferjunior/spec-to-3d12 author: terminal-skills13 version: "1.0.0"14 category: design15 tags: [3d-modeling, architecture, three-js, ifc, building-generation]16---1718# Spec to 3D -- Building Model Generator1920## Overview2122Convert structured architectural data (from `architectural-drawing-parser` or manual specs) into 3D building models. Supports three output formats: **Three.js** (interactive web viewer), **Pascal Editor JSON** (BIM-style node graph), and **plain JSON** (for IFC/GLB conversion). Works as the final stage in a drawing-to-3D pipeline alongside `architectural-drawing-parser` and `ibc-building-codes`.2324## Instructions2526### Pipeline2728```29Architectural Drawing (image/PDF)30 | architectural-drawing-parser31Structured BuildingData JSON32 | ibc-building-codes (validation)33Validated Building Data34 | spec-to-3d (THIS SKILL)353D Model Output:36 - Three.js Group (web viewer)37 - Pascal Editor JSON (BIM node graph)38 - Building3D JSON (for IFC/GLB export)39```4041### Input Requirements4243The generator expects a `BuildingData` object with:4445- **stories** -- `{ permitted, actual }` (number of floors)46- **units** -- Array of `{ name, area: { sqft, sqm }, occupantLoad }` (unit types per floor)47- **height** -- `{ permitted, actual }` in feet and meters48- **occupancy** and **constructionType** -- for IBC validation context4950### Generation Logic51521. **Floor-to-floor height**: Default 9'-0" (2.74m) per IBC R-2 residential standard (7'-0" minimum habitable)532. **Unit dimensions**: Derived from area using 1:1.5 aspect ratio (width:depth). Override for corridor-loaded or deep units543. **Wall thickness**: 300mm exterior, 150mm interior partitions (US wood frame standard)554. **Layout**: Units placed side-by-side per floor with 150mm party walls, common corridor along one side (5'-0" / 1.52m wide)565. **Stairs**: Two stairwells at building ends, 4'-0" wide x 10'-0" deep576. **Room subdivision**: Automatic based on unit area -- studio (<50 sqm), 1-bed (50-70 sqm), 2-bed (>70 sqm)5859### Output Formats6061| Format | Use Case | Description |62|---|---|---|63| `json` (Building3D) | IFC conversion, custom renderers | Plain data: levels, units, rooms, walls, openings |64| `pascal` (Pascal Editor) | BIM workflows | Node graph with site > building > level > wall/room hierarchy |65| `threejs` (THREE.Group) | Web-based 3D viewer | Mesh geometry with materials for floors, walls, windows |6667### Key Interfaces6869```typescript70interface Building3D {71 levels: Level3D[];72 totalHeight: number; // meters73 footprintWidth: number;74 footprintDepth: number;75}7677interface Level3D {78 elevation: number; // meters above grade79 height: number; // floor-to-floor in meters80 units: Unit3D[];81 corridors: Box3D[];82 stairs: Stair3D[];83}8485interface Unit3D {86 type: string;87 position: { x: number; y: number; z: number };88 width: number; depth: number; height: number; // meters89 rooms: Room3D[];90 walls: Wall3D[];91 openings: Opening3D[];92}93```9495## Examples9697### Example 1: Converting a Building Spec to a 3D Model9899A developer has parsed data from an IBC compliance sheet for a 3-story R-2 apartment building and wants to generate a 3D model for visualization.100101```102Input BuildingData:103 occupancy: R-2, constructionType: V-B, sprinklerSystem: NFPA 13104 stories: { permitted: 4, actual: 3 }105 units:106 - Type A: 834 SF (77.5 sqm), 5 occupants107 - Type B: 645 SF (59.9 sqm), 4 occupants108109Generated Building3D (format: "json"):110 Level 0 (Ground Floor): elevation 0.00m, height 2.74m111 Type A: 7.19m wide x 10.78m deep (2-bedroom layout: living, kitchen, master bed, bed 2, 2 baths)112 Type B: 6.32m wide x 9.48m deep (1-bedroom layout: living, kitchen, bedroom, bath)113 Corridor: full building width x 1.52m deep114 2 stairwells at building ends115116 Level 1: elevation 2.74m, height 2.74m (same layout)117 Level 2: elevation 5.49m, height 2.74m (same layout, no stairs above)118119 Total height: 8.23m120 Footprint: ~13.66m x 10.78m121 Wall count: 12 exterior + 8 interior per floor122 Openings: 1 door + 2 windows per unit123```124125### Example 2: Generating IFC-Compatible Output126127An architect needs to export the building data for use in an IFC/BIM workflow. They generate Pascal Editor JSON that maps to a site > building > level > element hierarchy.128129```130Input: Same 3-story R-2 building as Example 1131Output format: "pascal"132133Generated Pascal Editor JSON:134{135 "nodes": {136 "site_1700000000": { "type": "site", "parentId": null },137 "building_1700000000": { "type": "building", "parentId": "site_...", "width": 13.66, "depth": 10.78, "height": 8.23 },138 "level_0": { "type": "level", "name": "Ground Floor", "elevation": 0.00, "height": 2.74 },139 "level_1": { "type": "level", "name": "Level 1", "elevation": 2.74, "height": 2.74 },140 "level_2": { "type": "level", "name": "Level 2", "elevation": 5.49, "height": 2.74 },141 "wall_0_0": { "type": "wall", "parentId": "level_0", "start": { "x": 0, "y": 0 }, "end": { "x": 7.19, "y": 0 }, "thickness": 0.30, "isExterior": true },142 "room_0_0": { "type": "room", "parentId": "level_0", "name": "Living Room", "roomType": "living", "width": 4.31, "depth": 4.31 },143 ... (60+ nodes total across 3 levels)144 },145 "rootNodeIds": ["site_1700000000"]146}147148This JSON imports directly into Pascal Editor or can be converted to IFC using ifcopenshell.149```150151## Guidelines152153- Floor-to-floor height defaults to 9'-0" (2.74m); override if the source drawing specifies otherwise154- Unit aspect ratio defaults to 1:1.5; corridor-loaded or deep units may need 1:2 or higher155- Window and door positions are generated algorithmically; use `architectural-drawing-parser` room extraction for actual positions from drawings156- The Three.js output creates simple box geometry -- suitable for massing models and spatial validation, not photorealistic rendering157- For production BIM use, export to Pascal Editor JSON and refine in a BIM tool158- Stair geometry is simplified (box representation); detailed stair modeling requires a dedicated BIM tool159- All dimensions are in meters internally; input data in feet is converted using 1 ft = 0.3048 m