spec-to-3d
FreeNo executable scriptsNot checkedGenerate 3D building massing models from architectural specifications, parsed drawings, or building code data. Produces a plain Building3D JSON and a Three.js…
by TerminalSkills★ 221 GitHub starsAbout this skill
Spec to 3D -- Building Model Generator
Overview
Convert structured architectural data (from architectural-drawing-parser or a manual spec) into a 3D massing model: stacked floors, units side by side, a corridor and a footprint. This is a recipe you implement in your own project, not an installable package. It yields two outputs: a plain Building3D JSON (levels, units, corridors) for custom renderers, and a Three.js Group for a web viewer. For BIM-style editing, load the result into Pascal Editor, which agents drive through its MCP server. It is the last stage after architectural-drawing-parser and ibc-building-codes.
Instructions
Pipeline
Architectural drawing (image/PDF) -> architectural-drawing-parser
Structured BuildingData JSON -> ibc-building-codes (validation)
Validated data -> this recipe -> Building3D JSON / THREE.Group
Refinement and BIM -> Pascal Editor (separate tool)
Input
A BuildingData object needs at least stories.actual (number of floors) and units, an array of { name, areaSqft }. Keep occupancy, constructionType and height from the parser for the code check, but the geometry below does not use them.
Generation rules (defaults, all overridable)
- Floor-to-floor height: 9 ft (2.743 m). This is a design default, not a code value. Minimum ceiling heights come from the building code that applies to the project, so check it before using the model for anything beyond massing.
- Unit footprint: depth = sqrt(area x 1.5), width = area / depth (aspect 1:1.5). Use 1:2 or more for deep corridor-loaded units.
- Layout: units side by side along x with a 0.15 m party wall; a 5 ft (1.524 m) corridor along the back of the units.
- Units are boxes: rooms, walls, doors and windows are not generated. Take their positions from the drawing parser if you need them.
- Internal dimensions are metres: 1 ft = 0.3048 m, 1 sqft = 0.092903 sqm.
Reference implementation
Tested with [email protected] (npm install three, saved as an ES module such as massing.mjs):
import * as THREE from "three";
const FT = 0.3048;
const FLOOR_HEIGHT = 9 * FT; // 2.743 m floor to floor
const CORRIDOR = 5 * FT; // 1.524 m
const PARTY_WALL = 0.15; // m
const SQFT = 0.092903;
export function buildModel(spec) {
const levels = [];
let footprintWidth = 0, footprintDepth = 0;
for (let i = 0; i < spec.stories.actual; i++) {
let x = 0;
const units = spec.units.map((u) => {
const area = u.areaSqft * SQFT;
const depth = Math.sqrt(area * 1.5); // width:depth = 1:1.5
const width = area / depth;
const unit = { type: u.name, position: { x, y: i * FLOOR_HEIGHT, z: 0 }, width, depth, height: FLOOR_HEIGHT };
x += width + PARTY_WALL;
footprintDepth = Math.max(footprintDepth, depth);
return unit;
});
footprintWidth = x - PARTY_WALL;
levels.push({
elevation: i * FLOOR_HEIGHT, height: FLOOR_HEIGHT, units,
corridors: [{ x: 0, z: footprintDepth, width: footprintWidth, depth: CORRIDOR }],
});
}
return { levels, totalHeight: levels.length * FLOOR_HEIGHT, footprintWidth, footprintDepth };
}
export function toThree(model) {
const group = new THREE.Group();
const slab = new THREE.MeshStandardMaterial({ color: 0xcfcfcf });
const shell = new THREE.MeshStandardMaterial({ color: 0xe8e0d0, transparent: true, opacity: 0.6 });
for (const level of model.levels) {
for (const u of level.units) {
const m = new THREE.Mesh(new THREE.BoxGeometry(u.width, u.height, u.depth), shell);
m.position.set(u.position.x + u.width / 2, u.position.y + u.height / 2, u.position.z + u.depth / 2);
m.name = `${u.type}@${level.elevation.toFixed(2)}`;
group.add(m);
}
for (const c of level.corridors) {
const m = new THREE.Mesh(new THREE.BoxGeometry(c.width, level.height, c.depth), slab);
m.position.set(c.x + c.width / 2, level.elevation + level.height / 2, c.z + c.depth / 2);
group.add(m);
}
}
return group;
}
For the two units in Example 1 this gives a total height of 8.23 m and a footprint of 13.66 x 10.78 m.
Output formats
| Format | Use | How |
|---|---|---|
| Building3D JSON | custom renderers, your own converters | JSON.stringify(buildModel(spec)) |
THREE.Group |
web viewer, massing and spatial checks | toThree(model), add to a scene |
| GLB | sharing, Blender, game engines | in the browser, pass the group to GLTFExporter from three/examples/jsm/exporters/GLTFExporter.js |
| Pascal Editor | BIM-style editing | create levels and walls through Pascal's MCP tools (see Guidelines) |
IFC is not produced by this recipe. Building3D has no walls or openings, so an IFC export needs a separate converter written against your own schema.
Examples
Example 1: A 3-story R-2 apartment building
A developer parsed an IBC compliance sheet:
Install spec-to-3d in Claude Code & Claude Desktop
Sign up to install this skill
Create a free account to reveal the install command and save the skill to your library.
- Reveal the one-line install command
- Save skills to your synced library
- Get notified when skills update
Allowed tools
Tools this skill is permitted to call.
No restriction — this skill can use any tool.
Bundled files
FAQ
What does the spec-to-3d skill do?
Generate 3D building massing models from architectural specifications, parsed drawings, or building code data. Produces a plain Building3D JSON and a Three.js group, and hands the result to Pascal Editor for refinement. Use when: converting floor plans to 3D, building spec-driven 3D models, generating architectural visualizations from structured data.
How do I install the spec-to-3d skill?
Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.
Does the spec-to-3d skill run scripts?
No, this skill is instructions only (SKILL.md) with no executable scripts.
Related skills
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
by Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
by Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
by Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
by Anthropic