PrepareTools#

class ansys.geometry.core.tools.prepare_tools.PrepareTools(grpc_client: ansys.geometry.core.connection.GrpcClient, _internal_use: bool = False)#

Prepare tools for PyAnsys Geometry.

Parameters:
grpc_clientGrpcClient

Active supporting geometry service instance for design modeling.

_internal_usebool, optional

Internal flag to prevent direct instantiation by users. This parameter is for internal use only.

Raises:
GeometryRuntimeError

If the class is instantiated directly by users instead of through the modeler.

Notes

This class should not be instantiated directly. Use modeler.prepare_tools instead.

Overview#

extract_volume_from_faces

Extract a volume from input faces.

extract_volume_from_edge_loops

Extract a volume from input edge loops.

remove_rounds

Remove rounds from geometry.

share_topology

Share topology between the chosen bodies.

enhanced_share_topology

Share topology between the chosen bodies.

find_logos

Detect logos in geometry.

find_and_remove_logos

Detect and remove logos in geometry.

detect_helixes

Detect helixes in the given bodies.

create_box_enclosure

Create box enclosure around the given bodies.

create_cylinder_enclosure

Create cylinder enclosure around the given bodies.

create_sphere_enclosure

Create sphere enclosure around the given bodies.

detect_sweepable_bodies

Check if bodies are sweepable.

find_mappable_faces

Find which faces are mappable.

Import detail#

from ansys.geometry.core.tools.prepare_tools import PrepareTools

Method detail#

PrepareTools.extract_volume_from_faces(sealing_faces: list[ansys.geometry.core.designer.face.Face], inside_faces: list[ansys.geometry.core.designer.face.Face]) list[ansys.geometry.core.designer.body.Body]#

Extract a volume from input faces.

Creates a volume (typically a flow volume) from a list of faces that seal the volume and one or more faces that define the wetted surface (inside faces of the solid).

Parameters:
sealing_faceslist[Face]

List of faces that seal the volume.

inside_faceslist[Face]

List of faces that define the interior of the solid.

Returns:
list[Body]

List of created bodies.

Warning

This method is only available starting on Ansys release 25R1.

PrepareTools.extract_volume_from_edge_loops(sealing_edges: list[ansys.geometry.core.designer.edge.Edge], inside_faces: list[ansys.geometry.core.designer.face.Face] = None) list[ansys.geometry.core.designer.body.Body]#

Extract a volume from input edge loops.

Creates a volume (typically a flow volume) from a list of edge loops that seal the volume. and one or more faces that define the wetted surface (inside faces of the solid).

Parameters:
sealing_edgeslist[Edge]

List of faces that seal the volume.

inside_faceslist[Face], optional

List of faces that define the interior of the solid (not always necessary).

Returns:
list[Body]

List of created bodies.

Warning

This method is only available starting on Ansys release 25R1.

PrepareTools.remove_rounds(faces: list[ansys.geometry.core.designer.face.Face], auto_shrink: bool = False) bool#

Remove rounds from geometry.

Tries to remove rounds from geometry. Faces to be removed are input to the method.

Parameters:
round_faceslist[Face]

List of rounds faces to be removed

auto_shrinkbool, default: False

Whether to shrink the geometry after removing rounds. Fills in the gaps left by the removed rounds.

Returns:
bool

True if successful, False if failed.

PrepareTools.share_topology(bodies: list[ansys.geometry.core.designer.body.Body], tol: ansys.geometry.core.misc.measurements.Distance | pint.Quantity | ansys.geometry.core.typing.Real = 0.0, preserve_instances: bool = False) bool#

Share topology between the chosen bodies.

Parameters:
bodieslist[Body]

List of bodies to share topology between.

tolDistance | Quantity | Real

Maximum distance between bodies.

preserve_instancesbool

Whether instances are preserved.

Returns:
bool

True if successful, False if failed.

Warning

This method is only available starting on Ansys release 24R2.

PrepareTools.enhanced_share_topology(bodies: list[ansys.geometry.core.designer.body.Body], tol: ansys.geometry.core.misc.measurements.Distance | pint.Quantity | ansys.geometry.core.typing.Real = 0.0, preserve_instances: bool = False) ansys.geometry.core.tools.repair_tool_message.RepairToolMessage#

Share topology between the chosen bodies.

Parameters:
bodieslist[Body]

List of bodies to share topology between.

tolDistance | Quantity | Real

Maximum distance between bodies.

preserve_instancesbool

Whether instances are preserved.

Returns:
RepairToolMessage

Message containing number of problem areas found/fixed, created and/or modified bodies.

Warning

This method is only available starting on Ansys release 25R2.

PrepareTools.find_logos(bodies: list[ansys.geometry.core.designer.body.Body] = None, min_height: ansys.geometry.core.misc.measurements.Distance | pint.Quantity | ansys.geometry.core.typing.Real = None, max_height: ansys.geometry.core.misc.measurements.Distance | pint.Quantity | ansys.geometry.core.typing.Real = None) ansys.geometry.core.tools.problem_areas.LogoProblemArea#

Detect logos in geometry.

Detects logos, using a list of bodies if provided. The logos are returned as a list of faces.

Parameters:
bodieslist[Body], optional

List of bodies where logos should be detected

min_heightDistance | Quantity | Real, optional

The minimum height when searching for logos

max_height: Distance | Quantity | Real, optional

The minimum height when searching for logos

Returns:
LogoProblemArea

Problem area with logo faces.

Warning

This method is only available starting on Ansys release 25R2.

PrepareTools.find_and_remove_logos(bodies: list[ansys.geometry.core.designer.body.Body] = None, min_height: ansys.geometry.core.misc.measurements.Distance | pint.Quantity | ansys.geometry.core.typing.Real = None, max_height: ansys.geometry.core.misc.measurements.Distance | pint.Quantity | ansys.geometry.core.typing.Real = None) bool#

Detect and remove logos in geometry.

Detects and remove logos, using a list of bodies if provided.

Parameters:
bodieslist[Body], optional

List of bodies where logos should be detected and removed.

min_heightDistance | Quantity | Real, optional

The minimum height when searching for logos

max_height: Distance | Quantity | Real, optional

The maximum height when searching for logos

Returns:
Boolean value indicating whether the operation was successful.

Warning

This method is only available starting on Ansys release 25R2.

PrepareTools.detect_helixes(bodies: list[ansys.geometry.core.designer.body.Body], min_radius: ansys.geometry.core.misc.measurements.Distance | pint.Quantity | ansys.geometry.core.typing.Real = 0.0, max_radius: ansys.geometry.core.misc.measurements.Distance | pint.Quantity | ansys.geometry.core.typing.Real = 100.0, fit_radius_error: ansys.geometry.core.misc.measurements.Distance | pint.Quantity | ansys.geometry.core.typing.Real = 0.01) dict[ansys.geometry.core.shapes.curves.trimmed_curve.TrimmedCurve, list[ansys.geometry.core.designer.edge.Edge]]#

Detect helixes in the given bodies.

Parameters:
bodieslist[Body]

List of bodies to detect helixes in.

min_radiusDistance, Quantity, or Real, default: 0.0

Minimum radius of the helix to be detected.

max_radiusDistance, Quantity, or Real, default: 1e6

Maximum radius of the helix to be detected.

fit_radius_errorDistance, Quantity, or Real, default: 0.01

Maximum fit radius error of the helix to be detected.

Returns:
dict

Dictionary with key “helixes” containing a list of detected helixes. Each helix is represented as a dictionary with keys “trimmed_curve” and “edges”.

Warning

This method is only available starting on Ansys release 26R1.

PrepareTools.create_box_enclosure(bodies: list[ansys.geometry.core.designer.body.Body], x_low: ansys.geometry.core.misc.measurements.Distance | pint.Quantity | ansys.geometry.core.typing.Real, x_high: ansys.geometry.core.misc.measurements.Distance | pint.Quantity | ansys.geometry.core.typing.Real, y_low: ansys.geometry.core.misc.measurements.Distance | pint.Quantity | ansys.geometry.core.typing.Real, y_high: ansys.geometry.core.misc.measurements.Distance | pint.Quantity | ansys.geometry.core.typing.Real, z_low: ansys.geometry.core.misc.measurements.Distance | pint.Quantity | ansys.geometry.core.typing.Real, z_high: ansys.geometry.core.misc.measurements.Distance | pint.Quantity | ansys.geometry.core.typing.Real, enclosure_options: EnclosureOptions) list[ansys.geometry.core.designer.body.Body]#

Create box enclosure around the given bodies.

Parameters:
bodieslist[Body]

List of bodies to create enclosure around.

x_lowDistance | Quantity | Real

The lowest distance from the bodies in the x direction.

x_highDistance | Quantity | Real

The highest distance from the bodies in the x direction.

y_lowDistance | Quantity | Real

The lowest distance from the bodies in the y direction.

y_highDistance | Quantity | Real

The highest distance from the bodies in the y direction.

z_lowDistance | Quantity | Real

The lowest distance from the bodies in the z direction.

z_highDistance | Quantity | Real

The highest distance from the bodies in the z direction.

enclosure_optionsEnclosureOptions

Options that define how the enclosure is included in the design.

Returns:
list[Body]

List of created bodies.

Warning

This method is only available starting on Ansys release 26R1.

PrepareTools.create_cylinder_enclosure(bodies: list[ansys.geometry.core.designer.body.Body], axial_distance_low: ansys.geometry.core.misc.measurements.Distance | pint.Quantity | ansys.geometry.core.typing.Real, axial_distance_high: ansys.geometry.core.misc.measurements.Distance | pint.Quantity | ansys.geometry.core.typing.Real, radial_distance: ansys.geometry.core.misc.measurements.Distance | pint.Quantity | ansys.geometry.core.typing.Real, enclosure_options: EnclosureOptions) list[ansys.geometry.core.designer.body.Body]#

Create cylinder enclosure around the given bodies.

Parameters:
bodieslist[Body]

List of bodies to create enclosure around.

axial_distance_lowDistance | Quantity | Real

The lowest axial distance from the bodies.

axial_distance_highDistance | Quantity | Real

The highest axial distance from the bodies.

radial_distanceDistance | Quantity | Real

The radial distance from the bodies.

enclosure_optionsEnclosureOptions

Options that define how the enclosure is included in the design.

Returns:
list[Body]

List of created bodies.

Warning

This method is only available starting on Ansys release 26R1.

PrepareTools.create_sphere_enclosure(bodies: list[ansys.geometry.core.designer.body.Body], radial_distance: ansys.geometry.core.misc.measurements.Distance | pint.Quantity | ansys.geometry.core.typing.Real, enclosure_options: EnclosureOptions) list[ansys.geometry.core.designer.body.Body]#

Create sphere enclosure around the given bodies.

Parameters:
bodieslist[Body]

List of bodies to create enclosure around.

radial_distanceDistance | Quantity | Real

The radial distance from the bodies.

enclosure_optionsEnclosureOptions

Options that define how the enclosure is included in the design.

Returns:
list[Body]

List of created bodies.

Warning

This method is only available starting on Ansys release 26R1.

PrepareTools.detect_sweepable_bodies(bodies: list[ansys.geometry.core.designer.body.Body], get_source_target_faces: bool = False) list[tuple[bool, list[ansys.geometry.core.designer.face.Face]]]#

Check if bodies are sweepable.

Parameters:
bodieslist[Body]

List of bodies to check.

get_source_target_facesbool

Whether to get source and target faces. By default, False.

Returns:
list[tuple[bool, list[Face]]]

List of tuples, each containing a boolean indicating if the body is sweepable and a list of source and target faces if requested.

PrepareTools.find_mappable_faces(faces: list[ansys.geometry.core.designer.face.Face]) list[tuple[ansys.geometry.core.designer.face.Face, bool]]#

Find which faces are mappable.

Queries the server to determine which of the provided faces are mappable, meaning they can be used as source or target faces for mesh mapping operations.

Parameters:
faceslist[Face]

List of faces to check.

Returns:
list[tuple[Face, bool]]

List of tuples pairing each face with a boolean indicating whether it is mappable (True) or not (False).

Warning

This method is only available starting on Ansys release 26R1.