Complete example
Here’s a complete working example that creates a rectangular room with a polyline for walls and a rectangle for the floor:Step-by-step breakdown
Initialize OpenPlans
First, create an instance of OpenPlans and set up the OpenGeometry kernel:
The
setupOpenGeometry() method is asynchronous and loads the WASM-based geometry kernel.Create the floor
Use a rectangle primitive to create the floor surface:The rectangle is positioned at the origin (0, 0, 0) with dimensions 5m × 4m.
Adding a 3D floor slab
For a more realistic floor, use a slab element instead of a flat rectangle:HTML setup
Here’s the complete HTML structure needed:Understanding coordinates
OpenPlans uses a right-handed coordinate system:- X-axis: Left (-) to Right (+)
- Y-axis: Down (-) to Up (+)
- Z-axis: Back (-) to Front (+)
Next: Doors and windows
Learn how to add doors and windows to your floor plan
Architectural elements guide
Detailed guide on working with doors, windows, slabs, and stairs
Common patterns
How do I change wall thickness?
How do I change wall thickness?
Walls created with polylines are infinitely thin lines. For thick walls, you need to create two parallel polylines or use custom shape builders.
Can I create L-shaped or complex rooms?
Can I create L-shaped or complex rooms?
Yes! Simply add more points to the polyline to create any shape:
How do I change colors dynamically?
How do I change colors dynamically?
Access the primitive’s properties and update them: