FaceSelection#

class ansys.geometry.core.selection_builder.face_selection.FaceSelection(design: ansys.geometry.core.designer.design.Design, grpc_client: ansys.geometry.core.connection.client.GrpcClient, items: list[ansys.geometry.core.designer.face.Face] = None)#

Bases: ansys.geometry.core.selection_builder.typed_selection.TypedSelection

A builder for creating a face selection.

Overview#

get_all_visible_faces

Return all visible faces in the active document.

get_all_faces

Return all faces in the active document.

get_faces_from_named_selection

Return faces belonging to a named selection.

get_faces_with_area

Return faces whose area falls within a range.

get_faces_with_x_location

Return faces whose X-location centroid falls within a range.

get_faces_with_y_location

Return faces whose Y-location centroid falls within a range.

get_faces_with_z_location

Return faces whose Z-location centroid falls within a range.

get_faces_with_color

Return faces that match a specific color.

invert_face_selection

Return all faces not in the given selection.

filter_faces_by_area

Filter faces whose area falls within a range.

filter_faces_max_area

Return the face with the maximum area from the selection.

filter_faces_min_area

Return the face with the minimum area from the selection.

filter_faces_by_perimeter

Filter faces whose perimeter falls within a range.

filter_faces_max_perimeter

Return the face with the maximum perimeter from the selection.

filter_faces_min_perimeter

Return the face with the minimum perimeter from the selection.

filter_faces_by_edge_count

Filter faces whose edge count falls within a range.

filter_faces_max_edge_count

Return the face with the maximum edge count from the selection.

filter_faces_min_edge_count

Return the face with the minimum edge count from the selection.

filter_faces_by_loop_count

Filter faces whose loop count falls within a range.

filter_faces_max_loop_count

Return the face with the maximum loop count from the selection.

filter_faces_min_loop_count

Return the face with the minimum loop count from the selection.

filter_faces_by_number_curves

Filter faces by the count of a specific curve type they contain.

filter_faces_max_number_curves

Return the face with the most curves of a given type.

filter_faces_min_number_curves

Return the face with the fewest curves of a given type.

filter_faces_containing_curve_types

Filter faces that contain specific curve types.

filter_faces_by_color

Filter faces that match a specific color.

filter_faces_area_percentile

Filter faces by area percentile relative to the selection.

filter_faces_perimeter_percentile

Filter faces by perimeter percentile relative to the selection.

filter_faces_edge_count_percentile

Filter faces by edge count percentile relative to the selection.

filter_faces_loop_count_percentile

Filter faces by loop count percentile relative to the selection.

filter_faces_by_number_curves_percentile

Filter faces by the percentile of a curve type count relative to the selection.

extend_to_same_area

Extend the selection with faces that have the same area.

extend_to_same_number_of_edges

Extend the selection with faces that have the same number of edges.

extend_to_same_number_of_loops

Extend the selection with faces that have the same number of loops.

extend_to_same_color

Extend the selection with faces that share the same color.

extend_to_coincident

Extend the selection with faces that are coincident to the selection.

extend_to_coaxial_faces

Extend the selection with faces that are coaxial to the selection.

order_faces_by_area

Return faces sorted by area in ascending order.

order_faces_by_perimeter

Return faces sorted by perimeter in ascending order.

order_faces_by_edge_count

Return faces sorted by edge count in ascending order.

order_faces_by_loop_count

Return faces sorted by loop count in ascending order.

order_faces_by_number_curves

Return faces sorted by the count of a given curve type in ascending order.

group_faces_by_area

Group faces by area.

group_faces_by_perimeter

Group faces by perimeter.

group_faces_by_body

Group faces by their parent body.

group_faces_by_edge_count

Group faces by edge count.

group_faces_by_loop_count

Group faces by loop count.

group_faces_by_color

Group faces by color.

group_faces_by_coincident

Group faces by coincidence.

__add__

Return a new selection that is the union of this selection and another.

__sub__

Return a new selection that is the difference of this selection and another.

__and__

Return a new selection that is the intersection of this selection and another.

Import detail#

from ansys.geometry.core.selection_builder.face_selection import FaceSelection

Method detail#

FaceSelection.__add__(other: FaceSelection) FaceSelection#

Return a new selection that is the union of this selection and another.

FaceSelection.__sub__(other: FaceSelection) FaceSelection#

Return a new selection that is the difference of this selection and another.

FaceSelection.__and__(other: FaceSelection) FaceSelection#

Return a new selection that is the intersection of this selection and another.

FaceSelection.get_all_visible_faces() FaceSelection#

Return all visible faces in the active document.

Returns:
FaceSelection

All visible faces.

FaceSelection.get_all_faces() FaceSelection#

Return all faces in the active document.

Returns:
FaceSelection

All faces.

FaceSelection.get_faces_from_named_selection(name: str) FaceSelection#

Return faces belonging to a named selection.

Parameters:
namestr

Name of the named selection to match.

Returns:
FaceSelection

Faces belonging to the matched named selection.

FaceSelection.get_faces_with_area(min: ansys.geometry.core.misc.measurements.Area | pint.Quantity | numbers.Real, max: ansys.geometry.core.misc.measurements.Area | pint.Quantity | numbers.Real | None = None) FaceSelection#

Return faces whose area falls within a range.

Parameters:
minArea | Quantity | Real

Minimum area (inclusive).

maxArea | Quantity | Real, optional

Maximum area (inclusive). If not provided, no upper bound is applied.

Returns:
FaceSelection

Faces whose area is within the specified range.

FaceSelection.get_faces_with_x_location(range_type: ansys.geometry.core.selection_builder.selection_builder.RangeType = RangeType.RANGETYPE_INTERSECT, min: ansys.geometry.core.misc.measurements.Distance | pint.Quantity | numbers.Real | None = None, max: ansys.geometry.core.misc.measurements.Distance | pint.Quantity | numbers.Real | None = None) FaceSelection#

Return faces whose X-location centroid falls within a range.

Parameters:
range_typeRangeType, default: RangeType.RANGETYPE_INTERSECT

Range type specifier.

minDistance | Quantity | Real, optional

Minimum X-location. If not provided, no lower bound is applied.

maxDistance | Quantity | Real, optional

Maximum X-location. If not provided, no upper bound is applied.

Returns:
FaceSelection

Faces whose X-location is within the specified range.

FaceSelection.get_faces_with_y_location(range_type: ansys.geometry.core.selection_builder.selection_builder.RangeType = RangeType.RANGETYPE_INTERSECT, min: ansys.geometry.core.misc.measurements.Distance | pint.Quantity | numbers.Real | None = None, max: ansys.geometry.core.misc.measurements.Distance | pint.Quantity | numbers.Real | None = None) FaceSelection#

Return faces whose Y-location centroid falls within a range.

Parameters:
range_typeRangeType, default: RangeType.RANGETYPE_INTERSECT

Range type specifier.

minDistance | Quantity | Real, optional

Minimum Y-location. If not provided, no lower bound is applied.

maxDistance | Quantity | Real, optional

Maximum Y-location. If not provided, no upper bound is applied.

Returns:
FaceSelection

Faces whose Y-location is within the specified range.

FaceSelection.get_faces_with_z_location(range_type: ansys.geometry.core.selection_builder.selection_builder.RangeType = RangeType.RANGETYPE_INTERSECT, min: ansys.geometry.core.misc.measurements.Distance | pint.Quantity | numbers.Real | None = None, max: ansys.geometry.core.misc.measurements.Distance | pint.Quantity | numbers.Real | None = None) FaceSelection#

Return faces whose Z-location centroid falls within a range.

Parameters:
range_typeRangeType, default: RangeType.RANGETYPE_INTERSECT

Range type specifier.

minDistance | Quantity | Real, optional

Minimum Z-location. If not provided, no lower bound is applied.

maxDistance | Quantity | Real, optional

Maximum Z-location. If not provided, no upper bound is applied.

Returns:
FaceSelection

Faces whose Z-location is within the specified range.

FaceSelection.get_faces_with_color(color: str | tuple[float, float, float] | tuple[float, float, float, float]) FaceSelection#

Return faces that match a specific color.

Parameters:
colorstr | tuple[float, float, float] | tuple[float, float, float, float]

Color to match. This can be a string representing a color name or a tuple of RGB values in the range [0, 1] (RGBA) or [0, 255] (pure RGB).

Returns:
FaceSelection

Faces with the specified color.

FaceSelection.invert_face_selection(scope: ansys.geometry.core.selection_builder.selection_builder.InvertTopologyScope = InvertTopologyScope.INVERTTOPOLOGYSCOPE_ALL) FaceSelection#

Return all faces not in the given selection.

Parameters:
scopeInvertTopologyScope, default: InvertTopologyScope.INVERTTOPOLOGYSCOPE_ALL

Whether to invert within visible faces or all faces.

Returns:
FaceSelection

Faces that are the inverse of the input selection.

FaceSelection.filter_faces_by_area(min: ansys.geometry.core.misc.measurements.Area | pint.Quantity | numbers.Real, max: ansys.geometry.core.misc.measurements.Area | pint.Quantity | numbers.Real | None = None) FaceSelection#

Filter faces whose area falls within a range.

Parameters:
minArea | Quantity | Real

Minimum area (inclusive).

maxArea | Quantity | Real, optional

Maximum area (inclusive). If not provided, no upper bound is applied.

Returns:
FaceSelection

Faces whose area is within the specified range.

FaceSelection.filter_faces_max_area() FaceSelection#

Return the face with the maximum area from the selection.

Returns:
FaceSelection

Face with the maximum area.

FaceSelection.filter_faces_min_area() FaceSelection#

Return the face with the minimum area from the selection.

Returns:
FaceSelection

Face with the minimum area.

FaceSelection.filter_faces_by_perimeter(min: ansys.geometry.core.misc.measurements.Distance | pint.Quantity | numbers.Real, max: ansys.geometry.core.misc.measurements.Distance | pint.Quantity | numbers.Real | None = None) FaceSelection#

Filter faces whose perimeter falls within a range.

Parameters:
minDistance | Quantity | Real

Minimum perimeter (inclusive).

maxDistance | Quantity | Real, optional

Maximum perimeter (inclusive). If not provided, no upper bound is applied.

Returns:
FaceSelection

Faces whose perimeter is within the specified range.

FaceSelection.filter_faces_max_perimeter() FaceSelection#

Return the face with the maximum perimeter from the selection.

Returns:
FaceSelection

Face with the maximum perimeter.

FaceSelection.filter_faces_min_perimeter() FaceSelection#

Return the face with the minimum perimeter from the selection.

Returns:
FaceSelection

Face with the minimum perimeter.

FaceSelection.filter_faces_by_edge_count(min: int, max: int = None) FaceSelection#

Filter faces whose edge count falls within a range.

Parameters:
minint

Minimum edge count (inclusive).

maxint, optional

Maximum edge count (inclusive). If not provided, no upper bound is applied.

Returns:
FaceSelection

Faces whose edge count is within the specified range.

FaceSelection.filter_faces_max_edge_count() FaceSelection#

Return the face with the maximum edge count from the selection.

Returns:
FaceSelection

Face with the maximum edge count.

FaceSelection.filter_faces_min_edge_count() FaceSelection#

Return the face with the minimum edge count from the selection.

Returns:
FaceSelection

Face with the minimum edge count.

FaceSelection.filter_faces_by_loop_count(min: int, max: int = None) FaceSelection#

Filter faces whose loop count falls within a range.

Parameters:
minint

Minimum loop count (inclusive).

maxint, optional

Maximum loop count (inclusive). If not provided, no upper bound is applied.

Returns:
FaceSelection

Faces whose loop count is within the specified range.

FaceSelection.filter_faces_max_loop_count() FaceSelection#

Return the face with the maximum loop count from the selection.

Returns:
FaceSelection

Face with the maximum loop count.

FaceSelection.filter_faces_min_loop_count() FaceSelection#

Return the face with the minimum loop count from the selection.

Returns:
FaceSelection

Face with the minimum loop count.

FaceSelection.filter_faces_by_number_curves(curve_type: ansys.geometry.core.designer.edge.CurveType, min: int, max: int = None) FaceSelection#

Filter faces by the count of a specific curve type they contain.

Parameters:
curve_typeCurveType

The curve type to count per face.

minint

Minimum count (inclusive).

maxint, optional

Maximum count (inclusive). If not provided, no upper bound is applied.

Returns:
FaceSelection

Faces with a matching count of the specified curve type.

FaceSelection.filter_faces_max_number_curves(curve_type: ansys.geometry.core.designer.edge.CurveType) FaceSelection#

Return the face with the most curves of a given type.

Parameters:
curve_typeCurveType

The curve type to count per face.

Returns:
FaceSelection

Face with the maximum count of the specified curve type.

FaceSelection.filter_faces_min_number_curves(curve_type: ansys.geometry.core.designer.edge.CurveType) FaceSelection#

Return the face with the fewest curves of a given type.

Parameters:
curve_typeCurveType

The curve type to count per face.

Returns:
FaceSelection

Face with the minimum count of the specified curve type.

FaceSelection.filter_faces_containing_curve_types(curve_type: ansys.geometry.core.designer.edge.CurveType, exclusive: bool = False) FaceSelection#

Filter faces that contain specific curve types.

Parameters:
curve_typeCurveType

Curve type that the face must contain.

exclusivebool, default: False

If True, the face must contain only the specified curve type.

Returns:
FaceSelection

Faces containing the specified curve type.

FaceSelection.filter_faces_by_color(color: str | tuple[float, float, float] | tuple[float, float, float, float]) FaceSelection#

Filter faces that match a specific color.

Parameters:
colorstr | tuple[float, float, float] | tuple[float, float, float, float]

Color to match. This can be a string representing a color name or a tuple of RGB values in the range [0, 1] (RGBA) or [0, 255] (pure RGB).

Returns:
FaceSelection

Faces with the specified color.

FaceSelection.filter_faces_area_percentile(min_percentile: float, max_percentile: float) FaceSelection#

Filter faces by area percentile relative to the selection.

Parameters:
min_percentilefloat

Minimum percentile threshold (0–100).

max_percentilefloat

Maximum percentile threshold (0–100).

Returns:
FaceSelection

Faces within the specified area percentile range.

FaceSelection.filter_faces_perimeter_percentile(min_percentile: float, max_percentile: float) FaceSelection#

Filter faces by perimeter percentile relative to the selection.

Parameters:
min_percentilefloat

Minimum percentile threshold (0–100).

max_percentilefloat

Maximum percentile threshold (0–100).

Returns:
FaceSelection

Faces within the specified perimeter percentile range.

FaceSelection.filter_faces_edge_count_percentile(min_percentile: float, max_percentile: float) FaceSelection#

Filter faces by edge count percentile relative to the selection.

Parameters:
min_percentilefloat

Minimum percentile threshold (0–100).

max_percentilefloat

Maximum percentile threshold (0–100).

Returns:
FaceSelection

Faces within the specified edge count percentile range.

FaceSelection.filter_faces_loop_count_percentile(min_percentile: float, max_percentile: float) FaceSelection#

Filter faces by loop count percentile relative to the selection.

Parameters:
min_percentilefloat

Minimum percentile threshold (0–100).

max_percentilefloat

Maximum percentile threshold (0–100).

Returns:
FaceSelection

Faces within the specified loop count percentile range.

FaceSelection.filter_faces_by_number_curves_percentile(curve_type: ansys.geometry.core.designer.edge.CurveType, min_percentile: float, max_percentile: float) FaceSelection#

Filter faces by the percentile of a curve type count relative to the selection.

Parameters:
curve_typeCurveType

The curve type to count per face.

min_percentilefloat

Minimum percentile threshold (0–100).

max_percentilefloat

Maximum percentile threshold (0–100).

Returns:
FaceSelection

Faces within the percentile range for the curve type count.

FaceSelection.extend_to_same_area(scope: ansys.geometry.core.selection_builder.selection_builder.ExtendScope = ExtendScope.EXTENDSCOPE_ALL) FaceSelection#

Extend the selection with faces that have the same area.

Parameters:
scopeExtendScope, default: ExtendScope.EXTENDSCOPE_ALL

Whether to search all faces or only visible ones.

Returns:
FaceSelection

Input faces plus additional faces with matching areas.

FaceSelection.extend_to_same_number_of_edges(scope: ansys.geometry.core.selection_builder.selection_builder.ExtendScope = ExtendScope.EXTENDSCOPE_ALL) FaceSelection#

Extend the selection with faces that have the same number of edges.

Parameters:
scopeExtendScope, default: ExtendScope.EXTENDSCOPE_ALL

Whether to search all faces or only visible ones.

Returns:
FaceSelection

Input faces plus additional faces with the same edge count.

FaceSelection.extend_to_same_number_of_loops(scope: ansys.geometry.core.selection_builder.selection_builder.ExtendScope = ExtendScope.EXTENDSCOPE_ALL) FaceSelection#

Extend the selection with faces that have the same number of loops.

Parameters:
scopeExtendScope, default: ExtendScope.EXTENDSCOPE_ALL

Whether to search all faces or only visible ones.

Returns:
FaceSelection

Input faces plus additional faces with the same loop count.

FaceSelection.extend_to_same_color(scope: ansys.geometry.core.selection_builder.selection_builder.ExtendScope = ExtendScope.EXTENDSCOPE_ALL) FaceSelection#

Extend the selection with faces that share the same color.

Parameters:
scopeExtendScope, default: ExtendScope.EXTENDSCOPE_ALL

Whether to search all faces or only visible ones.

Returns:
FaceSelection

Input faces plus additional faces with matching colors.

FaceSelection.extend_to_coincident(scope: ansys.geometry.core.selection_builder.selection_builder.ExtendScope = ExtendScope.EXTENDSCOPE_ALL) FaceSelection#

Extend the selection with faces that are coincident to the selection.

Parameters:
scopeExtendScope, default: ExtendScope.EXTENDSCOPE_ALL

Whether to search all faces or only visible ones.

Returns:
FaceSelection

Input faces plus additional coincident faces.

FaceSelection.extend_to_coaxial_faces(scope: ansys.geometry.core.selection_builder.selection_builder.ExtendScope = ExtendScope.EXTENDSCOPE_ALL) FaceSelection#

Extend the selection with faces that are coaxial to the selection.

Parameters:
scopeExtendScope, default: ExtendScope.EXTENDSCOPE_ALL

Whether to search all faces or only visible ones.

Returns:
FaceSelection

Input faces plus additional coaxial faces.

FaceSelection.order_faces_by_area() FaceSelection#

Return faces sorted by area in ascending order.

Returns:
FaceSelection

Faces ordered from smallest to largest area.

FaceSelection.order_faces_by_perimeter() FaceSelection#

Return faces sorted by perimeter in ascending order.

Returns:
FaceSelection

Faces ordered from smallest to largest perimeter.

FaceSelection.order_faces_by_edge_count() FaceSelection#

Return faces sorted by edge count in ascending order.

Returns:
FaceSelection

Faces ordered from fewest to most edges.

FaceSelection.order_faces_by_loop_count() FaceSelection#

Return faces sorted by loop count in ascending order.

Returns:
FaceSelection

Faces ordered from fewest to most loops.

FaceSelection.order_faces_by_number_curves(curve_type: ansys.geometry.core.designer.edge.CurveType) FaceSelection#

Return faces sorted by the count of a given curve type in ascending order.

Parameters:
curve_typeCurveType

The curve type to count per face.

Returns:
FaceSelection

Faces ordered from fewest to most curves of the given type.

FaceSelection.group_faces_by_area() list[FaceSelection]#

Group faces by area.

Returns:
list[FaceSelection]

Faces partitioned into groups with the same area.

FaceSelection.group_faces_by_perimeter() list[FaceSelection]#

Group faces by perimeter.

Returns:
list[FaceSelection]

Faces partitioned into groups with the same perimeter.

FaceSelection.group_faces_by_body() list[FaceSelection]#

Group faces by their parent body.

Returns:
list[FaceSelection]

Faces partitioned into groups by parent body.

FaceSelection.group_faces_by_edge_count() list[FaceSelection]#

Group faces by edge count.

Returns:
list[FaceSelection]

Faces partitioned into groups with the same edge count.

FaceSelection.group_faces_by_loop_count() list[FaceSelection]#

Group faces by loop count.

Returns:
list[FaceSelection]

Faces partitioned into groups with the same loop count.

FaceSelection.group_faces_by_color() list[FaceSelection]#

Group faces by color.

Returns:
list[FaceSelection]

Faces partitioned into groups sharing the same color.

FaceSelection.group_faces_by_coincident() list[FaceSelection]#

Group faces by coincidence.

Returns:
list[FaceSelection]

Faces partitioned into groups of coincident faces.