Skip to main content

Overview

The Opening class creates transparent cuboid volumes that represent openings in architectural models, such as doors, windows, or other voids. Openings are rendered with zero opacity but maintain outlines for visualization.

Constructor

new Opening(options?: IOpeningOptions)
options
IOpeningOptions
Configuration options for the opening

Properties

ogid
string
Unique identifier for the opening instance
options
IOpeningOptions
Current configuration options
width
number
Width of the opening (settable property)
height
number
Height of the opening (settable property)
depth
number
Depth of the opening (settable property)
dimensions
object
Get the current dimensions as an object with width, height, and depth
outline
boolean
Enable or disable the outline rendering (settable property)
outlineMesh
THREE.Line | null
Access the outline mesh if enabled

Methods

setConfig()

Update the opening configuration and regenerate geometry.
setConfig(options: IOpeningOptions): void
options
IOpeningOptions
required
New configuration options to apply

getBrepData()

Get the boundary representation (BREP) data for the opening.
getBrepData(): object | null
Returns the BREP structure as a parsed JSON object, or null if not available.

generateGeometry()

Regenerate the Three.js geometry from the kernel.
generateGeometry(): void

discardGeometry()

Dispose of the Three.js geometry to free memory.
discardGeometry(): void

Example Usage

Basic Window Opening

import { Opening } from '@opengeometry/kernel-three';
import { Vector3 } from 'opengeometry';
import * as THREE from 'three';

// Create a window opening
const windowOpening = new Opening({
  center: new Vector3(0, 1.5, 0),
  width: 1.2,
  height: 1.5,
  depth: 0.3,
  color: 0x666666
});

// Enable outline to visualize the opening
windowOpening.outline = true;

// Add to scene
scene.add(windowOpening);

Door Opening

// Create a door opening
const doorOpening = new Opening({
  center: new Vector3(2, 1, 0),
  width: 0.9,
  height: 2.1,
  depth: 0.2,
  color: 0x333333
});

doorOpening.outline = true;
scene.add(doorOpening);

Dynamic Resizing

const opening = new Opening({
  center: new Vector3(0, 1, 0),
  width: 1.0,
  height: 2.0,
  depth: 0.3,
  color: 0x888888
});

// Resize dynamically
opening.width = 1.5;
opening.height = 2.5;
opening.depth = 0.4;

// Access current dimensions
console.log(opening.dimensions);
// { width: 1.5, height: 2.5, depth: 0.4 }

Using BREP Data

const opening = new Opening({
  center: new Vector3(0, 1, 0),
  width: 1.0,
  height: 2.0,
  depth: 0.3,
  color: 0x999999
});

// Get boundary representation
const brepData = opening.getBrepData();
if (brepData) {
  console.log('Opening BREP:', brepData);
  // Use BREP data for boolean operations or analysis
}

Material Properties

The Opening uses a MeshStandardMaterial with these special properties:
  • transparent: true - Enables transparency
  • opacity: 0 - Fully transparent (invisible volume)
  • depthWrite: false - Allows seeing through to elements behind
This makes openings invisible while maintaining their volumetric representation for computational purposes.

Use Cases

Architectural Modeling

Create window and door openings in walls

Space Planning

Define void spaces in floor plans

Boolean Operations

Use as cutting volumes for wall penetrations

Visualization

Mark areas of interest with outlined volumes

Notes

Openings are rendered with zero opacity but can have visible outlines. Enable the outline property to visualize the opening boundaries.
Opening geometry uses depthWrite: false which means it won’t write to the depth buffer. This is intentional to allow seeing through openings, but be aware of this when compositing with other transparent objects.
Last modified on March 7, 2026