Skip to content

Commit 45f8d6f

Browse files
adding small faces options
1 parent f9e2cdb commit 45f8d6f

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed

src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,13 +206,24 @@ def find_missing_faces(self, **kwargs) -> dict: # noqa: D102
206206

207207
@protect_grpc
208208
def find_small_faces(self, **kwargs) -> dict: # noqa: D102
209+
from google.protobuf.wrappers_pb2 import DoubleValue
210+
209211
from ansys.api.geometry.v0.repairtools_pb2 import FindSmallFacesRequest
210212

213+
from ..base.conversions import (
214+
from_measurement_to_server_angle,
215+
from_measurement_to_server_length,
216+
)
217+
211218
# Create the request - assumes all inputs are valid and of the proper type
212219
request = FindSmallFacesRequest(
213220
selection=kwargs["selection"],
214-
area=kwargs["area"],
215-
width=kwargs["width"],
221+
area=DoubleValue(value=from_measurement_to_server_angle(kwargs["area"]))
222+
if kwargs["area"] is not None
223+
else None,
224+
width=DoubleValue(value=from_measurement_to_server_length(kwargs["width"]))
225+
if kwargs["width"] is not None
226+
else None,
216227
)
217228

218229
# Call the gRPC service

src/ansys/geometry/core/tools/repair_tools.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,12 @@ def find_missing_faces(
293293
for res in response.get("problems")
294294
]
295295

296-
def find_small_faces(self, bodies: list["Body"]) -> list[SmallFaceProblemAreas]:
296+
def find_small_faces(
297+
self,
298+
bodies: list["Body"],
299+
area: pint.Quantity | Real | None = None,
300+
width: pint.Quantity | Real | None = None,
301+
) -> list[SmallFaceProblemAreas]:
297302
"""Find the small face problem areas.
298303
299304
This method finds and returns a list of ids of small face problem areas
@@ -303,6 +308,10 @@ def find_small_faces(self, bodies: list["Body"]) -> list[SmallFaceProblemAreas]:
303308
----------
304309
bodies : list[Body]
305310
List of bodies that small faces are investigated on.
311+
area : ~pint.Quantity | Real, optional
312+
Maximum area of the faces. By default, None.
313+
width : ~pint.Quantity | Real, optional
314+
Maximum width of the faces. By default, None.
306315
307316
Returns
308317
-------

0 commit comments

Comments
 (0)