new RevisionCloud( [config] [, typeName])
Creates a new revision cloud drawing element.
Parameters:
| Name | Type | Argument | Description | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
config |
object |
<optional> |
An optional configuration object. |
||||||||||||||||||||||||
Properties of
|
|||||||||||||||||||||||||||
| Name | Type | Argument | Description |
|---|---|---|---|
name |
string |
<optional> |
A human-readable name for this line. |
uuid |
string |
<optional> |
A universally unique identifier of this line. |
visible |
boolean |
<optional> |
Whether or not the line is visible in the model. |
extents |
THREE.Box3 |
<optional> |
The bounding box of the line in model space. |
path |
BIM.Path |
<optional> |
A path for this line geometry to follow. |
typeNameAn 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.
Extends
Members
-
:number
_height
-
The height of the line above floor level.
Type
- number
- Overrides:
- BIM.Element#_height
-
: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:
-
: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.BRepinstance, 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
- PD.BRep | null
- 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.Spaceby 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:
-
: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 referencesthis.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:
-
:number
curveDepth
-
The depth of the cloud indicating curves distributed over the path.
Type
- number
-
:number
curveSize
-
The size of cloud indicating curves distributed over the path.
Type
- number
-
:number
dashSize
-
The size of dashes when rendering the construction line, defaults to zero (solid).
Type
- number
-
:string
displayName <readonly>
-
The name to display for this class within the user interface.
Type
- string
- 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.Registryfor grouping elements and matching components. The base implementation simply referencesthis.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:
-
: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
uuidproperty, 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:
-
: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
isRevisionCloud <readonly>
-
A flag identifying this object as a construction line.
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:
-
: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#addElementmethod on the level you wish to add the element to.Type
- BIM.Renderable | BIM.Level | null
- 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
falsefor 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 asBIM.SunPath3DandBIM.IsoVistuse entirely their own meshes so can be updated completely independently of the rest of the building model.Thus, a
truevalue 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'sBIM.Element#updateDynamicParametersmethod which checks this property to determine whether to just call thePD.GlobalActions.updateSelectionMeshesmethod instead of returningtrueand 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
falsefor 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
truevalue 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'sBIM.Element#updateDynamicParametersmethod which checks this property to determine whether to just call theBIM.Level#rebuildSiteMeshmethod instead of returningtrueand 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
- BIM.Element | null
- Inherited From:
- Overrides:
-
:boolean
selectSegmentsByShell <readonly>
-
Whether or not to select path segments in 3D using each junction's shell.
When true, the selection process will check if the user has clicked or tapped on any of the shell facets of a path junction and, if so, will set that junction's path segment as selected. This is typically only true for extruded elements such as spaces, walls, slabs, railings and stairs, as well as those with per-junction geometry such as plants and rocks.
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.SelectionManageruses 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#rebuildmethod 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 yourrebuildmethod 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
brepproperty.A shell is composed of one or more
PD.Polygoninstances, 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 equivalentPD.BRep.Faceinstance. Thus, rather than store thousands of post, rail and infill surfaces as shell polygons, the railings element stores all that in itsPD.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
- PD.Shell | null
- Inherited From:
- Overrides:
-
:BIM.Space|null
space <readonly>
-
The space that this element belongs to.
To add an element to a space, use the
BIM.Space#addElementmethod on the space you wish to add the element to.Type
- BIM.Space | null
- 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
- BIM.Structure | null
- Inherited From:
- Overrides:
-
:number
subType
-
Stores the type enumerator for this line.
Type
- number
- 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.SYSTEMenumerators.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.Relationis 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
subTypeproperty 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.Wallstype component, which defines its thickness, surface properties and material layers via aBIM.Construction. A chair references aBIM.Chairstype component to actually generate the entire geometry of each chair instance as laid out by its path junctions.Type
- BIM.Component | null
- 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:
-
: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
truewhenever 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 tofalseonce it has processed the change, so no other method or action anywhere should ever set this value to anything other thantrue.NOTE: It is the responsibility of the element's own
update()method to set this value to true when calling itsrebuild()method. The reason this is not left to therebuild()method is that virtually every element subclass requires its own specificrebuild()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 overriddenrebuild()method, it is left to theupdate()method which is overridden far less often and is also responsible for managing other element state such as thehasChangedflag.Type
- boolean
- Inherited From:
- Overrides:
-
:object
icon <static>
-
The icon associated with this class in the
PD.Registry.See
PD.Base.iconfor more information on this object format.Type
- object
Methods
-
addJunction(junction [, contour_index] [, ordinal_index])
-
Adds a new junction at the given index within the given contour.
Parameters:
Name Type Argument Description junctionBIM.Junction The junction to be inserted.
contour_indexnumber <optional>
The ordinal index of the path contour to insert the junction in, defaults to 0.
ordinal_indexnumber <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#trackSpaceBoundaryproperty is true.Parameters:
Name Type Description spaceBIM.Space The parent space of the element.
junctionsBIM.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 selectionPD.Selection The interactive selection accumulator.
- Inherited From:
- Overrides:
Returns:
Returns true if the element should/would be selected, otherwise false.
- Type
- boolean
-
clearSelection()
-
Deselects the element path and all its points.
- Inherited From:
- Overrides:
Returns:
Returns this path to support method chaining.
- Type
- BIM.Element
-
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
-
closestPoint3D(snapper, ray, test_pt)
-
Checks for points in the element path near the 3D ray.
Parameters:
Name Type Description snapperPD.Snapper The snap helper object.
rayTHREE.Ray The ray through the 3D cursor.
test_ptTHREE.Vector3 The point to find the closest snap to.
- Inherited From:
- Overrides:
Returns:
Returns true if a feature in the element was found and added to the snapper, otherwise false.
- Type
- boolean
-
closestPointOnAperture(snapper, ray, point [, selected_aperture])
-
Checks for points in the element path near the 3D ray.
Parameters:
Name Type Argument Default Description snapperPD.Snapper The snap helper object.
rayTHREE.Ray The ray through the 3D cursor.
pointTHREE.Vector3 The point to find the closest snap to.
selected_apertureBIM.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
-
closestPointXY(snapper, test_pt)
-
Checks for points in the element path near the given point in the XY plane.
Parameters:
Name Type Description snapperPD.Snapper The snap helper object.
test_ptTHREE.Vector3 The point to find the closest snap to.
- Inherited From:
- Overrides:
Returns:
Returns true if a feature in the element was found and added to the snapper, otherwise false.
- Type
- boolean
-
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#getReferenceHeightmethod.- Inherited From:
- Overrides:
Returns:
Returns the calculated height of the element.
- Type
- number
-
deleteAttribute(name)
-
Removes an attribute from this entity.
Parameters:
Name Type Description namestring 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 meshPD.PolyMesh The mesh to render to.
sizenumber 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
brepproperty 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
pathproperty instead.If a new path is created, the element's
hasChangedproperty 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
shellproperty 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 selectionPD.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 selectionPD.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 selectionPD.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 selectionPD.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 selectionPD.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 selectionPD.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
-
findByFrustum(selection)
-
Checks if element is inside frustum and updates the selection.
Parameters:
Name Type Description selectionPD.Selection The interactive selection accumulator.
- Inherited From:
- Overrides:
Returns:
Returns true if a path segment in the element was selected and the selection updated, otherwise false.
- Type
- boolean
-
findByRay(selection)
-
Checks if the given ray intersects this element and updates the selection.
Parameters:
Name Type Description selectionPD.Selection The interactive selection accumulator.
- Inherited From:
- Overrides:
Returns:
Returns true if a path segment in the element was selected.
- Type
- boolean
-
findFacetByRay(selection [, front])
-
Checks if the given ray intersects any shell facets belonging to this element's path junctions and, if found, updates the selection with the intersected facet details.
Parameters:
Name Type Argument Description selectionPD.Selection The interactive selection accumulator.
frontTHREE.Vector3 <optional>
An optional position that must be in front of the plane.
- Inherited From:
- Overrides:
Returns:
Returns true if a path segment in the element was selected and the selection updated, otherwise false.
- Type
- boolean
-
findJunctionByRay(selection)
-
Checks if the given ray hits or passes close to any junctions and, if found, updates the selection with the closest junction details.
Parameters:
Name Type Description selectionPD.Selection The interactive selection accumulator.
- Inherited From:
- Overrides:
Returns:
Returns true if a vertex in the element 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 selectionPD.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
-
findSegmentByRay(selection [, shallow])
-
Checks if the given ray hits or passes close to any path segments and, if found, updates the selection with the closest segment details.
Parameters:
Name Type Argument Default Description selectionPD.Selection The interactive selection accumulator.
shallowboolean <optional>
false When true, only segments checked, not any aperture elements.
- Inherited From:
- Overrides:
Returns:
Returns true if a path segment in the element was selected and the selection updated, 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 selectionPD.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
-
generateCloudPath()
-
Constructs a cloud path from the element path.
Returns:
Returns true if the cloud path was successfully generated and is valid.
- Type
- boolean
-
getAttribute(name)
-
Retrieve an attribute stored on this entity, if it exists.
Parameters:
Name Type Description namestring 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
-
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#getDynamicParametersmethod for more details.Parameters:
Name Type Description junctionBIM.Junction The junction to create dynamic parameters for.
- Inherited From:
- Overrides:
Returns:
Returns an array of
PD.ParamGroupobjects.- 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#getDynamicParametersmethod for more details.- Inherited From:
- Overrides:
Returns:
Returns an array of
PD.ParamGroupobjects.- Type
- Array
-
handleAfterMove( [junction])
-
Called when a transformation sequence has completed.
This method will always be called as part of a sequence, which starts with
handleBeforeMove, followed by one or more calls tohandleMove,handleMoveByQuaternionorhandleMoveByMatrixand finishes withhandleAfterMove.If the
trackSpaceBoundaryproperty is true, and the element is owned by a space, the element's path junctions will be checked and their relationships updated.Parameters:
Name Type Argument Description junctionBIM.Junction <optional>
If moving a single junction, that junction.
- Inherited From:
- Overrides:
Returns:
Returns this element to support method chaining.
- Type
- BIM.Element
-
handleBeforeMove()
-
Initialises reference positions just prior to an interactive drag.
For safety and stability, interactive movement is done using an absolute drag vector, matrix or quaternion rather than incrementally each frame. Thus the main function of this method is to store reference positions for all parts of the element that will move as part of an interactive drag or transform.
This method will always be called as part of a sequence, which starts with
handleBeforeMove, followed by one or more calls tohandleMove,handleMoveByQuaternionorhandleMoveByMatrixand finishes withhandleAfterMove.- Inherited From:
- Overrides:
Returns:
Returns this element to support method chaining.
- Type
- BIM.Element
-
handleMove(vector)
-
Moves the element by the given vector from 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 tohandleMoveand finishes withhandleAfterMove.Parameters:
Name Type Description vectorTHREE.Vector The absolute direction vector of the current drag.
- Inherited From:
- Overrides:
Returns:
Returns this element to support method chaining.
- Type
- BIM.Element
-
handleMoveByMatrix(matrix [, about])
-
Transforms the element by applying the given matrix from 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 tohandleMoveByMatrix and finishes withhandleAfterMove`.Parameters:
Name Type Argument Description matrixTHREE.Matrix4 The transform matrix to apply to the path.
aboutTHREE.Vector3 <optional>
An optional point about which to apply the transform.
- Inherited From:
- Overrides:
Returns:
Returns this element to support method chaining.
- Type
- BIM.Element
-
handleMoveByQuaternion(quat [, about])
-
Rotates the element by applying the given quaternion from 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 tohandleMoveByQuaternionand finishes withhandleAfterMove.Parameters:
Name Type Argument Description quatTHREE.Quaternion The quaternion to apply.
aboutTHREE.Vector3 <optional>
An optional point about which to apply the transform.
- Inherited From:
- 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_indexnumber The ordinal index of the contour being added to.
junction_indexnumber 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 modifynew_posto constrain the movement.Parameters:
Name Type Argument Default Description new_posTHREE.Vector3 The proposed new position of the cursor.
cursorPD.Cursor The cursor that is being interactively dragged.
junctionBIM.Junction <optional>
null The junction that is being dragged, if selected.
- Inherited From:
- Overrides:
Returns:
Returns
trueif the point was changed, otherwisefalse.- 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 cursorPD.Cursor The cursor that is being interactively dragged.
junctionBIM.Junction <optional>
null The junction that was selected, defaults to
null.- Inherited From:
- Overrides:
Returns:
Returns
trueif 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
falseto 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 returntrueif the junction's property was modified as a result.- Inherited From:
- Overrides:
-
highlight(mesh, view)
-
Renders a highlighted view of the element to show it as selected.
Parameters:
Name Type Description meshPD.PolyMesh The selection mesh to render highlighting to.
viewPD.ViewData The view definition to render the model within.
- Inherited From:
- Overrides:
Returns:
Returns true if anything was added to the mesh.
- Type
- boolean
-
intersectExtents(ray, intersection)
-
Determines if the given ray intersects the entity extents.
Parameters:
Name Type Description rayTHREE.Ray The ray to find the intersection for.
intersectionTHREE.Vector3 The vector to store the intersection point, if any.
- Inherited From:
- Overrides:
Returns:
Returns the
intersectionpoint, 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#shellif it has one. If the ray intersects an opaque surface, thetransmittancevalue is set to zero, thereflectanceand color are set using surface properties, and the method returns true.If the ray hits a non-opaque surface, the
transmittanceis multiplied by the visible light transmittance of the surface and the method returns false. If nothing is hit,resultis not changed and the method returns false.Override this method in your custom element if it needs to handle light ray intersections differently.
Parameters:
Name Type Description rayTHREE.Ray The ray defining the origin and direction of the light ray.
resultobject An object containing information about the light ray.
Properties of
result:Name Type Description intersectionTHREE.Vector3 Stores the triangle intersection point as a {x,y,z} vector.
transmittancenumber Stores the accumulated transmittance of all intersected surfaces.
reflectancenumber Stores the accumulated reflectance from all intersected surfaces.
colornumber Stores the color of the primary intersected surface.
- Inherited From:
- Overrides:
Returns:
Returns true if the light ray hit an opaque surface and stops here.
- Type
- boolean
-
mounted(parent)
-
Called when the element is added to the given level or space.
NOTE: This life cycle method is called just after the element has been prepared and added to the level and just before the
BIM.Element#updatemethod is called for the first time on the element with this parent. You may still call theBIM.Element#updatemethod within this method if you need to, but know that the later call will be ignored as any change indicators (such asBIM.Element#hasChangedandBIM.Path#hasChanged) should have already been reset during the initial call.Parameters:
Name Type Description parentBIM.Level | BIM.Space The level or space that the element is being 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#handleBeforeMoveon the element, followed byBIM.Element#handleMoveByMatrixand thenBIM.Element#handleAfterMove.Parameters:
Name Type Description matrixTHREE.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#handleBeforeMoveon the element, followed byBIM.Element#handleMoveand thenBIM.Element#handleAfterMove.Parameters:
Name Type Description vectorTHREE.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 listArray.<BIM.Junction> A list of one or more junctions belonging to this element.
vectorTHREE.Vector3 The movement vector to apply.
undoboolean <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 listArray.<BIM.Junction> A list of one or more segments belonging to this element.
vectorTHREE.Vector3 The movement vector to apply.
undoboolean <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
-
rebuild()
-
Rebuilds the geometry of this element ready for visualisation.
See the
BIM.Element#rebuildmethod for more details.- Inherited From:
- Overrides:
Returns:
Returns this line element to support method chaining.
- Type
- BIM.Line
Example
rebuild() { /// Create shell. this.ensureValidShell(); this.shell.reuseStart(); if (this.typeComponent && this.path) { /// Build shell geometry. this.typeComponent.rebuild(this); /// Link shell to this path. this.shell.linkedToPath = this.path; } /// Expand with shell extents. this.extents.union(this.shell.extents); this.shell.reuseEnd(); return this; }; -
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 junctionBIM.Junction The junction to be removed.
contour_indexnumber <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
-
render(meshes, view, level)
-
Render a view of the element using the given meshes.
Parameters:
Name Type Description meshesBIM.Meshes The collection of meshes to render to.
viewPD.ViewData The view definition to render the model within.
levelBIM.Level The level currently being rebuilt and rendered.
- Overrides:
Returns:
Returns true if anything was added to any mesh.
- Type
- boolean
-
renderBoundaryRepresentation(mesh, view)
-
Renders the boundary representation of the element if it has one.
Parameters:
Name Type Description meshPD.PolyMesh The mesh to render the boundary representation to.
viewPD.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
viewas in the element's own shell.NOTE: This method must only be called from somewhere within the
BIM.Element#rendermethod 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 shellPD.Shell The shell to render.
meshPD.PolyMesh The mesh to add shell geometry to.
viewPD.ViewData The view definition to render the model within.
levelBIM.Level The level currently being rebuilt and rendered.
- Inherited From:
- Overrides:
Returns:
Returns true if anything was added to the mesh.
- Type
- boolean
-
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 meshesBIM.Meshes The collection of meshes to render to.
viewPD.ViewData The view definition to render the model within.
levelBIM.Level The level currently being rebuilt and rendered.
- Inherited From:
- Overrides:
Returns:
Returns true if anything was added to any mesh.
- 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 selManPD.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); } } }; -
setAttribute(name, value)
-
Stores an attribute on this entity, or replaces it's existing value.
Parameters:
Name Type Description namestring The name of the attribute to store.
valuestring 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 bboxTHREE.Box3 The new bounding box extents to set.
- Inherited From:
- Overrides:
Returns:
Returns this entity to support method chaining.
- Type
- PD.Base
-
snapPointToPath(snapper, test_pt)
-
Checks for points to snap to within the element path.
Parameters:
Name Type Description snapperPD.Snapper The snap helper object.
test_ptTHREE.Vector3 The point to find the closest snap.
- Inherited From:
- Overrides:
Returns:
Returns true if a feature in the element was found and added to the snapper, otherwise false.
- Type
- boolean
-
unmounted(parent)
-
Called when the element is removed from the given level or space.
NOTE: This life cycle method is called just after the element has been removed from a level or space. If the element is moving from one level/space to another, this will be immediately followed by a call to
mounted()with the new level/space.Parameters:
Name Type Description parentBIM.Level | BIM.Space The level or space that the element is being removed from.
- Inherited From:
- Overrides:
Returns:
Returns this element to support method chaining.
- Type
- BIM.Element
-
update( [forceUpdate])
-
Updates the element and checks to rebuild its geometry.
Elements should override this method to implement whatever custom logic is required to determine if their geometry needs to be rebuilt. If so, then this method should call the element's own
rebuild()method before returning. It is also an opportunity for the element to modify its ownextents.The default implementation checks the
hasChangedflags on both the element itself and itspath. If either are set to true, the element'srebuild()method is called before both flags are cleared. This is suitable for most elements as the editor will set the path changed flag whenever it is changed and the dynamic parameter system will update the element's changed flag whenever a value is changed.The default implementation sets the element's bounding box to match its path extents and adds the element's
heightproperty if non-zero.NOTE: All overridden versions of this method must set the element's
hasChangedandwasRebuiltproperties appropriately when calling therebuild()method, as shown in the example below. When rebuilt, thehasChangedproperty must be set tofalseand thewasRebuiltproperty must be set totrue.Parameters:
Name Type Argument Description forceUpdateboolean <optional>
Whether or not to update even if element has not changed, defaults to false.
- Inherited From:
- Overrides:
Returns:
Returns this element to support method chaining.
- Type
- BIM.Element
Example
update(forceUpdate) { const path = this.path; if (path) { path.element = this; if (forceUpdate || path.hasChanged) { this.hasChanged = true; if (forceUpdate) path.hasChanged = true; path.update(); } /// Use path extents as the default for the element extents. this.extents.copy(path.extents); if (!PD.Utils.closeToZero(this.height)) { const extents = this.extents; if (this.height < 0) extents.min.z = Math.min(extents.min.z, this.height); else extents.max.z = Math.max(extents.max.z, this.height); } } if (forceUpdate || this.hasChanged) { this.hasChanged = false; // ? <-- IMPORTANT: Must clear this flag when rebuilt. this.wasRebuilt = true; // ? <-- IMPORTANT: Must set this flag when rebuilt. this.rebuild(); } return this; }; -
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
orientationattribute 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#handleOnJunctionChangemethod to moderate or constrain any orientation angle changes as they occur.Parameters:
Name Type Description junctionBIM.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.getClassNamefor more details as this is required for use with thePD.Registry.Returns:
Returns the registered name of this class.
- Type
- string
-
getDisplayName() <static>
-
The name to display for this class within the user interface.
Returns:
Returns the display name.
- Type
- string
-
getEntityType() <static>
-
Defines the type of BIM entity this class represents.
See
BIM.Entity.getEntityTypefor more details as this is required for use with thePD.Registry.Returns:
Returns the BIM entity type this class represents.
- Type
- BIM.ENTITY