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 )
Configuration options for the opening Show IOpeningOptions properties
Unique identifier for the opening. Auto-generated if not provided.
Center point of the opening in 3D space
Width of the opening (X dimension)
Height of the opening (Y dimension)
Depth of the opening (Z dimension)
Color value (primarily used for outlines, since opening is transparent)
Properties
Unique identifier for the opening instance
Current configuration options
Width of the opening (settable property)
Height of the opening (settable property)
Depth of the opening (settable property)
Get the current dimensions as an object with width, height, and depth
Enable or disable the outline rendering (settable property)
Access the outline mesh if enabled
Methods
setConfig()
Update the opening configuration and regenerate geometry.
setConfig ( options : IOpeningOptions ): void
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.
discardGeometry()
Dispose of the Three.js geometry to free memory.
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.
Live Demo
Opening Demo Try creating openings in the browser
Cuboid Solid rectangular boxes
Polygon 2D shapes that can be extruded