Skip to main content

Introduction

OpenPlans is built on a hierarchical architecture that organizes geometric entities into distinct categories. Understanding these core concepts will help you build effective 2D floor plans and architectural drawings.

Architecture Hierarchy

The library is organized into four main categories:

Design Philosophy

Property-Based Configuration

All entities in OpenPlans follow a consistent pattern:
interface EntityPattern {
  ogid?: string;              // Unique identifier
  propertySet: object;        // Configuration properties
  setOPConfig(): void;        // Update configuration
  getOPConfig(): object;      // Retrieve configuration
  setOPGeometry(): void;      // Update geometry
  setOPMaterial(): void;      // Update materials
}

Three.js Integration

All OpenPlans entities extend Three.js objects:
  • Primitives & Elements extend Three.js geometric classes
  • Shapes extend kernel geometric primitives
  • All entities can be added to Three.js scenes using scene.add()
OpenPlans automatically manages geometry updates when you modify properties through setters.

Common Patterns

Creating Entities

All entities follow a consistent creation pattern:
const line = openPlans.line({
  startPoint: [0, 0, 0],
  endPoint: [5, 0, 0],
  color: 0x000000
});

Modifying Properties

Use property setters to modify entities dynamically:
line.startPoint = [1, 0, 0];
line.lineColor = 0xFF0000;

Managing Lifecycle

OpenPlans tracks all created entities:
// Get all entities of a specific type
const allLines = openPlans.getEntitiesByType('LinePrimitive');

// Dispose an entity
openPlans.disposeElement(line.ogid);

Working with the Kernel

OpenPlans is built on top of the OpenGeometry kernel, which provides the underlying geometric computation engine. The kernel handles:
  • Geometric computations
  • BREP (Boundary Representation) data
  • Shape manipulation
  • Boolean operations
You need to initialize the OpenGeometry kernel before using advanced features:
await openPlans.setupOpenGeometry();

Next Steps

1

Learn about Primitives

Explore basic 2D geometric entities in the Primitives section
2

Understand Elements

Discover architectural components in the Elements section
3

Work with Shapes

Create 3D geometry in the Shapes section
4

Create Layouts

Compose technical drawings in the Layouts section

Code Organization

The source code follows this structure:
src/
├── primitives/     # 2D geometric primitives
├── elements/       # Architectural elements
├── shapes/         # 3D geometric shapes
├── layouts/        # Drawing layout tools
├── kernel/         # OpenGeometry kernel
└── index.ts        # Main OpenPlans class
Each entity is self-contained with its own:
  • Configuration interface
  • Property management
  • Geometry generation
  • Material handling
Last modified on March 7, 2026