Your First Floor Plan
This guide will walk you through creating a simple floor plan with walls, a door, and a window using OpenPlans.Make sure you’ve completed the installation before proceeding.
Basic Setup
You should now see a black line rendered in your viewport!
Building a Simple Room
Let’s create a complete room with walls, a door, and a window:main.js
Working with Shapes
Add 3D shapes to your scene for furniture or structural elements:Interactive Elements
OpenPlans elements can be modified after creation:Adding Labels and Dimensions
Add text labels using the built-in glyph system:Camera Controls
OpenPlans includes built-in camera controls powered bycamera-controls:
- Rotate: Left mouse button + drag
- Pan: Right mouse button + drag (or middle mouse)
- Zoom: Mouse wheel
Complete Example
Here’s a complete working example you can copy and run:Understanding the Coordinate System
OpenPlans uses a 3D coordinate system:- X-axis: Horizontal (left-right)
- Y-axis: Vertical (up-down, height)
- Z-axis: Horizontal (forward-backward)
Most 2D floor plan elements are created on the XZ plane (Y = 0). The Y coordinate is used for elevation and height.
Common Patterns
Creating from Configuration
All OpenPlans elements support configuration objects for programmatic creation:Rendering Loop Integration
Integrate with your own render loop:Next Steps
Primitives
Learn about all available primitives
Elements
Explore architectural elements
Shapes
Work with 3D shapes
Advanced Guides
Generate floor plans from JSON
Troubleshooting
Nothing renders on screen
Nothing renders on screen
Make sure you:
- Called
await openPlans.setupOpenGeometry()before creating elements - Set the container element’s width and height (should be visible)
- Check the browser console for errors
Elements appear very small or large
Elements appear very small or large
OpenPlans uses meters as the default unit. Adjust your dimensions:
- Typical door: 1-1.2m wide
- Room: 3-6m wide
- Table height: 0.75m
Camera controls not working
Camera controls not working
Ensure
camera-controls is installed as a peer dependency:TypeScript errors
TypeScript errors
Install type definitions: