rs3.Selection module#

class rs3.Selection.Selection(client: Client, projectId: str)#

Bases: object

getExternalVolumes(sampleRegion: Geometry, includeIntersecting: bool = True) → list[ExternalVolume]#

Retrieve external volumes that intersect with or are contained within a specified geometric region.

This method performs spatial queries to find external volumes based on different geometric sample regions. The function supports various geometric shapes and can optionally include or exclude volumes that only partially intersect with the sample region.

Parameters:
  • sampleRegion (Geometry) – The geometric region to use for volume selection. Supported types: - Point: Selects volumes containing the specified point - Polyline: Selects volumes intersecting with the polyline path - Cube: Selects volumes within or intersecting the bounding box defined by two corner points - Cylinder: Selects volumes within or intersecting the cylindrical region - Sphere: Selects volumes within or intersecting the spherical region

  • includeIntersecting (bool, optional) –

    Whether to include volumes that only partially intersect with the sample region. Defaults to True. - True: Returns volumes that are fully contained within OR partially intersect the region - False: Returns only volumes that are fully contained within the region

    Note: This parameter only applies to Cube, Cylinder, and Sphere geometry types. For Point and Polyline, this parameter is ignored as the selection behavior is inherently based on intersection/containment.

Returns:

A list of ExternalVolume objects that match the selection criteria. Returns an empty list if no volumes are found.

Return type:

list[ExternalVolume]

Raises:

TypeError – If sampleRegion is not one of the supported Geometry types.

Examples

See External Volume and Selection Script Examples.

>>> # Select volumes containing a specific point
>>> point = Point(20.0, 0.0, -50.0)
>>> volumes = selection.getExternalVolumes(point)
>>> # Select volumes intersecting with a polyline
>>> polyline = Polyline([Point(5.5, -40, -50), Point(25, 5.2, -48), Point(20.5, 50.2, -45)])
>>> volumes = selection.getExternalVolumes(polyline)
>>> # Select volumes within a bounding box (including intersecting)
>>> cube = Cube(Point(18.0, 1.5, -49.2), Point(23.5, 2.5, -47.3))
>>> volumes = selection.getExternalVolumes(cube, includeIntersecting=True)
>>> # Select only volumes fully contained within a bounding box
>>> volumes = selection.getExternalVolumes(cube, includeIntersecting=False)
>>> # Select volumes within a cylindrical region
>>> cylinder = Cylinder(Point(22.12, 45.3, -52.2), Point(25.2, 30.3, -48.4), radius=1.0)
>>> volumes = selection.getExternalVolumes(cylinder)
>>> # Select volumes within a spherical region
>>> sphere = Sphere(Point(18.94, 47.05, -53.83), radius=5.0)
>>> volumes = selection.getExternalVolumes(sphere)
getAttachedExternalVolumes(externalVolume: ExternalVolume) → list[ExternalVolume]#

Examples

See External Volume and Selection Script Examples.

getAttachedExternalVolumesByVolumeName(externalVolumeName: str) → list[ExternalVolume]#

Examples

See External Volume and Selection Script Examples.

getSupportEntities(entityType: SupportTypes, sampleRegion: Cube | Cylinder | Sphere, includeIntersecting: bool = True, stageNumber: int = -1)#

Returns support entities of a specified type that are located within a sampling region.

The sampling region can be defined by one of the supported volume geometries (cube, cylinder, or sphere). By default, support entities that intersect the sampling region are included in the results.

Parameters:
  • entityType (SupportTypes) – The type of support entity to retrieve.

  • sampleRegion (Cube | Cylinder | Sphere) – The geometry used to define the sampling region.

  • includeIntersecting (bool, optional) –

    If True (default), support entities that intersect the sampling region are included. If False, only support entities that are completely contained within the sampling region are returned.

    For support entities composed of multiple components, the intersection test is performed against the overall extent of the entity rather than each individual component. Consequently:

    • A beam entity consisting of multiple beam edges is returned even if the sampling region intersects only the space enclosed by the beam edges.

    • A bolt group or pile group is returned even if the sampling region intersects only the space between the bolts or piles in the group.

  • stageNumber (int, optional) – The stage number from which to retrieve the support entities. Specify -1 (default) to get all support entities that are used in the model regardless of stage.

Returns:

A list of support entity objects corresponding to the specified entityType. The returned list contains one of the following object types:

  • Beam for SupportTypes.BEAM

  • Bolt for SupportTypes.BOLT

  • Joint for SupportTypes.JOINT

  • LiningComposition for SupportTypes.COMPOSITE_LINER

  • Pile for SupportTypes.PILE

Return type:

list

Examples

Retrieve all bolts intersecting a sphere:

>>> sphere = Sphere(Point(0, 0, 0), 5)
>>> bolts = model.getSupportEntities(SupportTypes.BOLT, sphere)

Retrieve beams completely contained within a cube at stage 3:

>>> cube = Cube(Point(0, 0, 0), Point(10, 10, 10))
>>> beams = model.getSupportEntities(
...     SupportTypes.BEAM,
...     cube,
...     includeIntersecting=False,
...     stageNumber=3,
... )