Skip to content

Commit

Permalink
Add field for comprehensive_result
Browse files Browse the repository at this point in the history
  • Loading branch information
mlkaplan36 committed Feb 11, 2025
1 parent e5e4e5f commit 4e39e66
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions src/ansys/geometry/core/tools/repair_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ def find_interferences(
@protect_grpc
@min_backend_version(25, 2, 0)
def find_and_fix_short_edges(
self, bodies: list["Body"], length: Real = 0.0
self, bodies: list["Body"], length: Real = 0.0, comprehensive_result: bool = False
) -> RepairToolMessage:
"""Find and fix the short edge problem areas.
Expand All @@ -473,6 +473,9 @@ def find_and_fix_short_edges(
List of bodies that short edges are investigated on.
length : Real, optional
The maximum length of the edges. By default, 0.0.
comprehensive_result : bool, optional
Determines whether the repair tool will attempt to fix all problem areas at once (false, default), or each individually (true).
Fixing each area individually may take longer, but gives a more comprehensive result about the repair operation's success.
Returns
-------
Expand All @@ -483,6 +486,7 @@ def find_and_fix_short_edges(

check_type_all_elements_in_iterable(bodies, Body)
check_type(length, Real)
check_type(comprehensive_result, bool)

if not bodies:
return RepairToolMessage(False, [], [], 0, 0)
Expand All @@ -491,6 +495,7 @@ def find_and_fix_short_edges(
FindShortEdgesRequest(
selection=[body.id for body in bodies],
max_edge_length=DoubleValue(value=length),
comprehensive=comprehensive_result
)
)

Expand All @@ -507,7 +512,7 @@ def find_and_fix_short_edges(

@protect_grpc
@min_backend_version(25, 2, 0)
def find_and_fix_extra_edges(self, bodies: list["Body"]) -> RepairToolMessage:
def find_and_fix_extra_edges(self, bodies: list["Body"], comprehensive_result: bool = False) -> RepairToolMessage:
"""Find and fix the extra edge problem areas.
Notes
Expand All @@ -520,6 +525,9 @@ def find_and_fix_extra_edges(self, bodies: list["Body"]) -> RepairToolMessage:
List of bodies that short edges are investigated on.
length : Real
The maximum length of the edges.
comprehensive_result : bool, optional
Determines whether the repair tool will attempt to fix all problem areas at once (false, default), or each individually (true).
Fixing each area individually may take longer, but gives a more comprehensive result about the repair operation's success.
Returns
-------
Expand All @@ -529,13 +537,15 @@ def find_and_fix_extra_edges(self, bodies: list["Body"]) -> RepairToolMessage:
from ansys.geometry.core.designer.body import Body

check_type_all_elements_in_iterable(bodies, Body)
check_type(comprehensive_result, bool)

if not bodies:
return RepairToolMessage(False, [], [], 0, 0)

response = self._repair_stub.FindAndFixExtraEdges(
FindExtraEdgesRequest(
selection=[body.id for body in bodies],
comprehensive=comprehensive_result
)
)

Expand All @@ -553,7 +563,7 @@ def find_and_fix_extra_edges(self, bodies: list["Body"]) -> RepairToolMessage:
@protect_grpc
@min_backend_version(25, 2, 0)
def find_and_fix_split_edges(
self, bodies: list["Body"], angle: Real = 0.0, length: Real = 0.0
self, bodies: list["Body"], angle: Real = 0.0, length: Real = 0.0, comprehensive_result: bool = False
) -> RepairToolMessage:
"""Find and fix the split edge problem areas.
Expand All @@ -569,6 +579,10 @@ def find_and_fix_split_edges(
The maximum angle between edges. By default, 0.0.
length : Real, optional
The maximum length of the edges. By default, 0.0.
comprehensive_result : bool, optional
Determines whether the repair tool will attempt to fix all problem areas at once (false, default), or each individually (true).
Fixing each area individually may take longer, but gives a more comprehensive result about the repair operation's success.
Returns
-------
Expand All @@ -580,6 +594,7 @@ def find_and_fix_split_edges(
check_type_all_elements_in_iterable(bodies, Body)
check_type(angle, Real)
check_type(length, Real)
check_type(comprehensive_result, bool)

if not bodies:
return RepairToolMessage(False, [], [], 0, 0)
Expand All @@ -590,7 +605,7 @@ def find_and_fix_split_edges(

response = self._repair_stub.FindAndFixSplitEdges(
FindSplitEdgesRequest(
bodies_or_faces=body_ids, angle=angle_value, distance=length_value
bodies_or_faces=body_ids, angle=angle_value, distance=length_value, comprehensive=comprehensive_result
)
)

Expand Down

0 comments on commit 4e39e66

Please sign in to comment.