Skip to main content

BaseDoor

The BaseDoor class represents a door element in OpenPlans. It extends the Opening class and provides functionality for creating customizable doors with frames, panels, and rotation controls.

Constructor

new BaseDoor(baseDoorConfig?: OPDoor)
baseDoorConfig
OPDoor
Optional configuration object for the door. If not provided, default values will be used.

Properties

ogType
string
The element type identifier. Always set to ElementType.DOOR.
propertySet
OPDoor
The current configuration of the door including dimensions, colors, and other properties.
subElements
Map<SubElementType, THREE.Object3D>
Map containing sub-elements of the door (frame, panel, opening, finish).
selected
boolean
Indicates whether the door is currently selected.
edit
boolean
Indicates whether the door is in edit mode.

Getters & Setters

labelName
string
The display name of the door element.
doorPosition
[number, number, number]
The 3D position of the door in the scene as [x, y, z].
doorLength
number
The width of the door opening.
doorThickness
number
The thickness of the door panel.
doorHeight
number
The height of the door panel.
doorRotation
number
The rotation value for the door panel (between 1 and 2, representing the opening angle).
doorQuadrant
number
The quadrant in which the door opens (1-4).

Methods

setOPConfig

setOPConfig(config: OPDoor): void
Updates the door configuration and rebuilds the geometry.
config
OPDoor
New configuration object for the door.

getOPConfig

getOPConfig(): OPDoor
Returns the current door configuration. Returns: OPDoor - The current door configuration object.

setOPGeometry

setOPGeometry(): void
Rebuilds the door geometry based on the current configuration. This creates the frame and door panel.

showProfileView

showProfileView(status: boolean): void
Toggles the profile view mode for technical drawings.
status
boolean
True to show profile view (outline only), false to show normal view.

OPDoor

The configuration interface for door elements.

Properties

ogid
string
Unique identifier for the door element.
labelName
string
required
Display name for the door.
type
ElementType.DOOR
required
Element type identifier.
dimensions
object
required
Dimensions configuration for the door.
doorPosition
[number, number, number]
required
3D position of the door as [x, y, z].
doorType
DoorType
required
Type of door (WOOD, GLASS, DOUBLEDOOR, SLIDING, FOLDING, DOUBLEACTION, OTHER).
doorHeight
number
required
Height of the door panel in meters.
doorThickness
number
required
Thickness of the door panel in meters.
frameThickness
number
required
Thickness of the door frame in meters.
frameColor
number
required
Hexadecimal color value for the door frame (e.g., 0x000000).
doorColor
number
required
Hexadecimal color value for the door panel (e.g., 0x8B4513).
doorRotation
number
required
Rotation value for the door opening (1-2, where 1 is fully open, 2 is closed).
doorQuadrant
number
required
Quadrant in which the door opens (1-4).
coordinates
Array<[number, number, number]>
required
Array of 3D coordinate points defining the door geometry.

DoorType

Enum defining available door types:
  • WOOD - Wooden door
  • GLASS - Glass door
  • DOUBLEDOOR - Double door
  • SLIDING - Sliding door
  • FOLDING - Folding door
  • DOUBLEACTION - Double action door
  • OTHER - Other door types

Example

import { BaseDoor, DoorType, ElementType } from 'openplans';

// Create a door with default configuration
const door = new BaseDoor();

// Create a door with custom configuration
const customDoor = new BaseDoor({
  labelName: 'Main Entrance',
  type: ElementType.DOOR,
  dimensions: {
    start: { x: -0.5, y: 0, z: 0 },
    end: { x: 0.5, y: 0, z: 0 },
    length: 1,
  },
  doorPosition: [5, 0, 0],
  doorType: DoorType.WOOD,
  doorHeight: 2.1,
  doorThickness: 0.05,
  frameThickness: 0.15,
  doorColor: 0x8B4513,
  frameColor: 0x000000,
  doorRotation: 1.5,
  doorQuadrant: 1,
  coordinates: [],
});

// Update door properties
door.doorHeight = 2.4;
door.doorColor = 0x654321;
door.doorQuadrant = 2;

// Get current configuration
const config = door.getOPConfig();

// Show profile view for technical drawings
door.showProfileView(true);
Last modified on March 7, 2026