Class: Space

BIM. Space

Defines an enclosed volume of space.

Spaces are a key part of the building element hierarchy. Their role is to compartmentalise the building or structure into a series of zones or volumes with relatively homogeneous internal conditions. Thus, even though you may have a completely open floor plan, there may be different areas that have higher or lower occupancy, are subject to significantly different solar gain conditions, have localised equipment with different levels of heat output, have different acoustic requirements or which may be subdivided by moveable partitions. Any of these may require you to divide the area into different spaces with walls, partitions or voids between them.

Spaces within Spaces

Spaces can belong directly to a BIM.Level or to another space. To be compatible with external thermal and energy analysis tools, as well as most other BIM software, only spaces that belong to a level can host internal spaces. Thus, you cannot have a space inside a space inside another space. The software will work this out automatically and either add the space to another space as you draw it or issue the appropriate warnings.

InnerShell and Shell

Spaces maintain two different shells. First, the innerShell stores all of the interior surfaces of the space that are directly exposed to its internal volume. This includes all the internal walls surfaces as well as the upper floor face and lower ceiling faces. The resulting shape represents the analytical model of the space that is used for spatial adjacency and thermal/energy analysis. It extends from the reference line of its floor construction up to the bottom surface of the ceiling plane and is used to define the extents of the internal air volume. It is also the shape that is highlighted when you interactively select a space.

Secondly, the standard shell common to most elements is used to store all of the other incidental surfaces that make up the space. These include the inside of any wall surfaces below the top of the space but above the ceiling, as well the inside surfaces of any holes or voids in slabs or ceilings that extend to other levels.


new Space( [config] [, typeName])

Creates a new bounded volume on a level in a structure.

Parameters:
Name Type Argument Description
config object <optional>

An optional configuration object.

Properties of config:
Name Type Argument Description
name string <optional>

A human-readable name for this element.

uuid string <optional>

A universally unique identifier of this element.

visible boolean <optional>

Whether or not the entity is visible in the model.

path BIM.Path <optional>

A path for this space geometry to follow.

shell PD.Shell <optional>

The shell object to use when generating geometry.

level BIM.Level <optional>

The building/structure level this space belongs to.

contours Array <optional>

An array to be used to store linear contours.

lineColor THREE.Color <optional>

A color to use when rendering the line.

fillColor THREE.Color <optional>

A color to use when rendering a polygon surface.

showOutline boolean <optional>

A flag indicating whether or not to render outlines, defaults to true.

showSurface boolean <optional>

A flag indicating whether or not to render surfaces, defaults to true.

extents THREE.Box3 <optional>

An optional box instance to store the calculated extents.

plane THREE.Plane <optional>

An optional plane to store the calculated plane equation.

normal THREE.Vector3 <optional>

An optional vector to store the calculated normal.

center THREE.Vector3 <optional>

An optional vector to store the calculated center point.

isPlanar boolean <optional>

Forces all points in the polyline/polygon to lie on its plane, defaults to false.

isRect boolean <optional>

Whether or not a polygon should be rectilinear when possible, defaults to false.

typeName string <optional>

An additional parameter typically used by subclasses to set an element type without modifying the config object so it can be used when generating the default element name.

Author:
  • drajmarsh

Extends

Members


:number

_height

The ceiling height of the space in model units.

Type
  • number
Overrides:
  • BIM.Element.Composite#_height

:Array

adjacencyList

A list of inter-spatial adjacencies.

Type
  • Array

:Map

attributes

Stores any arbitrary attributes associated with this entity.

This is a simple key/value map that can be used to store any additional information about the entity that may be required by the application such as reference ids, material types, fire ratings, costings, etc.

Type
  • Map
Inherited From:
Overrides:

:BIM.Space|null

boundedBy

A host space that entirely bounds this space, if any.

A space cannot be bounded by another space and contain bounded spaces of its own. If you try to do this, the framework will either display an overlapping space warning or work out a way to best accommodate the situation.

Type

:number

boundedSpaceFloorDepth

The depth of the slab added to the bottom of bounded spaces above the floor.

This value only impacts bounded spaces whose base floor level is above the base floor level of the host space,which means that they are floating in the air. In these cases, a slab depth is added to the bottom of such spaces to represent the structure required to support the space above. The depth of this slab defaults to 6" or 150mm.

Type
  • number

:Array

boundedSpaces

A list of spaces that are entirely bounded by this space.

Whilst not typical, it is possible for one of more spaces to be completely bounded by another, which then have to be considered differently to unbounded spaces as they may not actually share any walls with the bounding space. Thus, bounded spaces lie entirely within another space and must therefore be subtracted from the bounding space's internal area and have shared walls created in order to display correctly, which is why they need to be stored in this list.

This list is updated when checking for spatial overlaps.

Type
  • Array

:PD.BRep|null

brep

An optional boundary representation defining the element shape.

Whilst some elements store all of their geometry in their shell, this is not always the most effective and efficient approach for all element types. For example, railings, fences and stairs have complex post, rail, infill and tread geometry between each path segment, which may add up to many thousands of surfaces. This would make interactive selection and collision detection more computationally expensive if all of that geometry had to be tested each time. Moreover, when selecting a railing, you would need to click exactly on one of its surfaces, which may not be easy if the post, rail and slat sizes are small compared to their spans.

To address this, such element types can store complex geometry in a PD.BRep instance, which uses less memory than a shell and can store curved surfaces as well as planar ones. To make selection easier, these elements can also store a simplified shell representation of their geometry, which is used for interactive selection and collision detection. This shell is typically composed of a few polygons that cover the main spans of the element, such as the vertical spans between each post in a railing, or the vertical and horizontal planes of a chair's seat and backrest. The rest of the detailed geometry is then stored in this brep.

Type
Inherited From:
Overrides:

:number

buildRef

A reference value used exclusively by the host level of the element.

This value is used by the level that hosts the element, or the level that hosts its parent element if it has one. It is used internally to determine if and when the level needs to update various parts of its own managed geometries.

Type
  • number
Inherited From:
Overrides:

:boolean

canBelongToSpace <readonly>

Whether or not this element can belong to a space.

When true, the element can be added to a BIM.Space by interactively dragging it into the volume of the space. When false, the element can only be added to a space programmatically, typically belonging only to a level.

For most element this property is true, but for elements such as roofs and footings, where they are typically dragged around above, below and through existing spaces, this property should be false.

addElement() method on the space instance.

Type
  • boolean
Inherited From:
Overrides:

:PD.Polygon

ceiling

The ceiling polygon of the space.

The shape of this polygon is effectively the leftover area of ceiling within the space, after subtracting bounded spaces and any ceiling elements that have been manually added, that needs to be filled with an auto-generated ceiling.

This is a reference to one of the polygons within the innerShell.

    +  -  -  -  -  -  -  -  -  +
    . +----------+ - - - - - + .
    . |          |  dropped  . .
    . |          |           . .
    . |          |  ceiling  . .
    . |          + - - - - - + .
    . |          | +  -  -  -  +
    . +----------+ .
    +  -  -  -  -  +
Type

:number

ceilingAngle

The pitch angle of the ceiling, defaults to 0deg (flat and horizontal).

Type
  • number

:PD.Clipper.Shape

ceilingClipShape

The 2D ClipperLib shape used to generate the ceiling of the space.

This is used to cache and reuse 2D clip points between rebuilds.

Type

:number

ceilingHeight

The internal ceiling height of the space.

The role of this getter is to detect fractional height values and convert them into absolute model coordinates. Thus, this value will always be in model coordinates, even if the underlying ceiling height parameter is given as a fractional value.

Type
  • number

:number

ceilingLevel <readonly>

The height of the ceiling above the parent level's base.

Type
  • number

:string

className <readonly>

The name of the subclass for this object instance.

This name must match the name of this class within the PD.Registry. Thus, the base implementation simply references this.constructor.getClassName() to ensure that this is always the case even for subclasses. As a result, there is rarely any need to override this method.

This property is used when copying, storing and exporting data for subclass instances to ensure that they are recreated as instances of the right class.

Type
  • string
Inherited From:
Overrides:

:string

displayName <readonly>

The name to display for this class within the user interface.

Type
  • string
Inherited From:
Overrides:

:Array

elementList

The list of child elements contained by the composite element.

Type
  • Array
Inherited From:
Overrides:

:BIM.ELEMENT

elementType

The BIM element type for the element.

Whilst the entity type is very specific regarding the actual class of an element, the element type is a broader categorisation intended primarily for compatibility with gbXML element types and the various analysis tools that use them. However, it can also be a very useful internal filter when searching for elements of a particular type.

Type
Inherited From:
Overrides:

:BIM.ENTITY

entityType <readonly>

Defines the type of BIM entity this class represents.

This value is used by the PD.Registry for grouping elements and matching components. The base implementation simply references this.constructor.getEntityType() so that only a static method needs to be added to subclasses.

Type
Inherited From:
Overrides:

:THREE.Box3

extents

The 3D extents of the element as a bounding box.

Type
  • THREE.Box3
Inherited From:
Overrides:

:PD.Polygon

floor

Stores the floor area of the space with any holes, raised/lowered slabs, and bounded spaces removed.

The shape of this polygon is effectively the leftover area of floor within the space, after subtracting any floor elements that have been manually added, that needs to be filled with an auto-generated floor.

This is a reference to one of the polygons within the innerShell.

    +  -  -  -  -  -  -  -  -  +
    . +----------+ - - - - - + .
    . |  +--+    |   raised  . .
    . |  |  |    |           . .
    . |  |  |    |   floor   . .
    . |  +--+    + - - - - - + .
    . |          | +  -  -  -  +
    . +----------+ .
    +  -  -  -  -  +
Type

:number

floorArea

The useable internal floor area to the internal wall boundaries, in square metres (m2).

Type
  • number

:PD.Clipper.Shape

floorClipShape

The 2D ClipperLib shape used to generate the internal floor of the space.

This is used to cache and reuse 2D clip points between rebuilds.

Type

:number

floorLevel <readonly>

The height of the floor above the parent level's base.

Type
  • number

:PD.Polygon

footprint

Stores the inner boundary of the space with any holes removed.

This means that the first contour in the footprint polygon always stores the internal plan shape of the space as a whole. Subsequent contours represent holes within the floor slab for stairways, lifts or atria.

Importantly, the shape of the hole in the footprint is the actual shape of the hole in the 3D model. This shape may or may not be coincident with the path lines that define the hole, depending on the assigned floor material and the projection value of each junction in the path of the void.

This value is always a reference to one of the polygons within the innerShell.

    +  -  -  -  -  -  -  -  -  +
    . +----------------------+ .
    . |  +--+                | .
    . |  |  |                | .
    . |  |  |                | .
    . |  +--+    +-----------+ .
    . |          | +  -  -  -  +
    . +----------+ .
    +  -  -  -  -  +
Type

:PD.Clipper.Shape

footprintClipShape

The 2D ClipperLib shape used to generate the internal BIM.Space#footprint of the space.

This is used to cache and reuse 2D clip points between rebuilds.

Type

:boolean

hasBoundedSpaces <readonly>

Whether or not this space contains internal bounded spaces.

Whilst not typical, it is possible for one of more spaces to be completely bounded by another, which then have to be considered differently to unbounded spaces as they may not actually share any walls with the bounding space. Thus, bounded spaces may lie entirely within another space and must therefore be subtracted from the bounding space's internal area.

Bounded spaces are determined when checking for spatial overlaps.

Type
  • boolean

:boolean

hasChanged

Whether or not the entity has recently changed and needs to update.

This property is typically set by the user interface or other parts of the framework when the entity's properties have changed and any visual representations need to be updated.

Type
  • boolean
Inherited From:
Overrides:

:number

height

The height of the element in model units, if applicable.

Type
  • number
Inherited From:
Overrides:

:number

id

A unique integer identifier for fast discovery and/or equality checking.

This identifier is unique within the current project data and is primarily intended to facilitate fast lookup and equality checking. It is assigned automatically when the element is created and should not change. It is much simpler than the uuid property, being a numeric integer rather than a long string of characters, and is the preferred way of comparing elements to see if they are the same.

Type
  • number
Inherited From:
Overrides:

:Array.<Array>

innerClipPath

Stores the internal space boundary as a ClipperLib path.

This path stores just the internal boundary shape of the space, offset from the defining path by the inner wall thickness.

It differs from the BIM.Space#footprintClipShape in that it does not include any internal holes, slab elements or bounded spaces. It is used by the host level to subtract the internal boundary of the space from the level footprint.

    +  -  -  -  -  -  -  -  -  +
      +----------------------+
    : |                      | :
      |                      |
    : |                      | :
      |          +-----------+
    : |          | +  -  -  -  +
      +----------+ |
    +  -  -  -  -  +
Type
  • Array.<Array>

:PD.Shell

innerShell

Stores the internal 3D boundary of the space as polygons.

Type

:boolean

isCompositeElement <readonly>

A flag identifying this object as a composite element.

Type
  • boolean
Inherited From:
Overrides:

:boolean

isElement <readonly>

A flag identifying this object as a BIM element.

Type
  • boolean
Inherited From:
Overrides:

:boolean

isEntity <readonly>

A flag identifying this object as an entity.

Type
  • boolean
Inherited From:
Overrides:

:boolean

isSpace <readonly>

A flag identifying this object as a space.

Type
  • boolean

:boolean

isSurfaceMounted <readonly>

Whether or not this element should be mounted on a surface.

When true, the element will try to attach itself to the nearest vertical surface within the model rather than being free-standing. This is mainly used when interactively dragging and dropping elements into the model.

Type
  • boolean
Inherited From:
Overrides:

:boolean

isWallElement <readonly>

A flag identifying this object as a wall-like building element.

Type
  • boolean

:PD.Point

label

The optimum plan-view position for a label within the shape.

Type

:BIM.Renderable|BIM.Level|null

level <readonly>

The level within a building/structure that this element belongs to.

To add an element to a level, use the BIM.Level#addElement method on the level you wish to add the element to.

Type
Inherited From:
Overrides:

:string

name

A human-readable name for this item instance.

Type
  • string
Inherited From:
Overrides:

:boolean

onlyUsesOwnMesh <readonly>

Whether or not this element exclusively renders to its own mesh and does not use any level meshes.

This value will be false for the majority of building and drawing elements as they use the primary level meshes to render themselves and will likely react to any changes in the built form. However, some analytical element classes such as BIM.SunPath3D and BIM.IsoVist use entirely their own meshes so can be updated completely independently of the rest of the building model.

Thus, a true value here allows elements that only use their own dedicated mesh to regenerate themselves without triggering a full level-wide model regeneration when their parameters are edited. This happens in the element's BIM.Element#updateDynamicParameters method which checks this property to determine whether to just call the PD.GlobalActions.updateSelectionMeshes method instead of returning true and rebuilding the entire level.

Type
  • boolean
Inherited From:
Overrides:

:boolean

onlyUsesSiteMesh <readonly>

Whether or not this element exclusively renders to its level site mesh.

This value will be false for the majority of building and drawing elements as they use the primary level meshes to render themselves and will likely react to any changes in the built form. However, some site elements such as plants, rocks, terrains and pots only use the on-demand site mesh, which can be updated completely independently of the rest of the building model.

Thus, a true value here allows elements that only use their level's site mesh to regenerate themselves without triggering a full level-wide model regeneration when their parameters are edited. This happens in the element's BIM.Element#updateDynamicParameters method which checks this property to determine whether to just call the BIM.Level#rebuildSiteMesh method instead of returning true and rebuilding the entire level.

Type
  • boolean
Inherited From:
Overrides:

:BIM.Element|null

parent <readonly>

The container element that this element belongs to.

To add an element to a container element, use the addElement() method on the container you wish to add the element to.

Type
Inherited From:
Overrides:

:boolean

partialMezzanineSlab

Whether to just cover the bounded area under the ceiling rather than the whole lot.

Type
  • boolean

:number

pathArea

The bounded area of the space footprint, in square metres (m2).

Type
  • number

:number

segmentIndex

The index of the path segment that determines the ceiling pitch.

The pitch of the ceiling must start somewhere, and this index defines which wall the ceiling springs from. It is also the wal that the ceiling height is taken from.

Type
  • number

:boolean

selectSegmentsByShell <readonly>

Whether to select path segments in 3D using each junction's shell.

Type
  • boolean
Inherited From:
Overrides:

:boolean

selected

Whether or not the entity is in the current selection set.

This property is typically set by the user interface when the user selects or deselects entities within the model view. The PD.SelectionManager uses this property to keep track of which entities are currently selected.

Type
  • boolean
Inherited From:
Overrides:

:PD.LocalCoordinates

sharedLocalCoordinates <readonly>

A shared local coordinate system to use for generating geometry.

This coordinate system is shared with all elements and is intended only for temporary use when generating each element's geometry. Thus, it should be considered highly volatile and only safely used within the BIM.Element#rebuild method of each element. You must initialise it on every use and can then pass it around to other functions/methods called from within the initialising method. However, you should assume that it will be immediately used again by another element as soon as your rebuild method returns, so it will not hold or persist any particular value beyond that.

Type
Inherited From:
Overrides:

:PD.Shell|null

shell

Stores the 3D shell geometry for this element.

Shell geometry is typically used to represent the base shape of an element and is the default geometry for interactive selection testing and collision detection. Some elements, such as walls, slabs and columns, have relatively simple geometry so use their shell for both selection and visual representation. Other elements, such as railings, use their shell to store single vertical selection planes between each corner post, but store the more detailed post, rail and infill geometry in their brep property.

A shell is composed of one or more PD.Polygon instances, which are bounded planar surfaces that each store their own boundary contours, plane equations, center position and 3D extents, as well as fill and line colours. This makes them ideal for fast ray intersection and adjacency calculations, but means they use more memory than an equivalent PD.BRep.Face instance. Thus, rather than store thousands of post, rail and infill surfaces as shell polygons, the railings element stores all that in its PD.BRep, but just a few shell polygons to cover each span. As well as being much faster, this has the additional benefit of allowing selection by simply clicking anywhere on the span, rather than having to click directly on an actual post, rail or slat surface.

What Goes in a Shell

It is not always obvious what should go in the shell and what in the brep, so it will always be up to the element developer to decide. However, as an illustration, consider something like a wooden chair element. All it needs for selection and collision detection is a horizontal polygon for the seat and an inclined polygon for the backrest. This provides intuitive targets for user selection and sufficient geometry for determining if an avatar has bumped into it. It also allows the avatar to sit and lean against the backrest without falling through. All of the detailed leg, armrest and horizontal/vertical backrest supports can then be stored in the brep, with just the two planes stored in the shell.

A couch or sofa element on the other hand, may be a little different. It will likely need boxes for the spans of both the seat and backrest, but also for each armrest. For a simple low-poly visual representation this could be just enough, so it could all be stored in the shell and nothing in the brep. However, once you start adding curved padding, cushions and other embellishments, the shell representation could likely remain just boxes, but the more complex and curved geometry would likely be best added to the brep.

Type
Inherited From:
Overrides:

:BIM.Construction|null

slabConstruction

The slab construction to use, if assigned.

This is the material used to define the nature of the slab that supports the space above.

Type

:BIM.Space|null

space <readonly>

The space that this element belongs to.

To add an element to a space, use the BIM.Space#addElement method on the space you wish to add the element to.

Type
Inherited From:
Overrides:

:BIM.Structure|null

structure <readonly>

The building/structure that this element belongs to.

This is dynamically extracted from either the level or the space that the element belongs to within the model.

Type
Inherited From:
Overrides:

:number

subType

Stores a sub-type enumerator for this element.

Sub-types are specific to each entity type and are primarily used to assign an appropriate type component. Each entity type for which sub-types are defined will have its own set of sub-type enumerators, typically with the same name as the entity type but in all-caps.

For example, a BIM.Chair entity uses sub-types given by the BIM.CHAIR enumerator, and maps to various BIM.Chairs classes as type components. These sub-types include office chairs, dining chairs, lounge chairs, benches, stools, etc.,

Type
  • number
Inherited From:
Overrides:

:BIM.SYSTEM

systems

The building system(s) this element contributes to or draws from.

Systems essentially categorise elements based on the purpose they serve. The can be holding the building up, delivering water, clearing waste, conducting electricity or managing operations. They can also be used to differentiate between different domains of interest, professions or trades. For example, a wall is part of the structural system, a sink is part of the plumbing system, a light fitting is part of the electrical system, and a radiator is part of the HVAC system.

Elements can belong to multiple systems, for example a heating boiler is part of both the plumbing and HVAC systems. This property is therefore a bitwise OR combination of the different BIM.SYSTEM enumerators.

Type
Inherited From:
Overrides:

:boolean

trackSpaceBoundary

Whether or not to check for path alignment relationships with parent space path, defaults to false.

When true and belonging to a parent space, the element checks each of its path junctions to see if they are coincident with the host space boundary path junctions or lie along any of its boundary segments. If a coincident or inline relationship is found, a BIM.Relation is created and stored on both the element and space junctions. This allows the space to update each element when it is moved and the user to remove the link by simply moving the element junction away from the space boundary.

This value is primarily intended for use by elements such as cupboards, switches, sockets, radiators, wall lights and other fixtures that are typically mounted on or against walls and need to track/update their position relative to the space boundary as it changes.

Type
  • boolean
Inherited From:
Overrides:

:BIM.Component|null

typeComponent

A type component reference.

This is typically determined by the subType property and assigned when a new instance is created.

Different entity types use type components differently, and some not at all. However, the referenced component typically defines a sub-type for the entity and either influences or entirely dictates its overall parametric form or shape. For example, a wall can reference a BIM.Walls type component, which defines its thickness, surface properties and material layers via a BIM.Construction. A chair references a BIM.Chairs type component to actually generate the entire geometry of each chair instance as laid out by its path junctions.

Type
Inherited From:
Overrides:

:string

typeDisplayName <readonly>

Retrieves the display name of this element or its assigned type component.

Type
  • string
Inherited From:
Overrides:

:string

uuid

A universally unique identifier for the item instance.

Type
  • string
Inherited From:
Overrides:

:boolean

visible

Whether or not the entity is visible within the model.

The framework tries its best to avoid rendering invisible entities, but depending on the type of entity and how it is represented, this may not always be possible. For example, not rendering a chair is

Type
  • boolean
Inherited From:
Overrides:

:BIM.Construction|null

wallConstruction

The wall construction to use for external parts of its surface, if assigned.

When assigned, this represents the default external wall construction for all walls that bound the space. Each junction in the defining path can be assigned a different external wall material where the material changes, but this will be the default if the junction does not have its own external wall construction.

Type

:BIM.Construction|null

wallConstructionInternal

The wall construction to use for adjacent parts of the surface, if assigned.

When assigned, this represents the default internal wall construction for all walls that bound the space. Each junction in the defining path can be assigned a different internal wall material where the material changes, but this will be the default if the junction does not have its internal own wall construction.

Type

:boolean

wasRebuilt

Stores whether or not the element's geometry has recently been rebuilt, which may affect the host level's geometry.

This value must be set to true whenever the element's geometry changes and is used by the host level to determine if it needs to update level geometry as a result. The host level itself will reset this value to false once it has processed the change, so no other method or action anywhere should ever set this value to anything other than true.

NOTE: It is the responsibility of the element's own update() method to set this value to true when calling its rebuild() method. The reason this is not left to the rebuild() method is that virtually every element subclass requires its own specific rebuild() method to generate its geometry, making this one of the most overridden methods in the entire framework. Thus, to avoid the risk of having custom class developers forget to set this flag in every single overridden rebuild() method, it is left to the update() method which is overridden far less often and is also responsible for managing other element state such as the hasChanged flag.

Type
  • boolean
Inherited From:
Overrides:

:object

icon <static>

The icon associated with this class in the PD.Registry.

See PD.Base.icon for more information on this object format.

Type
  • object

Methods


_generateInnerWallSurfaces(groupData)

Creates the internal wall surfaces of the space.

This method checks for bounded spaces inside this space and only generates wall surfaces that are internally exposed and not obscured by internal spaces that abut the walls.

The areas of wall below the ceiling are added to the innerShell whilst any areas above the ceiling are added to the shell.

Parameters:
Name Type Description
groupData object

The group object to store data in.


addAperture(aperture, index)

Add an aperture to the given boundary wall segment.

The index refers to the ordinal number of a junction in the outer boundary of the space.

Parameters:
Name Type Description
aperture BIM.Aperture

The aperture to add.

index number

The ordinal index of the boundary wall segment in which to insert it.

Returns:

Returns the junction it was added to, or null if not added.

Type
BIM.Junction

addElement(element [, index])

Add an internal building element to this space.

Parameters:
Name Type Argument Description
element BIM.Element

The building element to add.

index number <optional>

An optional ordinal index at which to insert it.

Overrides:
Returns:

Returns true if the element was successfully added, otherwise false.

Type
boolean

addExternalBoundedSpaceAperturesToList(junctionList)

Adds external apertures from internal bounded to the level boundary.

This method adds any apertures that were not inserted in any internal walls to the given list to check if they should be added to the external boundary of the level.

   +--------------------------+ - - - +------+ - - - - +-------+
   .                          | @ @ @ |      | @ @ @ @ |       |
   .    +  -  -  -  -  -  + +-+ - - - +-+ +--+ - - - - +--+    |
   .    .                 | |           | |   external    +----+
   .    .                 | |           | |               . @@ .
   .    .                 | |           | |               . @@ .
   .    .                 | +--+    +---+ |               . @@ .
   .    .                 +----+    +---+ |   internal    +----+
   .    .                               | +---+      +----+    |
   .    .                               +-----+      +----+    |
   .    .                                                 .    |
   .    .     +----+     +----+                           .    |
   .    .     | +--+     +--+ |                           .    |
   .    .     | |           | |                           .    |
   .    .     | +-----------+ |                           .    |
   .    .     +---------------+                           .    |
   .    .                                                 .    |
   .    +  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  - +    |
   .                                                           |
   +  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  +
Parameters:
Name Type Description
junctionList Array.<BIM.Junction>

A list of level boundary facets to check.


addJunction(junction [, contour_index] [, ordinal_index])

Adds a new junction at the given index within the given contour.

Parameters:
Name Type Argument Description
junction BIM.Junction

The junction to be inserted.

contour_index number <optional>

The ordinal index of the path contour to insert the junction in, defaults to 0.

ordinal_index number <optional>

The ordinal index of the junction within the specified contour, defaults to the end.

Inherited From:
Overrides:
Throws:

Throws an exception if the element has no path.

Type
Error
Returns:

Returns true if a new vertex was successfully inserted.

Type
boolean

checkJunctionRelationships(space, junctions)

Checks the element for junction relationships.

This method is only called on elements when their BIM.Element#trackSpaceBoundary property is true.

Parameters:
Name Type Description
space BIM.Space

The parent space of the element.

junctions BIM.Junction

The junction to check for relationships for.

Inherited From:
Overrides:

checkToSelectElementByRay(selection)

Checks if the given ray intersects this element, but don't actually select it yet.

Parameters:
Name Type Description
selection PD.Selection

The interactive selection accumulator.

Inherited From:
Overrides:
Returns:

Returns true if the element should/would be selected, otherwise false.

Type
boolean

checkToUseHorizontalCeiling(plane)

Checks if the ceiling tilt angle is close to zero or the given plane is too close to vertical.

If either of these conditions are true, any calculations involving the ceiling can use whatever shortcuts or optimisations are appropriate to a horizontal ceiling.

Parameters:
Name Type Description
plane THREE.Plane

The ceiling plane to check, typically this.ceiling.plane.

Returns:

Returns true if calculation/process should use a horizontal ceiling, otherwise false.

Type
boolean

clear()

Clears everything from this space so it can be reused.

Overrides:
Returns:

Returns this space to support method chaining.

Type
BIM.Space

clearApertures()

Removes all the apertures from this space.

Returns:

Returns this space to support method chaining.

Type
BIM.Space

clone()

Creates a copy of this instance with different name and uuid.

Inherited From:
Overrides:
Returns:

Returns a new instance with copied values.

Type
PD.Base | null

closestPointOnAperture(snapper, ray, point [, selected_aperture])

Checks for points in the element path near the 3D ray.

Parameters:
Name Type Argument Default Description
snapper PD.Snapper

The snap helper object.

ray THREE.Ray

The ray through the 3D cursor.

point THREE.Vector3

The point to find the closest snap to.

selected_aperture BIM.Aperture <optional>
null

The currently selected aperture, defaults to null.

Inherited From:
Overrides:
Returns:

Returns true if a feature in an aperture was found and added to the snapper, otherwise false.

Type
boolean

computeBestLabelPosition()

Calculates the optimum position of the space's label.

Returns:

Returns this space to support method chaining.

Type
BIM.Space

computeBoundarySurfaces()

Generates the footprint and surfaces that bound the internal volume of the space.

This is called by the space element's rebuild() method to regenerate its geometry and ClipperLib paths.

Returns:

Returns the footprint polygon.

Type
PD.Polygon

computeCeilingPlane(plane)

Calculates the plane equation for the space ceiling.

This method considers the ceiling pitch angle and internal wall height to determine the plane equation to which walls should be extruded to.

Parameters:
Name Type Description
plane THREE.Plane

The plane to store the ceiling plane.


computeClosestBoundarySegmentXY(point)

Determine if a point lies on the boundary of a space in the XY plane.

This basically detects if the given point is within the material thickness of each outer boundary path segment and returns the associated junction.

Parameters:
Name Type Description
point THREE.Vector3

The point to check.

Returns:

Returns the junction of the path segment the point lies on, or null.

Type
BIM.Junction | null

computeHeight()

Calculates the absolute height of the element.

Default element heights vary wildly. For example, a structural wall should run from the top of the floor slab of its level to the bottom of the floor slab of the level above, whereas an internal partition should run from the top of the floor slab to the bottom of the ceiling on its level. A kitchen cabinet should default to around 900mm or 36", but you may want a built-in cabinet to be full floor-to-ceiling height.

To support this, element heights can be given as either absolute model units (mm) or as a fractional value (0 to 1). The role of this method is to detect any fractional values and convert them to absolute values relative to the value returned by the BIM.Element#getReferenceHeight method.

Inherited From:
Overrides:
Returns:

Returns the calculated height of the element.

Type
number

computeInnerBoundaryAsClipperPath(contour_index)

Generates the internal boundary of the space as a clipper path.

This method cycles through the inner edges of each junctions and builds a clipper path. Clipper paths use arrays of 2D {X,Y} instead of 3D {x,y,z} coordinates, so a new array of 2D points is created.

This method differs from the outer boundary in that spaces can contain inner contours that represent voids or openings in the floor. Thus, specifying the first contour (the default) will give the inner wall boundary whilst other indexes will give void boundaries.

Parameters:
Name Type Default Description
contour_index number 0

The contour to generate the path for, defaults to zero.

Returns:

Returns a 2D clipper path in the XY plane.

Type
Array

computeOuterBoundaryAsClipperPath( [clipCache])

Generates the external boundary of the space as a clipper path.

This method cycles through the outer edges of each junctions and builds a clipper path. Clipper paths use arrays of 2D {X,Y} instead of 3D {x,y,z} coordinates, so a new array of 2D points is created.

This method is used by the level the space belongs to in order to construct its own outer boundary.

Parameters:
Name Type Argument Description
clipCache PD.Clipper.Cache <optional>

An optional ClipperLib point cache.

Returns:

Returns a 2D clipper path in the XY plane.

Type
Array

computePathAsClipperPath()

Converts the space path to 2D ClipperLib.Path arrays using the axis of greatest surface exposure.

This clipper path follows the exact line of the element's path, including any curved sections. This is typically used for detecting spatial overlapping and to clip subordinate spaces to ordinate ones.

Returns:

Returns an array of one ClipperLib.Path arrays, each containing {X,Y} Clipper points.

Type
Array

computeSimulationSurfaces(simModel)

Generates simplified simulation surfaces for use in performance analysis.

Parameters:
Name Type Description
simModel BIM.Analysis.Model

The simulation model to add surfaces to.

Returns:

Returns an array of surfaces for this space.

Type
Array

containsElement()

Checks if the element contains the given child element.

Inherited From:
Overrides:
Returns:
  • element The child element to check.

    Type
    BIM.Element
  • Returns true if this composite element contains the child element.

    Type
    boolean

deleteAttribute(name)

Removes an attribute from this entity.

Parameters:
Name Type Description
name string

The name of the attribute to remove.

Inherited From:
Overrides:
Returns:

Returns this entity to support method chaining.

Type
PD.Base

dimension(mesh, size)

Adds dimension lines around an element when selected.

Parameters:
Name Type Description
mesh PD.PolyMesh

The mesh to render to.

size number

The size of dimension in model units.

Inherited From:
Overrides:
Returns:

Returns true if anything was added to the mesh.

Type
boolean

ensureValidBRep()

Retrieves the element's boundary representation (BRep), ensuring that it has a valid one.

If the element does not currently have a BRep, this method will create a new empty one and assign it to it. If it does have a BRep, it is simply returned. If you do not want to create a new BRep if one does not already exist, simply access the brep property instead.

Inherited From:
Overrides:
Returns:

Returns the element's BRep, creating one if necessary.

Type
PD.BRep
Example
/// Rather than using:
const brep = element.brep;
if (!brep) {
    element.brep = new PD.BRep();
}

/// You can simply use:
const brep = element.ensureValidBRep();
/// Now safe to use `brep` without having to check if it exists first.

ensureValidPath()

Retrieves the element's path, ensuring that it has a valid one.

If the element does not currently have a path, this method will create a new empty one and assign it to it. If it does have a path, it is simply returned. If you do not want to create a new path if one does not already exist, simply access the path property instead.

If a new path is created, the element's hasChanged property is also set to true to indicate that the element needs to be updated.

Inherited From:
Overrides:
Returns:

Returns the element's path, creating one if necessary.

Type
BIM.Path
Example
/// Rather than using:
const path = element.path;
if (!path) {
    element.path = new BIM.Path();
}

/// You can simply use:
const path = element.ensureValidPath();
/// Now safe to use `path` without having to check if it exists first.

ensureValidShell()

Retrieves the element's shell, ensuring that it has a valid one.

If the element does not currently have a shell, this method will create a new empty one and assign it to it. If it does have a shell, it is simply returned. If you do not want to create a new shell if one does not already exist, simply access the shell property instead.

Inherited From:
Overrides:
Returns:

Returns the element's shell, creating one if necessary.

Type
PD.Shell
Example
/// You can simply use:
const shell = element.ensureValidShell();
/// Now safe to use `shell` without having to check if it exists first.

/// Rather than using:
const shell = element.shell;
if (!shell) {
    element.shell = new PD.Shell();
}

findApertureByRay(selection)

Checks if the given ray intersects any apertures belonging to this element and, if so, updates the selection with the intersected aperture details.

Parameters:
Name Type Description
selection PD.Selection

The interactive selection accumulator.

Inherited From:
Overrides:
Returns:

Returns true if an aperture in the element was selected and the selection updated, otherwise false.

Type
boolean

findAperturesByFrustum(selection)

Searches for apertures inside the given frustum and, if found, adds them to the selection.

Parameters:
Name Type Description
selection PD.Selection

The interactive selection accumulator.

Inherited From:
Overrides:
Returns:

Returns true if any apertures within the element were added to the selection, otherwise false.

Type
boolean

findBRepByFrustum(selection)

Checks if element's boundary representation is inside the frustum and updates the selection.

Parameters:
Name Type Description
selection PD.Selection

The interactive selection accumulator.

Inherited From:
Overrides:
Returns:

Returns true if the boundary of the element was selected and the selection updated, otherwise false.

Type
boolean

findBRepEdgeByRay(selection)

Checks if the given ray intersects a boundary edge in this element and updates the selection.

Parameters:
Name Type Description
selection PD.Selection

The interactive selection accumulator.

Inherited From:
Overrides:
Returns:

Returns true if a boundary edge within the element was selected and the selection updated, otherwise false.

Type
boolean

findBRepFaceByRay(selection)

Checks if the given ray intersects a boundary facet in this element and updates the selection.

Parameters:
Name Type Description
selection PD.Selection

The interactive selection accumulator.

Inherited From:
Overrides:
Returns:

Returns true if a boundary facet within the element was selected and the selection updated, otherwise false.

Type
boolean

findBRepVertexByRay(selection)

Checks if the given ray intersects a BRep vertex in this element and updates the selection.

Parameters:
Name Type Description
selection PD.Selection

The interactive selection accumulator.

Inherited From:
Overrides:
Returns:

Returns true if a boundary vertex within the element was selected and the selection updated, otherwise false.

Type
boolean

findChildrenByRay(selection)

Checks if the given ray intersects any of this element's children and updates the selection.

Parameters:
Name Type Description
selection PD.Selection

The interactive selection accumulator.

Inherited From:
Returns:

Returns true if a path segment in the element/child was selected and the selection updated, otherwise false.

Type
boolean

findJunctionsByFrustum(selection)

Searches for path junctions inside frustum and, if found, adds them to the selection.

Parameters:
Name Type Description
selection PD.Selection

The interactive selection accumulator.

Inherited From:
Overrides:
Returns:

Returns true if any junctions within the element path were added to the selection, otherwise false.

Type
boolean

findSegmentsByFrustum(selection)

Searches for path segments inside the given frustum and, if found, adds them to the selection.

Parameters:
Name Type Description
selection PD.Selection

The interactive selection accumulator.

Inherited From:
Overrides:
Returns:

Returns true if any segments within the element path were added to the selection, otherwise false.

Type
boolean

getAttribute(name)

Retrieve an attribute stored on this entity, if it exists.

Parameters:
Name Type Description
name string

The name of the attribute to retrieve.

Inherited From:
Overrides:
Returns:

Returns the attribute value, or undefined if it does not exist.

Type
any | undefined

getBoundedSpaceData()

Retrieve the grouped space data stored for this space, if any.

Returns:

Returns any grouped space data, or null.

Type
object | null

getCeilingReferenceHeight()

Retrieves either the parent level-based height or the default ceiling height.

This value is used as the reference when the ceiling height is given as a fractional value. It is used by both the ceilingHeight getter and the ceilingHeight dynamic parameter definition.

This is either the internal wall height of the level to which the space belongs or, if not yet assigned to a space, the global default ceiling height.

Returns:

Returns the reference ceiling height.

Type
number

getFloorOnFloorThreshold()

Returns the height range within which a bounded space is considered to be part of the floor host space.

Returns:

Returns a hight threshold value.

Type
number

getJunctionParameters(junction)

Provides a list of parameter groups for the given element junction.

This methods provides each element an opportunity to store junction-specific parameters that can be used when generating their geometry. Exactly what these parameters are will depend on the nature of each element. For example, a cabinet may allow each junction to define the height of its segment and whether it has swinging doors, sliding doors or open shelves. A tree on the other hand, may allow each junction to override any of the procedural tree parameters as well as defining a rotation angle and relative scale.

See the PD.Base#getDynamicParameters method for more details.

Parameters:
Name Type Description
junction BIM.Junction

The junction to create dynamic parameters for.

Inherited From:
Overrides:
Returns:

Returns an array of PD.ParamGroup objects.

Type
Array

getReferenceHeight()

Calculates the reference height for this element.

The default height for typical elements is either the element's bounding space height or the height of the level on which it sits. This method determines which of those values to use.

Inherited From:
Overrides:
Returns:

Returns the reference height for this element.

Type
number

getTypeComponentParameters()

Provides a list of component parameter groups for this element.

See the PD.Base#getDynamicParameters method for more details.

Inherited From:
Overrides:
Returns:

Returns an array of PD.ParamGroup objects.

Type
Array

handleMoveByQuaternion(quat [, about])

Moves the space by applying the given matrix to its reference position(s).

This method will always be called as part of a sequence, which starts with handleBeforeMove, followed by one or more calls to handleMove or handleMoveByQuaternion and finishes with handleAfterMove.

Parameters:
Name Type Argument Description
quat THREE.Quaternion

The quaternion to apply.

about THREE.Vector3 <optional>

An optional point about which to apply the transform.

Overrides:
Returns:

Returns this element to support method chaining.

Type
BIM.Element

handleOnAddJunction(contour_index, junction_index)

Provides an opportunity to elements to restrict their number of junctions.

Some elements, such as sensors and sun-path diagrams, only need a single junction to define their 3D position. Others may require just two junctions to give a center point and direction.

This method is always called just prior to a new junction being added, either during interactive creation or when inserting in a selected segment.

Parameters:
Name Type Description
contour_index number

The ordinal index of the contour being added to.

junction_index number

The ordinal index of the junction within the contour.

Inherited From:
Overrides:
Returns:

Returns true if the junction can be added, or false if not.

Type
boolean

handleOnCursorMove(new_pos, cursor [, junction])

Provides an opportunity for elements to constrain cursor movements.

This method is called whenever an interactive cursor is moved with this element selected. If one of the element's junctions is selected, it will be included as the last argument. If the element itself is being moved, the last argument will be undefined.

The default implementation simply returns false. Override this method to perform whatever checking is required and modify new_pos to constrain the movement.

Parameters:
Name Type Argument Default Description
new_pos THREE.Vector3

The proposed new position of the cursor.

cursor PD.Cursor

The cursor that is being interactively dragged.

junction BIM.Junction <optional>
null

The junction that is being dragged, if selected.

Overrides:
Returns:

Returns true if the point was changed, otherwise false.

Type
boolean

handleOnCursorSelect(cursor [, junction])

Provides an opportunity for elements to initialise the cursor when selected.

This method is called whenever the element or one of its junction is selected. If one of the element's junctions is selected, it will be included as the last argument. If the element itself is selected, the 'junction' argument will be null.

The default implementation simply calls the cursor.clearRotation() method. Override it to orient the cursor as appropriate.

Parameters:
Name Type Argument Default Description
cursor PD.Cursor

The cursor that is being interactively dragged.

junction BIM.Junction <optional>
null

The junction that was selected, defaults to null.

Inherited From:
Overrides:
Returns:

Returns true if the cursor orientation was changed.

Type
boolean

handleOnJunctionChange()

Provides an opportunity for elements to react to junction property changes.

This method is called whenever the height or orientation values of a junction are changed using either a cursor manipulator or an interactive UI component with this element selected.

The default implementation simply returns false to indicate that the height or orientation hss not been constrained or changed in any way. Override this method to perform whatever checking is required and only return true if the junction's property was modified as a result.

Inherited From:
Overrides:

hasContent()

Checks if the composite element contains any child elements.

Inherited From:
Overrides:
Returns:

Returns true if the element has content.

Type
boolean

insertAperturesIntoAdjacentSurfaces(junctions)

Inserts apertures from adjacent spaces into the internal walls of this space.

This method checks for surfaces that are both parallel and proximate to any apertures that belong to junctions in the given list. To be inserted within a surface, the surface's junction out normal must be the opposite of the host junction's out normal, and the window center point must lie between the two at a maximum distance equal to the material thickness of the host wall.

   + - - - - - - - - - - - - -+ - - - + - - -+ - - - - + - - - +
   .                          | - - - |      | - - - - |       |
   .    +-----------------+ +-+ @ @ @ +-+ +--+ @ @ @ @ +--+    |
   .    |                 | |           | |   external    +----+
   .    |                 | |           | |               @    .
   .    |                 | |           | |               @    .
   .    |                 | +--+    +---+ |               @    .
   .    |                 +----+    +---+ |   internal    +----+
   .    |                               | +---+      +----+    |
   .    |                               +-----+      +----+    |
   .    |                                                 |    |
   .    |   |''-._                                        |    |
   .    |   |     '-                                      |    |
   .    |   |       :                  external           |    |
   .    +---+ @ @ @ +---------+ @ @ @ @ @ @ @ @ @ @ @ +---+    |
   .        |       |         | - - - - - - - - - - - |        |
   + - - - -+- - - -+- - - - - - - - - - - - - - - - - - - - - +
Parameters:
Name Type Description
junctions Array

A list of junctions the contain apertures.

Returns:

Returns this space to support method chaining.

Type
BIM.Space

intersectExtents(ray, intersection)

Determines if the given ray intersects the entity extents.

Parameters:
Name Type Description
ray THREE.Ray

The ray to find the intersection for.

intersection THREE.Vector3

The vector to store the intersection point, if any.

Inherited From:
Overrides:
Returns:

Returns the intersection point, or null if no intersection.

Type
THREE.Vector3 | null

intersectLightRay(ray, result)

Handles the intersection of a light or shading ray with this element.

This method typically intersects the ray with the BIM.Element#shell if it has one. Override this method in your custom element if it needs to handle light ray intersections differently.

Parameters:
Name Type Description
ray THREE.Ray

The ray defining the origin and direction of the light ray.

result object

An object containing information about the light ray.

Properties of result:
Name Type Description
intersection THREE.Vector3

Stores the triangle intersection point as a {x,y,z} vector.

transmittance number

Stores the accumulated transmittance of all intersected surfaces.

reflectance number

Stores the accumulated reflectance from all intersected surfaces.

color number

Stores the color of the primary intersected surface.

Overrides:
Returns:

Returns true if the light ray hit an opaque surface and updated results.

Type
boolean

isElementInside(element [, selecting])

Determines whether or not the given element is inside this space.

This method first checks the bounding box of the space, then projects the point onto the floor plane and tests if it is inside the boundary.

Parameters:
Name Type Argument Default Description
element BIM.Element

The element to test.

selecting boolean <optional>
false

Whether or not this is being used to select a polygon.

Returns:

Returns true if the point projected onto the floor of the space is inside it.

Type
boolean

mergeElements(elements)

Adds a list of elements to this container.

Parameters:
Name Type Description
elements Array.<BIM.Element>

A list of elements to merge.

Inherited From:
Overrides:
Returns:

Returns true if one or more elements were merged.

Type
boolean

mounted(parent)

Called when the element is added to the given level/space.

NOTE: This life cycle method is called just after the element has been prepared and added to the level and just before the update() method is called for the first time on the element with this parent. You may still call update() within this method if you need to, but know that the later call will be ignored as the changed flags will have already been reset.

Parameters:
Name Type Description
parent BIM.Level | BIM.Space

The level or space that the element was just added to.

Inherited From:
Overrides:
Returns:

Returns this element to support method chaining.

Type
BIM.Element

moveByMatrix4(matrix)

Transforms the element by applying the matrix to it.

NOTE: This is not an interactive method that is part of a transform sequence. Rather it is one that is meant to reposition, scale and/or rotate the element with a single call. As such, it first calls BIM.Element#handleBeforeMove on the element, followed by BIM.Element#handleMoveByMatrix and then BIM.Element#handleAfterMove.

Parameters:
Name Type Description
matrix THREE.Matrix4

The transform matrix to apply to the element.

Inherited From:
Overrides:
Returns:

Returns this element to support method chaining.

Type
BIM.Path

moveByVector3(vector)

Move the element by a relative vector.

NOTE: This is not an interactive method that is part of a move sequence. Rather it is one that is meant to reposition the element with a single call. As such, it first calls BIM.Element#handleBeforeMove on the element, followed by BIM.Element#handleMove and then BIM.Element#handleAfterMove.

Parameters:
Name Type Description
vector THREE.Vector3

The relative movement vector.

Inherited From:
Overrides:
Returns:

Returns this element to support method chaining.

Type
BIM.Path

moveJunctionListByVector(list, vector [, undo])

Moves the list of junctions within the element.

This method is used when dragging one or more junctions and during the undo/redo of that process. It checks for any specific settings or rules (such as a rectangular shape) and tries to comply whenever possible.

Parameters:
Name Type Argument Description
list Array.<BIM.Junction>

A list of one or more junctions belonging to this element.

vector THREE.Vector3

The movement vector to apply.

undo boolean <optional>

Whether or not this is being called by undo/redo.

Inherited From:
Overrides:
Returns:

Returns this element to support method chaining.

Type
BIM.Element

moveSegmentListByVector(list, vector [, undo])

Moves the list of path segments within the element.

This method is used when dragging one or more segments and during the undo/redo of that process. It checks for any specific settings or rules (such as a rectangular shape) and tries to comply whenever possible.

Parameters:
Name Type Argument Description
list Array.<BIM.Junction>

A list of one or more segments belonging to this element.

vector THREE.Vector3

The movement vector to apply.

undo boolean <optional>

Whether or not this is being called by undo/redo.

Inherited From:
Overrides:
Returns:

Returns this element to support method chaining.

Type
BIM.Element

recheckChildrenAndBoundedSpaces()

Rechecks all child elements and bounded spaces to ensure they are still inside this space.


removeAperture(aperture)

Removes an aperture from a junction in this space.

Parameters:
Name Type Description
aperture BIM.Aperture

The aperture to remove.

Returns:

Returns true if the aperture was found and removed.

Type
boolean

removeElement(element)

Removes a building element from this space.

Parameters:
Name Type Description
element BIM.Element

The building element to remove.

Overrides:
Returns:

Returns the ordinal index of the removed element, or -1 if not found in this space.

Type
number

removeJunction(junction [, contour_index])

Removes a junction from the element path.

If the contour or ordinal index is not given, the path will be searched for the given point.

Parameters:
Name Type Argument Description
junction BIM.Junction

The junction to be removed.

contour_index number <optional>

The ordinal index of the path contour to remove the junction from.

Inherited From:
Overrides:
Returns:

Returns the index of the junction removed, or -1.

Type
number

renderBoundaryRepresentation(mesh, view)

Renders the boundary representation of the element if it has one.

Parameters:
Name Type Description
mesh PD.PolyMesh

The mesh to render the boundary representation to.

view PD.ViewData

The view definition to render the model within.

Inherited From:
Overrides:
Returns:

Returns true if anything was added to the mesh.

Type
boolean

renderExtraShellToMesh(shell, mesh, view, level)

Renders the given shell to the given mesh using the same handling of view as in the element's own shell.

NOTE: This method must only be called from somewhere within the BIM.Element#render method of the subclassed element. Otherwise any additions to the shell won't make it to the canvas as they will be overridden on the next render when the shell is reinitialised.

Parameters:
Name Type Description
shell PD.Shell

The shell to render.

mesh PD.PolyMesh

The mesh to add shell geometry to.

view PD.ViewData

The view definition to render the model within.

level BIM.Level

The level currently being rebuilt and rendered.

Inherited From:
Overrides:
Returns:

Returns true if anything was added to the mesh.

Type
boolean

renderNameAndArea(mesh)

Render text for the name and useable area of the space.

Parameters:
Name Type Description
mesh PD.PolyMesh

The mesh to add text geometry to.

Returns:

Returns this space to support method chaining.

Type
BIM.Space

renderShell(meshes, view, level)

An alternative render method to support furnishing and fixtures.

This is a utility method that subclasses can use instead fo the default render method. It renders the shell of the element and not its path.

Parameters:
Name Type Description
meshes BIM.Meshes

The collection of meshes to render to.

view PD.ViewData

The view definition to render the model within.

level BIM.Level

The level currently being rebuilt and rendered.

Inherited From:
Overrides:
Returns:

Returns true if anything was added to any mesh.

Type
boolean

reparentElement(element)

Moves an internal building element into this space.

This method will remove the element from any previous parent space, adds it to this space and ensures it references the right level and parent entities.

Parameters:
Name Type Description
element BIM.Element

The building element to move.

Returns:

Returns true if the element was successfully moved, otherwise false.

Type
boolean

selectedSnapBehavior(selMan)

Provides the base snap behavior when an element is selected and dragged.

By default, the element will snap to the junctions of its outer path boundary, if it has one. If you would like your element to snap against something other than its path, you can override this method.

See also snapPointToPath.

If you do override this method, the following example shows the default snap behavior as a basis for you to use.

Parameters:
Name Type Description
selMan PD.SelectionManager

The selection manager that is handling the snap.

Inherited From:
Overrides:
Example
selectedSnapBehavior(selMan) {

       /// Temporarily show the snap paths of other elements as
       /// dotted lines so you can see what you are snapping to.
       selMan.showSnapPaths = true;

       /// Don't use the dragged cursor as a snap point
       /// as the element centroid is often not relevant.
       selMan.snapper.directSnap = false;

       if (this.path) { /// Snap to each boundary point.
           for (const junction of this.path.getContour(0)) {
               selMan.modelManager.snapLineToNearestElement(selMan.snapper, junction, selMan.selectionSet);
           }
       }

   };

separateElements(elements, level)

Removes a list of elements from this container and returns them to the given level.

Parameters:
Name Type Description
elements Array.<BIM.Roof>

A list of elements to add to remove.

level BIM.Level

The level to add the removed elements to.

Inherited From:
Overrides:
Returns:

Returns true if one or more elements were removed.

Type
boolean

setAttribute(name, value)

Stores an attribute on this entity, or replaces it's existing value.

Parameters:
Name Type Description
name string

The name of the attribute to store.

value string

The attribute value to store.

Inherited From:
Overrides:
Returns:

Returns this entity to support method chaining.

Type
PD.Base

setExtents(bbox)

Set the 3D extents of the element as a bounding box.

Override this method in bounding box driven building elements such as equipment, imported or parametric meshes to rescale or regenerate their underlying geometry whenever it changes.

Parameters:
Name Type Description
bbox THREE.Box3

The new bounding box extents to set.

Inherited From:
Overrides:
Returns:

Returns this entity to support method chaining.

Type
PD.Base

snapToClosestSegment()

Snaps the given point to the nearest wall facet.

Returns:

Returns true if the point was snapped.

Type
boolean

trimOrExtendToUnclippedRoofs(level)

Trims or extents internal surfaces to any unclipped roofs on the parent level. This method is called by the parent level and gives the space an opportunity to opt in or out as required, as well as to include structural walls.

Parameters:
Name Type Description
level BIM.Level

The parent level to trim/extend to.


unmounted(parent)

Called when the element is removed from a space or level.

Parameters:
Name Type Description
parent BIM.Level | BIM.Space

The level or space that the element was just removed from.

Inherited From:
Overrides:
Returns:

Returns this element to support method chaining.

Type
BIM.Element

updateRelativeHeight()

Updates the element's computed height if it is given as a relative value rather than an absolute dimension.

Inherited From:
Overrides:
Returns:

Returns true if the computed height changed, otherwise false.

Type
boolean

usesJunctionOrientation(junction)

Determines if this element responds to the orientation of the given junction.

Use this method to define the logic for determining if the element uses the given junction's orientation attribute value when computing the geometry at each of its junctions. The result is used by the interactive selection process to display a cursor rotation manipulator with which to set the value.

When overriding this method on an element, you should also override the BIM.Element#handleOnJunctionChange method to moderate or constrain any orientation angle changes as they occur.

Parameters:
Name Type Description
junction BIM.Junction

The junction being checked for orientation.

Inherited From:
Overrides:
Returns:

Return true to show a rotation cursor manipulator.

Type
boolean

getClassDescription() <static>

A brief description of this class to accompany its icon.

Returns:

Returns a brief description.

Type
string

getClassName() <static>

The name of this class within the PD.Registry.

See PD.Base.getClassName for more details as this is required for use with the PD.Registry.

Returns:

Returns the registered name of this class.

Type
string

getEntityType() <static>

Defines the type of BIM entity this class represents.

See BIM.Entity.getEntityType for more details as this is required for use with the PD.Registry.

Returns:

Returns the BIM entity type this class represents.

Type
BIM.ENTITY