new SelectionSet( [src])
Creates a new selection set instance.
Parameters:
| Name | Type | Argument | Default | Description |
|---|---|---|---|---|
src |
Array |
<optional> |
null | An optional selection set array to copy. |
Extends
- Map
Members
-
:boolean
isSelectionSet <readonly>
-
A flag identifying this object as a selection set.
Type
- boolean
-
:PD.SELECTED
type <readonly>
-
Stores the type of the currently stored selection data.
Type
Methods
-
addAperture(element, aperture)
-
Adds the given aperture to the selection set.
Parameters:
Name Type Description elementBIM.Element The element containing the aperture.
apertureBIM.Aperture The aperture to add to selection set.
Returns:
Returns true if selection state of aperture changed.
- Type
- boolean
-
addApertures(element, apertures)
-
Adds the given element apertures to the selection set.
If the selection set is not already of type
PD.SELECTED.APERTURE, this method will clear any existing selection and set the type toPD.SELECTED.APERTUREbefore adding the apertures.If any of the items in the array are not valid apertures, they will not be added.
Parameters:
Name Type Description elementBIM.Element The element containing the apertures.
aperturesArray.<BIM.Aperture> The array of apertures to add to selection set.
Returns:
Returns true if any apertures added.
- Type
- boolean
-
addClearCurrentCallback(callback)
-
Add a callback function to be invoked whenever the
clearmethod is called.Parameters:
Name Type Description callbackfunction The function to call when the selection is cleared.
Returns:
Returns the callback method so it can be removed.
- Type
- function
-
addElement(element)
-
Adds the given element to the selection set.
If the set is empty, this method will add the element and set the selection type to
PD.SELECTED.ELEMENT. If the selection set is not empty and not of typePD.SELECTED.ELEMENT, the element will not be added and the method will return false.Parameters:
Name Type Description elementBIM.Element The element to add to the selection set.
Returns:
Returns true if selection state of element changed.
- Type
- boolean
-
addElements(elements)
-
Adds an array of elements as the selection set.
If the selection set is not already of type
PD.SELECTED.ELEMENT, this method will clear any existing selection and set the type toPD.SELECTED.ELEMENTbefore adding the elements.If any of the items in the array are not valid elements, they will not be added.
Parameters:
Name Type Description elementsArray.<BIM.Element> The array of elements to select.
Returns:
Returns true if element(s) added to selection.
- Type
- boolean
-
addJunction(element, junction [, selectedType])
-
Adds the given junction to the selection set.
Parameters:
Name Type Argument Description elementBIM.Element The element containing the junction.
junctionBIM.Junction The junction to add to selection set.
selectedTypePD.SELECTED <optional>
The selection type to store, defaults to PD.SELECTED.JUNCTION.
Returns:
Returns true if selection state of junction changed.
- Type
- boolean
-
addJunctions(element, junctions [, selectedType])
-
Adds the given element junctions to the selection set.
If the selection set is not already of type
PD.SELECTED.JUNCTIONorPD.SELECTED.SEGMENT, this method will clear any existing selection and set the type to the giventypeorPD.SELECTED.JUNCTIONbefore adding the junctions.If any of the items in the array are not valid junctions, they will not be added.
Parameters:
Name Type Argument Description elementBIM.Element The element containing the junctions.
junctionsArray.<BIM.Junction> The array of junctions to add to selection set.
selectedTypePD.SELECTED <optional>
The selection type to store, defaults to PD.SELECTED.JUNCTION.
Returns:
Returns true if any junctions added.
- Type
- boolean
-
addSurface(element, surface)
-
Adds the given surface to the selection set.
Parameters:
Name Type Description elementBIM.Element The element containing the aperture.
surfacePD.BRep The surface to add to selection set.
Returns:
Returns true if the surface was added.
- Type
- boolean
-
addSurfaceFacet(surface, facet)
-
Adds the given surface facet to the selection set.
Parameters:
Name Type Description surfacePD.BRep The surface containing the facet.
facetPD.BRep.Face The facet to add to selection set.
Returns:
Returns true if the surface facet was added.
- Type
- boolean
-
addSurfaceFacets(surface, facets)
-
Adds the given surface facets to the selection set.
If the selection set is not already of type
PD.SELECTED.BREP_FACE, this method will clear any existing selection and set the type before adding the surfaces.If any of the items in the array are not valid facets, they will not be added.
Parameters:
Name Type Description surfacePD.BRep The surface containing the facets.
facetsArray.<PD.BRep.Face> The array of facets to add to selection set.
Returns:
Returns true if any surface facets were added.
- Type
- boolean
-
addSurfaces(element, surfaces)
-
Adds the given element surfaces to the selection set.
If the selection set is not already of type
PD.SELECTED.BREP, this method will clear any existing selection and set the type toPD.SELECTED.BREPbefore adding the surfaces.If any of the items in the array are not valid surfaces, they will not be added.
Parameters:
Name Type Description elementBIM.Element The element containing the surfaces.
surfacesArray.<BIM.Surface> The array of surfaces to add to selection set.
Returns:
Returns true if any surfaces added.
- Type
- boolean
-
clear( [type])
-
Clears and empties the selection set.
Parameters:
Name Type Argument Description typePD.SELECTED <optional>
An optional type to set once cleared, defaults to
PD.SELECTED.NONE.Returns:
Returns this instance to support method chaining.
- Type
- PD.SelectionSet
-
clone()
-
Creates a shallow copy of the selection set.
This is primarily used by the undo/redo system to keep a copy of the actioned selection set. The arrays stored in the associated data objects are not reused when the selection changes or is cleared, so it is safe for them to nbe stored directly in undo/redo steps.
Returns:
Returns a new selection set.
- Type
- PD.SelectionSet
-
getSelectedAperturesAsArray()
-
Retrieves an array of selected apertures with their element.
This method returns and array where each item is is an array with the first item being the element and the second item being an array of selected apertures within that element.
Returns:
Returns an array of selected apertures by element.
- Type
- Array.<BIM.Element, Array.<BIM.Aperture>>
Example
const selection = PD.GlobalActions.selectionManager.selectionSet.getSelectedAperturesAsArray(); for (const [ element, apertures ] of selection) { for (const aperture of apertures) { console.log("Selected aperture: ", aperture.name); } } -
getSelectedAperturesOnElement(element)
-
Retrieves an array of selected apertures in the given element.
Parameters:
Name Type Description elementBIM.Element The element to obtain selection data for.
Returns:
Returns an array of selected apertures in this element.
- Type
- Array.<BIM.Aperture>
-
getSelectedElements()
-
Retrieves an array of selected elements.
Returns:
Returns an array of selected elements.
- Type
- Array.<BIM.Element>
-
getSelectedJunctions(element)
-
Retrieves an array of selected junctions in the given element.
Parameters:
Name Type Description elementBIM.Element The element to obtain selection data for.
Returns:
Returns an array of selected junctions.
- Type
- Array.<BIM.Junction>
-
getSelectedSurfaceFacets(surface)
-
Retrieves an array of selected facets in the given surface.
Parameters:
Name Type Description surfacePD.BRep The surface to obtain selection data for.
Returns:
Returns an array of selected facets in this surface.
- Type
- Array.<PD.BRep.Face>
-
getSelectedSurfaces(element)
-
Retrieves an array of selected surfaces in the given element.
Parameters:
Name Type Description elementBIM.Element The element to obtain selection data for.
Returns:
Returns an array of selected surfaces in this element.
- Type
- Array.<BIM.Surface>
-
hasAperture(element, aperture)
-
Checks if the selection set contains the given aperture.
Parameters:
Name Type Description elementBIM.Element The element containing the aperture.
apertureBIM.Aperture The aperture to check for in selection set.
Returns:
Returns true if selection set contains the aperture.
- Type
- boolean
-
hasElement(element)
-
Checks if the selection set contains the given element.
Parameters:
Name Type Description elementBIM.Element The element to check for.
Returns:
Returns true if selection set contains the element.
- Type
- boolean
-
hasJunction(element, junction)
-
Checks if the selection set contains the given junction.
Parameters:
Name Type Description elementBIM.Element The element containing the junction.
junctionBIM.Junction The junction to check for in selection set.
Returns:
Returns true if selection set contains the junction.
- Type
- boolean
-
hasSurface(element, surface)
-
Checks if the selection set contains the given surface.
Parameters:
Name Type Description elementBIM.Element The element containing the surface.
surfaceBIM.Surface The surface to check for in selection set.
Returns:
Returns true if selection set contains the surface.
- Type
- boolean
-
hasSurfaceFacet(surface, facet)
-
Checks if the selection set contains the given facet.
Parameters:
Name Type Description surfacePD.BRep The surface containing the facet.
facetPD.BRep.Face The facet to check for in selection set.
Returns:
Returns true if selection set contains the facet.
- Type
- boolean
-
removeApertures(element, apertures)
-
Removes the given element apertures from the selection set.
Parameters:
Name Type Description elementBIM.Element The element containing the apertures.
aperturesArray.<BIM.Aperture> The array of apertures to remove from selection set.
Returns:
Returns true if any apertures were removed.
- Type
- boolean
-
removeClearCurrentCallback(callback)
-
Add a callback function to be invoked whenever the
clearmethod is called.Parameters:
Name Type Description callbackfunction The callback function added to
PD.SelectionSet#addClearCurrentCallback.Returns:
Returns true if the callback was present and removed.
- Type
- boolean
-
removeElement(element)
-
Removes the given element from the selection set.
Parameters:
Name Type Description elementBIM.Element The element to remove the selection set.
Returns:
Returns true if selection set changed.
- Type
- boolean
-
removeJunctions(element, junctions)
-
Removes the given element junctions from the selection set.
Parameters:
Name Type Description elementBIM.Element The element containing the junctions.
junctionsArray.<BIM.Junction> The array of junctions to remove from selection set.
Returns:
Returns true if any junctions were removed.
- Type
- boolean
-
removeSurfaceFacets(surface, facets)
-
Removes the given element surfaces from the selection set.
Parameters:
Name Type Description surfacePD.BRep The element containing the surfaces.
facetsArray.<PD.BRep.Face> The array of surfaces to remove from selection set.
Returns:
Returns true if any surfaces were removed.
- Type
- boolean
-
removeSurfaces(element, surfaces)
-
Removes the given element surfaces from the selection set.
Parameters:
Name Type Description elementBIM.Element The element containing the surfaces.
surfacesArray.<BIM.Surface> The array of surfaces to remove from selection set.
Returns:
Returns true if any surfaces were removed.
- Type
- boolean
-
setType(type)
-
Sets the type of the currently stored selection data.
If the new type is different from the previous type, the existing selection set will be cleared.
Parameters:
Name Type Description typePD.SELECTED The new type to set.
Returns:
Returns this instance to support method chaining.
- Type
- PD.SelectionSet