From 51671c61a84d9fb852682ea92817a9d5f9c086c0 Mon Sep 17 00:00:00 2001 From: Umut Soysal Date: Mon, 14 Apr 2025 18:43:52 -0500 Subject: [PATCH 01/58] repair tools refactoring --- .../geometry/core/_grpc/_services/_service.py | 10 ++ .../core/_grpc/_services/base/repair_tools.py | 67 +++++++++ .../core/_grpc/_services/v0/repair_tools.py | 142 ++++++++++++++++++ .../core/_grpc/_services/v1/repair_tools.py | 56 +++++++ src/ansys/geometry/core/tools/repair_tools.py | 120 ++++++--------- 5 files changed, 317 insertions(+), 78 deletions(-) create mode 100644 src/ansys/geometry/core/_grpc/_services/base/repair_tools.py create mode 100644 src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py create mode 100644 src/ansys/geometry/core/_grpc/_services/v1/repair_tools.py diff --git a/src/ansys/geometry/core/_grpc/_services/_service.py b/src/ansys/geometry/core/_grpc/_services/_service.py index 26a106279e..2a52d2a581 100644 --- a/src/ansys/geometry/core/_grpc/_services/_service.py +++ b/src/ansys/geometry/core/_grpc/_services/_service.py @@ -27,6 +27,7 @@ from .base.bodies import GRPCBodyService from .base.dbuapplication import GRPCDbuApplicationService from .base.named_selection import GRPCNamedSelectionService +from .base.repair_tools import GRPCRepairToolsService class _GRPCServices: @@ -71,6 +72,7 @@ def __init__(self, channel: grpc.Channel, version: GeometryApiProtos | str | Non self._bodies = None self._dbu_application = None self._named_selection = None + self._repair_tools = None @property def bodies(self) -> GRPCBodyService: @@ -175,3 +177,11 @@ def named_selection(self) -> GRPCNamedSelectionService: raise ValueError(f"Unsupported version: {self.version}") return self._named_selection + + @property + def repair_tools(self) -> GRPCRepairToolsService: + if not self._repair_tools: + from .v0.repair_tools import GRPCRepairToolsServiceV0 + # TODO: Add V1 later + self._repair_tools = GRPCRepairToolsServiceV0(self.channel) + return self._repair_tools diff --git a/src/ansys/geometry/core/_grpc/_services/base/repair_tools.py b/src/ansys/geometry/core/_grpc/_services/base/repair_tools.py new file mode 100644 index 0000000000..ae97e61742 --- /dev/null +++ b/src/ansys/geometry/core/_grpc/_services/base/repair_tools.py @@ -0,0 +1,67 @@ +# Copyright (C) 2023 - 2025 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. +"""Module containing the repair tools service implementation (abstraction layer).""" + +from abc import ABC, abstractmethod + +import grpc + + +from abc import ABC, abstractmethod +import grpc + +class GRPCRepairToolsService(ABC): + def __init__(self, channel: grpc.Channel): + pass + + @abstractmethod + def find_split_edges(self, **kwargs): ... + @abstractmethod + def find_extra_edges(self, **kwargs): ... + @abstractmethod + def find_inexact_edges(self, **kwargs): ... + @abstractmethod + def find_short_edges(self, **kwargs): ... + @abstractmethod + def find_duplicate_faces(self, **kwargs): ... + @abstractmethod + def find_missing_faces(self, **kwargs): ... + @abstractmethod + def find_small_faces(self, **kwargs): ... + @abstractmethod + def find_stitch_faces(self, **kwargs): ... + @abstractmethod + def find_simplify(self, **kwargs): ... + @abstractmethod + def find_interferences(self, **kwargs): ... + @abstractmethod + def find_and_fix_short_edges(self, **kwargs): ... + @abstractmethod + def find_and_fix_extra_edges(self, **kwargs): ... + @abstractmethod + def find_and_fix_split_edges(self, **kwargs): ... + @abstractmethod + def find_and_fix_simplify(self, **kwargs): ... + @abstractmethod + def inspect_geometry(self, **kwargs): ... + @abstractmethod + def repair_geometry(self, **kwargs): ... diff --git a/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py b/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py new file mode 100644 index 0000000000..82a35b40ca --- /dev/null +++ b/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py @@ -0,0 +1,142 @@ +# Copyright (C) 2023 - 2025 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. +"""Module containing the repair tools service implementation (abstraction layer). + +This module defines an abstract base class for a gRPC-based repair tools service. +The class provides a set of abstract methods for identifying and repairing various +geometry issues, such as split edges, extra edges, duplicate faces, and more. +""" + +from abc import ABC, abstractmethod +import grpc +from ..base.repair_tools import GRPCRepairToolsService +from ansys.geometry.core.errors import protect_grpc +from google.protobuf.wrappers_pb2 import BoolValue, DoubleValue + + + +class GRPCRepairToolsServiceV0(GRPCRepairToolsService): + + @protect_grpc + def __init__(self, channel: grpc.Channel): + from ansys.api.geometry.v0.repairtools_pb2_grpc import RepairToolsStub + + self.stub = RepairToolsStub(channel) + + @protect_grpc + def find_split_edges(self, **kwargs): + + from ansys.api.geometry.v0.repairtools_pb2 import FindSplitEdgesRequest + + request = FindSplitEdgesRequest( + bodies_or_faces=kwargs["bodies_or_faces"], + angle=kwargs["angle"], + distance=kwargs["distance"], + ) + return self.stub.FindSplitEdges(request) + + @protect_grpc + def find_extra_edges(self, **kwargs): + from ansys.api.geometry.v0.repairtools_pb2 import FindExtraEdgesRequest + request = FindExtraEdgesRequest(selection=kwargs["selection"]) + return self.stub.FindExtraEdges(request) + + @protect_grpc + def find_inexact_edges(self, **kwargs): + from ansys.api.geometry.v0.repairtools_pb2 import FindInexactEdgesRequest + request = FindInexactEdgesRequest(selection=kwargs["selection"]) + return self.stub.FindInexactEdges(request) + + + @protect_grpc + def find_short_edges(self, **kwargs): + from ansys.api.geometry.v0.repairtools_pb2 import FindShortEdgesRequest + request = FindShortEdgesRequest( + selection=kwargs["selection"], + max_edge_length=DoubleValue(value=kwargs["length"]), + ) + return self.stub.FindShortEdges(request) + + @protect_grpc + def find_duplicate_faces(self, **kwargs): + from ansys.api.geometry.v0.repairtools_pb2 import FindDuplicateFacesRequest + request = FindDuplicateFacesRequest(faces=kwargs["faces"]) + return self.stub.FindDuplicateFaces(request) + + + @protect_grpc + def find_missing_faces(self, **kwargs): + from ansys.api.geometry.v0.repairtools_pb2 import FindMissingFacesRequest + request = FindMissingFacesRequest(faces=kwargs["faces"]) + return self.stub.FindMissingFaces(request) + + @protect_grpc + def find_small_faces(self, **kwargs): + from ansys.api.geometry.v0.repairtools_pb2 import FindSmallFacesRequest + request = FindSmallFacesRequest(selection=kwargs["selection"]) + return self.stub.FindSmallFaces(request) + + @protect_grpc + def find_stitch_faces(self, **kwargs): + from ansys.api.geometry.v0.repairtools_pb2 import FindStitchFacesRequest + request = FindStitchFacesRequest(faces=kwargs["faces"]) + return self.stub.FindStitchFaces(request) + + @protect_grpc + def find_simplify(self, **kwargs): + from ansys.api.geometry.v0.repairtools_pb2 import FindAdjustSimplifyRequest + request = FindAdjustSimplifyRequest(selection=kwargs["selection"]) + return self.stub.FindAdjustSimplify(request) + + @protect_grpc + def find_and_fix_simplify(self, **kwargs): + from ansys.api.geometry.v0.repairtools_pb2 import FindAdjustSimplifyRequest + request = FindAdjustSimplifyRequest( + selection=kwargs["selection"], + comprehensive=kwargs["comprehensive_result"], + ) + return self.stub.FindAndSimplify(request) + + @protect_grpc + def inspect_geometry(self, **kwargs): + from ansys.api.geometry.v0.repairtools_pb2 import InspectGeometryRequest + request = InspectGeometryRequest(bodies=kwargs.get("bodies", [])) + return self.stub.InspectGeometry(request) + + @protect_grpc + def repair_geometry(self, **kwargs): + from ansys.api.geometry.v0.repairtools_pb2 import RepairGeometryRequest + request = RepairGeometryRequest(bodies=kwargs.get("bodies", [])) + return self.stub.RepairGeometry(request) + + @protect_grpc + def find_interferences(self, **kwargs): + from ansys.api.geometry.v0.repairtools_pb2 import FindInterferenceRequest + request = FindInterferenceRequest( + bodies=kwargs["bodies"], + cut_smaller_body=BoolValue(value=kwargs["cut_smaller_body"]), + ) + return self.stub.FindInterference(request) + + def find_and_fix_short_edges(self, **kwargs): raise NotImplementedError + def find_and_fix_extra_edges(self, **kwargs): raise NotImplementedError + def find_and_fix_split_edges(self, **kwargs): raise NotImplementedError \ No newline at end of file diff --git a/src/ansys/geometry/core/_grpc/_services/v1/repair_tools.py b/src/ansys/geometry/core/_grpc/_services/v1/repair_tools.py new file mode 100644 index 0000000000..6af59514c3 --- /dev/null +++ b/src/ansys/geometry/core/_grpc/_services/v1/repair_tools.py @@ -0,0 +1,56 @@ +# Copyright (C) 2023 - 2025 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. +"""Module containing the repair tools service implementation (abstraction layer).""" + +from abc import ABC, abstractmethod + +import grpc + + +class GRPCRepairToolsServiceV1(ABC): + """Repair tools service for gRPC communication with the Geometry server. + Parameters + ---------- + channel : grpc.Channel + The gRPC channel to the server. + """ + + def __init__(self, channel: grpc.Channel): + """Initialize the MeasurementToolsService class.""" + pass # pragma: no cover + + def find_split_edges(self, **kwargs): raise NotImplementedError + def find_extra_edges(self, **kwargs): raise NotImplementedError + def find_inexact_edges(self, **kwargs): raise NotImplementedError + def find_short_edges(self, **kwargs): raise NotImplementedError + def find_duplicate_faces(self, **kwargs): raise NotImplementedError + def find_missing_faces(self, **kwargs): raise NotImplementedError + def find_small_faces(self, **kwargs): raise NotImplementedError + def find_stitch_faces(self, **kwargs): raise NotImplementedError + def find_simplify(self, **kwargs): raise NotImplementedError + def find_interferences(self, **kwargs): raise NotImplementedError + def find_and_fix_short_edges(self, **kwargs): raise NotImplementedError + def find_and_fix_extra_edges(self, **kwargs): raise NotImplementedError + def find_and_fix_split_edges(self, **kwargs): raise NotImplementedError + def find_and_fix_simplify(self, **kwargs): raise NotImplementedError + def inspect_geometry(self, **kwargs): raise NotImplementedError + def repair_geometry(self, **kwargs): raise NotImplementedError \ No newline at end of file diff --git a/src/ansys/geometry/core/tools/repair_tools.py b/src/ansys/geometry/core/tools/repair_tools.py index 8bb984088f..8062a2e7fb 100644 --- a/src/ansys/geometry/core/tools/repair_tools.py +++ b/src/ansys/geometry/core/tools/repair_tools.py @@ -31,20 +31,7 @@ InspectGeometryResult, InspectGeometryResultIssue, ) -from ansys.api.geometry.v0.repairtools_pb2 import ( - FindAdjustSimplifyRequest, - FindDuplicateFacesRequest, - FindExtraEdgesRequest, - FindInexactEdgesRequest, - FindInterferenceRequest, - FindMissingFacesRequest, - FindShortEdgesRequest, - FindSmallFacesRequest, - FindSplitEdgesRequest, - FindStitchFacesRequest, - InspectGeometryRequest, - RepairGeometryRequest, -) + from ansys.api.geometry.v0.repairtools_pb2_grpc import RepairToolsStub from ansys.geometry.core.connection import GrpcClient from ansys.geometry.core.errors import protect_grpc @@ -119,11 +106,10 @@ def find_split_edges( length_value = DoubleValue(value=float(length)) body_ids = [body.id for body in bodies] - problem_areas_response = self._repair_stub.FindSplitEdges( - FindSplitEdgesRequest( - bodies_or_faces=body_ids, angle=angle_value, distance=length_value - ) + problem_areas_response = self._grpc_client.services.repair_tools.find_split_edges( + bodies_or_faces=body_ids, angle=angle_value, distance=length_value ) + parent_design = get_design_from_body(bodies[0]) return [ SplitEdgeProblemAreas( @@ -155,9 +141,7 @@ def find_extra_edges(self, bodies: list["Body"]) -> list[ExtraEdgeProblemAreas]: return [] body_ids = [body.id for body in bodies] - problem_areas_response = self._repair_stub.FindExtraEdges( - FindExtraEdgesRequest(selection=body_ids) - ) + problem_areas_response = self._grpc_client.services.repair_tools.find_extra_edges(selection=body_ids) parent_design = get_design_from_body(bodies[0]) return [ @@ -190,9 +174,7 @@ def find_inexact_edges(self, bodies: list["Body"]) -> list[InexactEdgeProblemAre return [] body_ids = [body.id for body in bodies] - problem_areas_response = self._repair_stub.FindInexactEdges( - FindInexactEdgesRequest(selection=body_ids) - ) + problem_areas_response = self._grpc_client.services.repair_tools.find_inexact_edges(selection=body_ids) parent_design = get_design_from_body(bodies[0]) @@ -227,12 +209,10 @@ def find_short_edges( if not bodies: return [] - problem_areas_response = self._repair_stub.FindShortEdges( - FindShortEdgesRequest( - selection=[body.id for body in bodies], - max_edge_length=DoubleValue(value=length), - ) - ) + body_ids = [body.id for body in bodies] + + problem_areas_response = self._grpc_client.services.repair_tools.find_short_edges( + selection=body_ids, length=length) parent_design = get_design_from_body(bodies[0]) return [ @@ -265,9 +245,7 @@ def find_duplicate_faces(self, bodies: list["Body"]) -> list[DuplicateFaceProble return [] body_ids = [body.id for body in bodies] - problem_areas_response = self._repair_stub.FindDuplicateFaces( - FindDuplicateFacesRequest(faces=body_ids) - ) + problem_areas_response = self._grpc_client.services.repair_tools.find_duplicate_faces(faces=body_ids) parent_design = get_design_from_body(bodies[0]) return [ @@ -299,9 +277,7 @@ def find_missing_faces(self, bodies: list["Body"]) -> list[MissingFaceProblemAre if not bodies: return [] body_ids = [body.id for body in bodies] - problem_areas_response = self._repair_stub.FindMissingFaces( - FindMissingFacesRequest(faces=body_ids) - ) + problem_areas_response = self._grpc_client.services.repair_tools.find_missing_faces(faces=body_ids) parent_design = get_design_from_body(bodies[0]) return [ @@ -334,9 +310,7 @@ def find_small_faces(self, bodies: list["Body"]) -> list[SmallFaceProblemAreas]: return [] body_ids = [body.id for body in bodies] - problem_areas_response = self._repair_stub.FindSmallFaces( - FindSmallFacesRequest(selection=body_ids) - ) + problem_areas_response = self._grpc_client.services.repair_tools.find_small_faces(selection=body_ids) parent_design = get_design_from_body(bodies[0]) return [ @@ -366,9 +340,7 @@ def find_stitch_faces(self, bodies: list["Body"]) -> list[StitchFaceProblemAreas List of objects representing stitch face problem areas. """ body_ids = [body.id for body in bodies] - problem_areas_response = self._repair_stub.FindStitchFaces( - FindStitchFacesRequest(faces=body_ids) - ) + problem_areas_response = self._grpc_client.services.repair_tools.find_stitch_faces(faces=body_ids) parent_design = get_design_from_body(bodies[0]) return [ StitchFaceProblemAreas( @@ -400,11 +372,7 @@ def find_simplify(self, bodies: list["Body"]) -> list[UnsimplifiedFaceProblemAre body_ids = [body.id for body in bodies] parent_design = get_design_from_body(bodies[0]) - problem_areas_response = self._repair_stub.FindAdjustSimplify( - FindAdjustSimplifyRequest( - selection=body_ids, - ) - ) + problem_areas_response = self._grpc_client.services.repair_tools.find_simplify(selection=body_ids) return [ UnsimplifiedFaceProblemAreas( @@ -452,9 +420,10 @@ def find_interferences( parent_design = get_design_from_body(bodies[0]) body_ids = [body.id for body in bodies] cut_smaller_body_bool = BoolValue(value=cut_smaller_body) - problem_areas_response = self._repair_stub.FindInterference( - FindInterferenceRequest(bodies=body_ids, cut_smaller_body=cut_smaller_body_bool) - ) + problem_areas_response = self._grpc_client.services.repair_tools.find_interferences( + bodies=body_ids, + cut_smaller_body=cut_smaller_body_bool, + ) return [ InterferenceProblemAreas( @@ -500,13 +469,13 @@ def find_and_fix_short_edges( if not bodies: return RepairToolMessage(False, [], [], 0, 0) - response = self._repair_stub.FindAndFixShortEdges( - FindShortEdgesRequest( - selection=[body.id for body in bodies], - max_edge_length=DoubleValue(value=length), - comprehensive=comprehensive_result, - ) - ) + body_ids = [body.id for body in bodies] + + response = self._grpc_client.services.repair_tools.find_and_fix_short_edges( + selection=body_ids, + length=length, + comprehensive_result=comprehensive_result, + ) parent_design = get_design_from_body(bodies[0]) parent_design._update_design_inplace() @@ -553,10 +522,10 @@ def find_and_fix_extra_edges( if not bodies: return RepairToolMessage(False, [], [], 0, 0) - response = self._repair_stub.FindAndFixExtraEdges( - FindExtraEdgesRequest( - selection=[body.id for body in bodies], comprehensive=comprehensive_result - ) + body_ids = [body.id for body in bodies] + response = self._grpc_client.services.repair_tools.find_and_fix_extra_edges( + selection=body_ids, + comprehensive_result=comprehensive_result, ) parent_design = get_design_from_body(bodies[0]) @@ -615,14 +584,12 @@ def find_and_fix_split_edges( angle_value = DoubleValue(value=float(angle)) length_value = DoubleValue(value=float(length)) body_ids = [body.id for body in bodies] - - response = self._repair_stub.FindAndFixSplitEdges( - FindSplitEdgesRequest( - bodies_or_faces=body_ids, - angle=angle_value, - distance=length_value, - comprehensive=comprehensive_result, - ) + + response = self._grpc_client.services.repair_tools.find_and_fix_split_edges( + bodies_or_faces=body_ids, + angle=angle_value, + length=length_value, + comprehensive_result=comprehensive_result, ) parent_design = get_design_from_body(bodies[0]) @@ -670,9 +637,10 @@ def find_and_fix_simplify( body_ids = [body.id for body in bodies] - response = self._repair_stub.FindAndSimplify( - FindAdjustSimplifyRequest(selection=body_ids, comprehensive=comprehensive_result) - ) + response = self._grpc_client.services.repair_tools.find_and_fix_simplify( + selection=body_ids, + comprehensive_result=comprehensive_result, + ) parent_design = get_design_from_body(bodies[0]) parent_design._update_design_inplace() @@ -706,9 +674,7 @@ def inspect_geometry(self, bodies: list["Body"] = None) -> list[InspectResult]: """ parent_design = self._modeler.get_active_design() body_ids = [] if bodies is None else [body._grpc_id for body in bodies] - inspect_result_response = self._repair_stub.InspectGeometry( - InspectGeometryRequest(bodies=body_ids) - ) + inspect_result_response = self._grpc_client.services.repair_tools.inspect_geometry(bodies=body_ids) return self.__create_inspect_result_from_response( parent_design, inspect_result_response.issues_by_body ) @@ -766,9 +732,7 @@ def repair_geometry(self, bodies: list["Body"] = None) -> RepairToolMessage: Message containing success of the operation. """ body_ids = [] if bodies is None else [body._grpc_id for body in bodies] - repair_result_response = self._repair_stub.RepairGeometry( - RepairGeometryRequest(bodies=body_ids) - ) + repair_result_response = self._grpc_client.services.repair_tools.repair_geometry(bodies=body_ids) message = RepairToolMessage(repair_result_response.result.success, [], []) return message From e3e239d40b90a1c37868b613067847647a0aa7ed Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 14 Apr 2025 23:44:41 +0000 Subject: [PATCH 02/58] chore: auto fixes from pre-commit hooks --- .../geometry/core/_grpc/_services/_service.py | 1 + .../core/_grpc/_services/base/repair_tools.py | 3 - .../core/_grpc/_services/v0/repair_tools.py | 59 ++++++++++------ .../core/_grpc/_services/v1/repair_tools.py | 66 ++++++++++++----- src/ansys/geometry/core/tools/repair_tools.py | 70 ++++++++++++------- 5 files changed, 130 insertions(+), 69 deletions(-) diff --git a/src/ansys/geometry/core/_grpc/_services/_service.py b/src/ansys/geometry/core/_grpc/_services/_service.py index 2a52d2a581..877b6ae944 100644 --- a/src/ansys/geometry/core/_grpc/_services/_service.py +++ b/src/ansys/geometry/core/_grpc/_services/_service.py @@ -182,6 +182,7 @@ def named_selection(self) -> GRPCNamedSelectionService: def repair_tools(self) -> GRPCRepairToolsService: if not self._repair_tools: from .v0.repair_tools import GRPCRepairToolsServiceV0 + # TODO: Add V1 later self._repair_tools = GRPCRepairToolsServiceV0(self.channel) return self._repair_tools diff --git a/src/ansys/geometry/core/_grpc/_services/base/repair_tools.py b/src/ansys/geometry/core/_grpc/_services/base/repair_tools.py index ae97e61742..d847215002 100644 --- a/src/ansys/geometry/core/_grpc/_services/base/repair_tools.py +++ b/src/ansys/geometry/core/_grpc/_services/base/repair_tools.py @@ -26,9 +26,6 @@ import grpc -from abc import ABC, abstractmethod -import grpc - class GRPCRepairToolsService(ABC): def __init__(self, channel: grpc.Channel): pass diff --git a/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py b/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py index 82a35b40ca..93e3dfc98a 100644 --- a/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py +++ b/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py @@ -26,16 +26,15 @@ geometry issues, such as split edges, extra edges, duplicate faces, and more. """ -from abc import ABC, abstractmethod +from google.protobuf.wrappers_pb2 import BoolValue, DoubleValue import grpc -from ..base.repair_tools import GRPCRepairToolsService + from ansys.geometry.core.errors import protect_grpc -from google.protobuf.wrappers_pb2 import BoolValue, DoubleValue +from ..base.repair_tools import GRPCRepairToolsService class GRPCRepairToolsServiceV0(GRPCRepairToolsService): - @protect_grpc def __init__(self, channel: grpc.Channel): from ansys.api.geometry.v0.repairtools_pb2_grpc import RepairToolsStub @@ -44,9 +43,8 @@ def __init__(self, channel: grpc.Channel): @protect_grpc def find_split_edges(self, **kwargs): - from ansys.api.geometry.v0.repairtools_pb2 import FindSplitEdgesRequest - + request = FindSplitEdgesRequest( bodies_or_faces=kwargs["bodies_or_faces"], angle=kwargs["angle"], @@ -57,86 +55,101 @@ def find_split_edges(self, **kwargs): @protect_grpc def find_extra_edges(self, **kwargs): from ansys.api.geometry.v0.repairtools_pb2 import FindExtraEdgesRequest + request = FindExtraEdgesRequest(selection=kwargs["selection"]) return self.stub.FindExtraEdges(request) @protect_grpc def find_inexact_edges(self, **kwargs): from ansys.api.geometry.v0.repairtools_pb2 import FindInexactEdgesRequest + request = FindInexactEdgesRequest(selection=kwargs["selection"]) - return self.stub.FindInexactEdges(request) - - + return self.stub.FindInexactEdges(request) + @protect_grpc def find_short_edges(self, **kwargs): from ansys.api.geometry.v0.repairtools_pb2 import FindShortEdgesRequest + request = FindShortEdgesRequest( selection=kwargs["selection"], max_edge_length=DoubleValue(value=kwargs["length"]), ) return self.stub.FindShortEdges(request) - + @protect_grpc def find_duplicate_faces(self, **kwargs): from ansys.api.geometry.v0.repairtools_pb2 import FindDuplicateFacesRequest + request = FindDuplicateFacesRequest(faces=kwargs["faces"]) return self.stub.FindDuplicateFaces(request) - @protect_grpc def find_missing_faces(self, **kwargs): from ansys.api.geometry.v0.repairtools_pb2 import FindMissingFacesRequest + request = FindMissingFacesRequest(faces=kwargs["faces"]) - return self.stub.FindMissingFaces(request) + return self.stub.FindMissingFaces(request) @protect_grpc def find_small_faces(self, **kwargs): from ansys.api.geometry.v0.repairtools_pb2 import FindSmallFacesRequest + request = FindSmallFacesRequest(selection=kwargs["selection"]) return self.stub.FindSmallFaces(request) - + @protect_grpc def find_stitch_faces(self, **kwargs): from ansys.api.geometry.v0.repairtools_pb2 import FindStitchFacesRequest + request = FindStitchFacesRequest(faces=kwargs["faces"]) return self.stub.FindStitchFaces(request) - + @protect_grpc def find_simplify(self, **kwargs): from ansys.api.geometry.v0.repairtools_pb2 import FindAdjustSimplifyRequest + request = FindAdjustSimplifyRequest(selection=kwargs["selection"]) return self.stub.FindAdjustSimplify(request) - + @protect_grpc def find_and_fix_simplify(self, **kwargs): from ansys.api.geometry.v0.repairtools_pb2 import FindAdjustSimplifyRequest + request = FindAdjustSimplifyRequest( selection=kwargs["selection"], comprehensive=kwargs["comprehensive_result"], ) - return self.stub.FindAndSimplify(request) - + return self.stub.FindAndSimplify(request) + @protect_grpc def inspect_geometry(self, **kwargs): from ansys.api.geometry.v0.repairtools_pb2 import InspectGeometryRequest + request = InspectGeometryRequest(bodies=kwargs.get("bodies", [])) return self.stub.InspectGeometry(request) - + @protect_grpc def repair_geometry(self, **kwargs): from ansys.api.geometry.v0.repairtools_pb2 import RepairGeometryRequest + request = RepairGeometryRequest(bodies=kwargs.get("bodies", [])) return self.stub.RepairGeometry(request) - + @protect_grpc def find_interferences(self, **kwargs): from ansys.api.geometry.v0.repairtools_pb2 import FindInterferenceRequest + request = FindInterferenceRequest( bodies=kwargs["bodies"], cut_smaller_body=BoolValue(value=kwargs["cut_smaller_body"]), ) - return self.stub.FindInterference(request) + return self.stub.FindInterference(request) + + def find_and_fix_short_edges(self, **kwargs): + raise NotImplementedError + + def find_and_fix_extra_edges(self, **kwargs): + raise NotImplementedError - def find_and_fix_short_edges(self, **kwargs): raise NotImplementedError - def find_and_fix_extra_edges(self, **kwargs): raise NotImplementedError - def find_and_fix_split_edges(self, **kwargs): raise NotImplementedError \ No newline at end of file + def find_and_fix_split_edges(self, **kwargs): + raise NotImplementedError diff --git a/src/ansys/geometry/core/_grpc/_services/v1/repair_tools.py b/src/ansys/geometry/core/_grpc/_services/v1/repair_tools.py index 6af59514c3..3d6ae2a9f6 100644 --- a/src/ansys/geometry/core/_grpc/_services/v1/repair_tools.py +++ b/src/ansys/geometry/core/_grpc/_services/v1/repair_tools.py @@ -21,13 +21,14 @@ # SOFTWARE. """Module containing the repair tools service implementation (abstraction layer).""" -from abc import ABC, abstractmethod +from abc import ABC import grpc class GRPCRepairToolsServiceV1(ABC): """Repair tools service for gRPC communication with the Geometry server. + Parameters ---------- channel : grpc.Channel @@ -38,19 +39,50 @@ def __init__(self, channel: grpc.Channel): """Initialize the MeasurementToolsService class.""" pass # pragma: no cover - def find_split_edges(self, **kwargs): raise NotImplementedError - def find_extra_edges(self, **kwargs): raise NotImplementedError - def find_inexact_edges(self, **kwargs): raise NotImplementedError - def find_short_edges(self, **kwargs): raise NotImplementedError - def find_duplicate_faces(self, **kwargs): raise NotImplementedError - def find_missing_faces(self, **kwargs): raise NotImplementedError - def find_small_faces(self, **kwargs): raise NotImplementedError - def find_stitch_faces(self, **kwargs): raise NotImplementedError - def find_simplify(self, **kwargs): raise NotImplementedError - def find_interferences(self, **kwargs): raise NotImplementedError - def find_and_fix_short_edges(self, **kwargs): raise NotImplementedError - def find_and_fix_extra_edges(self, **kwargs): raise NotImplementedError - def find_and_fix_split_edges(self, **kwargs): raise NotImplementedError - def find_and_fix_simplify(self, **kwargs): raise NotImplementedError - def inspect_geometry(self, **kwargs): raise NotImplementedError - def repair_geometry(self, **kwargs): raise NotImplementedError \ No newline at end of file + def find_split_edges(self, **kwargs): + raise NotImplementedError + + def find_extra_edges(self, **kwargs): + raise NotImplementedError + + def find_inexact_edges(self, **kwargs): + raise NotImplementedError + + def find_short_edges(self, **kwargs): + raise NotImplementedError + + def find_duplicate_faces(self, **kwargs): + raise NotImplementedError + + def find_missing_faces(self, **kwargs): + raise NotImplementedError + + def find_small_faces(self, **kwargs): + raise NotImplementedError + + def find_stitch_faces(self, **kwargs): + raise NotImplementedError + + def find_simplify(self, **kwargs): + raise NotImplementedError + + def find_interferences(self, **kwargs): + raise NotImplementedError + + def find_and_fix_short_edges(self, **kwargs): + raise NotImplementedError + + def find_and_fix_extra_edges(self, **kwargs): + raise NotImplementedError + + def find_and_fix_split_edges(self, **kwargs): + raise NotImplementedError + + def find_and_fix_simplify(self, **kwargs): + raise NotImplementedError + + def inspect_geometry(self, **kwargs): + raise NotImplementedError + + def repair_geometry(self, **kwargs): + raise NotImplementedError diff --git a/src/ansys/geometry/core/tools/repair_tools.py b/src/ansys/geometry/core/tools/repair_tools.py index 8062a2e7fb..5b1f05e078 100644 --- a/src/ansys/geometry/core/tools/repair_tools.py +++ b/src/ansys/geometry/core/tools/repair_tools.py @@ -31,7 +31,6 @@ InspectGeometryResult, InspectGeometryResultIssue, ) - from ansys.api.geometry.v0.repairtools_pb2_grpc import RepairToolsStub from ansys.geometry.core.connection import GrpcClient from ansys.geometry.core.errors import protect_grpc @@ -106,10 +105,10 @@ def find_split_edges( length_value = DoubleValue(value=float(length)) body_ids = [body.id for body in bodies] - problem_areas_response = self._grpc_client.services.repair_tools.find_split_edges( + problem_areas_response = self._grpc_client.services.repair_tools.find_split_edges( bodies_or_faces=body_ids, angle=angle_value, distance=length_value ) - + parent_design = get_design_from_body(bodies[0]) return [ SplitEdgeProblemAreas( @@ -141,7 +140,9 @@ def find_extra_edges(self, bodies: list["Body"]) -> list[ExtraEdgeProblemAreas]: return [] body_ids = [body.id for body in bodies] - problem_areas_response = self._grpc_client.services.repair_tools.find_extra_edges(selection=body_ids) + problem_areas_response = self._grpc_client.services.repair_tools.find_extra_edges( + selection=body_ids + ) parent_design = get_design_from_body(bodies[0]) return [ @@ -174,7 +175,9 @@ def find_inexact_edges(self, bodies: list["Body"]) -> list[InexactEdgeProblemAre return [] body_ids = [body.id for body in bodies] - problem_areas_response = self._grpc_client.services.repair_tools.find_inexact_edges(selection=body_ids) + problem_areas_response = self._grpc_client.services.repair_tools.find_inexact_edges( + selection=body_ids + ) parent_design = get_design_from_body(bodies[0]) @@ -212,7 +215,8 @@ def find_short_edges( body_ids = [body.id for body in bodies] problem_areas_response = self._grpc_client.services.repair_tools.find_short_edges( - selection=body_ids, length=length) + selection=body_ids, length=length + ) parent_design = get_design_from_body(bodies[0]) return [ @@ -245,7 +249,9 @@ def find_duplicate_faces(self, bodies: list["Body"]) -> list[DuplicateFaceProble return [] body_ids = [body.id for body in bodies] - problem_areas_response = self._grpc_client.services.repair_tools.find_duplicate_faces(faces=body_ids) + problem_areas_response = self._grpc_client.services.repair_tools.find_duplicate_faces( + faces=body_ids + ) parent_design = get_design_from_body(bodies[0]) return [ @@ -277,7 +283,9 @@ def find_missing_faces(self, bodies: list["Body"]) -> list[MissingFaceProblemAre if not bodies: return [] body_ids = [body.id for body in bodies] - problem_areas_response = self._grpc_client.services.repair_tools.find_missing_faces(faces=body_ids) + problem_areas_response = self._grpc_client.services.repair_tools.find_missing_faces( + faces=body_ids + ) parent_design = get_design_from_body(bodies[0]) return [ @@ -310,7 +318,9 @@ def find_small_faces(self, bodies: list["Body"]) -> list[SmallFaceProblemAreas]: return [] body_ids = [body.id for body in bodies] - problem_areas_response = self._grpc_client.services.repair_tools.find_small_faces(selection=body_ids) + problem_areas_response = self._grpc_client.services.repair_tools.find_small_faces( + selection=body_ids + ) parent_design = get_design_from_body(bodies[0]) return [ @@ -340,7 +350,9 @@ def find_stitch_faces(self, bodies: list["Body"]) -> list[StitchFaceProblemAreas List of objects representing stitch face problem areas. """ body_ids = [body.id for body in bodies] - problem_areas_response = self._grpc_client.services.repair_tools.find_stitch_faces(faces=body_ids) + problem_areas_response = self._grpc_client.services.repair_tools.find_stitch_faces( + faces=body_ids + ) parent_design = get_design_from_body(bodies[0]) return [ StitchFaceProblemAreas( @@ -372,7 +384,9 @@ def find_simplify(self, bodies: list["Body"]) -> list[UnsimplifiedFaceProblemAre body_ids = [body.id for body in bodies] parent_design = get_design_from_body(bodies[0]) - problem_areas_response = self._grpc_client.services.repair_tools.find_simplify(selection=body_ids) + problem_areas_response = self._grpc_client.services.repair_tools.find_simplify( + selection=body_ids + ) return [ UnsimplifiedFaceProblemAreas( @@ -421,9 +435,9 @@ def find_interferences( body_ids = [body.id for body in bodies] cut_smaller_body_bool = BoolValue(value=cut_smaller_body) problem_areas_response = self._grpc_client.services.repair_tools.find_interferences( - bodies=body_ids, - cut_smaller_body=cut_smaller_body_bool, - ) + bodies=body_ids, + cut_smaller_body=cut_smaller_body_bool, + ) return [ InterferenceProblemAreas( @@ -472,10 +486,10 @@ def find_and_fix_short_edges( body_ids = [body.id for body in bodies] response = self._grpc_client.services.repair_tools.find_and_fix_short_edges( - selection=body_ids, - length=length, - comprehensive_result=comprehensive_result, - ) + selection=body_ids, + length=length, + comprehensive_result=comprehensive_result, + ) parent_design = get_design_from_body(bodies[0]) parent_design._update_design_inplace() @@ -524,8 +538,8 @@ def find_and_fix_extra_edges( body_ids = [body.id for body in bodies] response = self._grpc_client.services.repair_tools.find_and_fix_extra_edges( - selection=body_ids, - comprehensive_result=comprehensive_result, + selection=body_ids, + comprehensive_result=comprehensive_result, ) parent_design = get_design_from_body(bodies[0]) @@ -584,7 +598,7 @@ def find_and_fix_split_edges( angle_value = DoubleValue(value=float(angle)) length_value = DoubleValue(value=float(length)) body_ids = [body.id for body in bodies] - + response = self._grpc_client.services.repair_tools.find_and_fix_split_edges( bodies_or_faces=body_ids, angle=angle_value, @@ -638,9 +652,9 @@ def find_and_fix_simplify( body_ids = [body.id for body in bodies] response = self._grpc_client.services.repair_tools.find_and_fix_simplify( - selection=body_ids, - comprehensive_result=comprehensive_result, - ) + selection=body_ids, + comprehensive_result=comprehensive_result, + ) parent_design = get_design_from_body(bodies[0]) parent_design._update_design_inplace() @@ -674,7 +688,9 @@ def inspect_geometry(self, bodies: list["Body"] = None) -> list[InspectResult]: """ parent_design = self._modeler.get_active_design() body_ids = [] if bodies is None else [body._grpc_id for body in bodies] - inspect_result_response = self._grpc_client.services.repair_tools.inspect_geometry(bodies=body_ids) + inspect_result_response = self._grpc_client.services.repair_tools.inspect_geometry( + bodies=body_ids + ) return self.__create_inspect_result_from_response( parent_design, inspect_result_response.issues_by_body ) @@ -732,7 +748,9 @@ def repair_geometry(self, bodies: list["Body"] = None) -> RepairToolMessage: Message containing success of the operation. """ body_ids = [] if bodies is None else [body._grpc_id for body in bodies] - repair_result_response = self._grpc_client.services.repair_tools.repair_geometry(bodies=body_ids) + repair_result_response = self._grpc_client.services.repair_tools.repair_geometry( + bodies=body_ids + ) message = RepairToolMessage(repair_result_response.result.success, [], []) return message From 709e57ac0d7c6145b7c38f00a462b025e5310412 Mon Sep 17 00:00:00 2001 From: pyansys-ci-bot <92810346+pyansys-ci-bot@users.noreply.github.com> Date: Mon, 14 Apr 2025 23:47:33 +0000 Subject: [PATCH 03/58] chore: adding changelog file 1912.added.md [dependabot-skip] --- doc/changelog.d/1912.added.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 doc/changelog.d/1912.added.md diff --git a/doc/changelog.d/1912.added.md b/doc/changelog.d/1912.added.md new file mode 100644 index 0000000000..0696e6dc10 --- /dev/null +++ b/doc/changelog.d/1912.added.md @@ -0,0 +1 @@ +repair tools refactoring \ No newline at end of file From 41e790ac2be295bef654813e47c40004f1886702 Mon Sep 17 00:00:00 2001 From: Umut Soysal Date: Wed, 16 Apr 2025 08:42:51 -0500 Subject: [PATCH 04/58] repair tools --- src/ansys/geometry/core/tools/repair_tools.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/ansys/geometry/core/tools/repair_tools.py b/src/ansys/geometry/core/tools/repair_tools.py index 8062a2e7fb..41996b03f2 100644 --- a/src/ansys/geometry/core/tools/repair_tools.py +++ b/src/ansys/geometry/core/tools/repair_tools.py @@ -32,7 +32,6 @@ InspectGeometryResultIssue, ) -from ansys.api.geometry.v0.repairtools_pb2_grpc import RepairToolsStub from ansys.geometry.core.connection import GrpcClient from ansys.geometry.core.errors import protect_grpc from ansys.geometry.core.misc.auxiliary import ( @@ -73,7 +72,6 @@ class RepairTools: def __init__(self, grpc_client: GrpcClient, modeler: "Modeler"): """Initialize a new instance of the ``RepairTools`` class.""" self._grpc_client = grpc_client - self._repair_stub = RepairToolsStub(self._grpc_client.channel) self._modeler = modeler @protect_grpc From e158532d13bf8fb624e6513fe807bad976575a14 Mon Sep 17 00:00:00 2001 From: Umut Soysal Date: Wed, 16 Apr 2025 08:47:49 -0500 Subject: [PATCH 05/58] remove repair stubs --- src/ansys/geometry/core/tools/repair_tools.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/ansys/geometry/core/tools/repair_tools.py b/src/ansys/geometry/core/tools/repair_tools.py index 5b1f05e078..aad658f83b 100644 --- a/src/ansys/geometry/core/tools/repair_tools.py +++ b/src/ansys/geometry/core/tools/repair_tools.py @@ -31,7 +31,6 @@ InspectGeometryResult, InspectGeometryResultIssue, ) -from ansys.api.geometry.v0.repairtools_pb2_grpc import RepairToolsStub from ansys.geometry.core.connection import GrpcClient from ansys.geometry.core.errors import protect_grpc from ansys.geometry.core.misc.auxiliary import ( @@ -71,8 +70,6 @@ class RepairTools: def __init__(self, grpc_client: GrpcClient, modeler: "Modeler"): """Initialize a new instance of the ``RepairTools`` class.""" - self._grpc_client = grpc_client - self._repair_stub = RepairToolsStub(self._grpc_client.channel) self._modeler = modeler @protect_grpc From 6b1b9e1aaf6c24ee1d32da8e1699053cf5731c96 Mon Sep 17 00:00:00 2001 From: Umut Soysal Date: Wed, 16 Apr 2025 09:02:02 -0500 Subject: [PATCH 06/58] merge --- .../geometry/core/_grpc/_services/_service.py | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/src/ansys/geometry/core/_grpc/_services/_service.py b/src/ansys/geometry/core/_grpc/_services/_service.py index b2f249c199..5d8421b882 100644 --- a/src/ansys/geometry/core/_grpc/_services/_service.py +++ b/src/ansys/geometry/core/_grpc/_services/_service.py @@ -179,3 +179,38 @@ def named_selection(self) -> GRPCNamedSelectionService: raise ValueError(f"Unsupported version: {self.version}") return self._named_selection + + @property + def measurement_tools(self) -> GRPCMeasurementToolsService: + """ + Get the measurement tools service for the specified version. + + Returns + ------- + MeasurementToolsServiceBase + The measurement tools service for the specified version. + """ + if not self._measurement_tools: + # Import the appropriate measurement tools service based on the version + from .v0.measurement_tools import GRPCMeasurementToolsServiceV0 + from .v1.measurement_tools import GRPCMeasurementToolsServiceV1 + + if self.version == GeometryApiProtos.V0: + self._measurement_tools = GRPCMeasurementToolsServiceV0(self.channel) + elif self.version == GeometryApiProtos.V1: # pragma: no cover + # V1 is not implemented yet + self._measurement_tools = GRPCMeasurementToolsServiceV1(self.channel) + else: # pragma: no cover + # This should never happen as the version is set in the constructor + raise ValueError(f"Unsupported version: {self.version}") + + return self._measurement_tools + + @property + def repair_tools(self) -> GRPCRepairToolsService: + if not self._repair_tools: + from .v0.repair_tools import GRPCRepairToolsServiceV0 + + # TODO: Add V1 later + self._repair_tools = GRPCRepairToolsServiceV0(self.channel) + return self._repair_tools From 0021a554170fa6ad2ed95f3151ae416c37de5f1e Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 16 Apr 2025 14:50:46 +0000 Subject: [PATCH 07/58] chore: auto fixes from pre-commit hooks --- src/ansys/geometry/core/_grpc/_services/_service.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ansys/geometry/core/_grpc/_services/_service.py b/src/ansys/geometry/core/_grpc/_services/_service.py index 10d1e5b27a..03d052d0ca 100644 --- a/src/ansys/geometry/core/_grpc/_services/_service.py +++ b/src/ansys/geometry/core/_grpc/_services/_service.py @@ -28,8 +28,8 @@ from .base.dbuapplication import GRPCDbuApplicationService from .base.measurement_tools import GRPCMeasurementToolsService from .base.named_selection import GRPCNamedSelectionService -from .base.repair_tools import GRPCRepairToolsService from .base.prepare_tools import GRPCPrepareToolsService +from .base.repair_tools import GRPCRepairToolsService class _GRPCServices: @@ -216,6 +216,7 @@ def repair_tools(self) -> GRPCRepairToolsService: # TODO: Add V1 later self._repair_tools = GRPCRepairToolsServiceV0(self.channel) return self._repair_tools + def prepare_tools(self) -> GRPCPrepareToolsService: """ Get the prepare tools service for the specified version. From a6712934dc5de1b152e0f9708e9117bf5c945135 Mon Sep 17 00:00:00 2001 From: Umut Soysal Date: Wed, 16 Apr 2025 09:55:43 -0500 Subject: [PATCH 08/58] revert delete --- src/ansys/geometry/core/tools/repair_tools.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/ansys/geometry/core/tools/repair_tools.py b/src/ansys/geometry/core/tools/repair_tools.py index aad658f83b..fa0071710a 100644 --- a/src/ansys/geometry/core/tools/repair_tools.py +++ b/src/ansys/geometry/core/tools/repair_tools.py @@ -71,6 +71,8 @@ class RepairTools: def __init__(self, grpc_client: GrpcClient, modeler: "Modeler"): """Initialize a new instance of the ``RepairTools`` class.""" self._modeler = modeler + self._grpc_client = grpc_client + @protect_grpc def find_split_edges( From 2dacd8b616f2539bd6f4d27f74e08ae0f40b38c5 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 16 Apr 2025 14:56:22 +0000 Subject: [PATCH 09/58] chore: auto fixes from pre-commit hooks --- src/ansys/geometry/core/tools/repair_tools.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/ansys/geometry/core/tools/repair_tools.py b/src/ansys/geometry/core/tools/repair_tools.py index fa0071710a..5f5471c503 100644 --- a/src/ansys/geometry/core/tools/repair_tools.py +++ b/src/ansys/geometry/core/tools/repair_tools.py @@ -73,7 +73,6 @@ def __init__(self, grpc_client: GrpcClient, modeler: "Modeler"): self._modeler = modeler self._grpc_client = grpc_client - @protect_grpc def find_split_edges( self, bodies: list["Body"], angle: Real = 0.0, length: Real = 0.0 From 05953182d515c2e0b1f17e856a1989c4f8277975 Mon Sep 17 00:00:00 2001 From: Umut Soysal Date: Wed, 16 Apr 2025 12:17:52 -0500 Subject: [PATCH 10/58] implement missing methods --- .../core/_grpc/_services/v0/repair_tools.py | 30 +++++++++++++++++-- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py b/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py index 93e3dfc98a..b601b812e4 100644 --- a/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py +++ b/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py @@ -145,11 +145,35 @@ def find_interferences(self, **kwargs): ) return self.stub.FindInterference(request) + @protect_grpc def find_and_fix_short_edges(self, **kwargs): - raise NotImplementedError + from ansys.api.geometry.v0.repairtools_pb2 import FindShortEdgesRequest + request = FindShortEdgesRequest( + selection=kwargs["selection"], + max_edge_length=DoubleValue(value=kwargs["length"]), + comprehensive=kwargs["comprehensive_result"], + ) + return self.stub.FindAndFixShortEdges(request) + @protect_grpc def find_and_fix_extra_edges(self, **kwargs): - raise NotImplementedError + from ansys.api.geometry.v0.repairtools_pb2 import FindExtraEdgesRequest + + request = FindExtraEdgesRequest( + selection=kwargs["selection"], + comprehensive=kwargs["comprehensive_result"], + ) + return self.stub.FindAndFixExtraEdges(request) + + @protect_grpc def find_and_fix_split_edges(self, **kwargs): - raise NotImplementedError + from ansys.api.geometry.v0.repairtools_pb2 import FindSplitEdgesRequest + + request = FindSplitEdgesRequest( + bodies_or_faces=kwargs["bodies_or_faces"], + angle=kwargs["angle"], + distance=kwargs["length"], + comprehensive=kwargs["comprehensive_result"], + ) + return self.stub.FindAndFixSplitEdges(request) From fddd6c2175bda78f3ce2995c9e6b4c1fb7aae9eb Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 16 Apr 2025 17:18:08 +0000 Subject: [PATCH 11/58] chore: auto fixes from pre-commit hooks --- src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py b/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py index b601b812e4..01efa12965 100644 --- a/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py +++ b/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py @@ -148,6 +148,7 @@ def find_interferences(self, **kwargs): @protect_grpc def find_and_fix_short_edges(self, **kwargs): from ansys.api.geometry.v0.repairtools_pb2 import FindShortEdgesRequest + request = FindShortEdgesRequest( selection=kwargs["selection"], max_edge_length=DoubleValue(value=kwargs["length"]), @@ -165,7 +166,6 @@ def find_and_fix_extra_edges(self, **kwargs): ) return self.stub.FindAndFixExtraEdges(request) - @protect_grpc def find_and_fix_split_edges(self, **kwargs): from ansys.api.geometry.v0.repairtools_pb2 import FindSplitEdgesRequest From 81908d9737ed5836cc29237cf2944368d4c1a765 Mon Sep 17 00:00:00 2001 From: Umut Soysal Date: Wed, 16 Apr 2025 21:20:26 -0500 Subject: [PATCH 12/58] interference fix --- src/ansys/geometry/core/tools/repair_tools.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ansys/geometry/core/tools/repair_tools.py b/src/ansys/geometry/core/tools/repair_tools.py index 5f5471c503..06e5de2444 100644 --- a/src/ansys/geometry/core/tools/repair_tools.py +++ b/src/ansys/geometry/core/tools/repair_tools.py @@ -434,7 +434,7 @@ def find_interferences( cut_smaller_body_bool = BoolValue(value=cut_smaller_body) problem_areas_response = self._grpc_client.services.repair_tools.find_interferences( bodies=body_ids, - cut_smaller_body=cut_smaller_body_bool, + cut_smaller_body=cut_smaller_body ) return [ From 47479c48abc2b8fa0b20dfc5edebe8fb430b5f52 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 17 Apr 2025 02:22:50 +0000 Subject: [PATCH 13/58] chore: auto fixes from pre-commit hooks --- src/ansys/geometry/core/tools/repair_tools.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/ansys/geometry/core/tools/repair_tools.py b/src/ansys/geometry/core/tools/repair_tools.py index 06e5de2444..f5b19bc580 100644 --- a/src/ansys/geometry/core/tools/repair_tools.py +++ b/src/ansys/geometry/core/tools/repair_tools.py @@ -433,8 +433,7 @@ def find_interferences( body_ids = [body.id for body in bodies] cut_smaller_body_bool = BoolValue(value=cut_smaller_body) problem_areas_response = self._grpc_client.services.repair_tools.find_interferences( - bodies=body_ids, - cut_smaller_body=cut_smaller_body + bodies=body_ids, cut_smaller_body=cut_smaller_body ) return [ From 4cad96ac6c8cf07a38a1fef03e7fe59c4cb1a120 Mon Sep 17 00:00:00 2001 From: Umut Soysal Date: Wed, 16 Apr 2025 22:00:00 -0500 Subject: [PATCH 14/58] precommit --- src/ansys/geometry/core/tools/repair_tools.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/ansys/geometry/core/tools/repair_tools.py b/src/ansys/geometry/core/tools/repair_tools.py index 06e5de2444..f5b19bc580 100644 --- a/src/ansys/geometry/core/tools/repair_tools.py +++ b/src/ansys/geometry/core/tools/repair_tools.py @@ -433,8 +433,7 @@ def find_interferences( body_ids = [body.id for body in bodies] cut_smaller_body_bool = BoolValue(value=cut_smaller_body) problem_areas_response = self._grpc_client.services.repair_tools.find_interferences( - bodies=body_ids, - cut_smaller_body=cut_smaller_body + bodies=body_ids, cut_smaller_body=cut_smaller_body ) return [ From e90b1f56f471b7d66749c87e4da18d88e55b89a0 Mon Sep 17 00:00:00 2001 From: Umut Soysal Date: Wed, 16 Apr 2025 22:08:58 -0500 Subject: [PATCH 15/58] doc fix --- .../geometry/core/_grpc/_services/_service.py | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/src/ansys/geometry/core/_grpc/_services/_service.py b/src/ansys/geometry/core/_grpc/_services/_service.py index 03d052d0ca..abeab3933e 100644 --- a/src/ansys/geometry/core/_grpc/_services/_service.py +++ b/src/ansys/geometry/core/_grpc/_services/_service.py @@ -210,11 +210,26 @@ def measurement_tools(self) -> GRPCMeasurementToolsService: @property def repair_tools(self) -> GRPCRepairToolsService: + """ + Get the repair tools service for the specified version. + + Returns + ------- + RepairToolsServiceBase + The prepare tools service for the specified version. + """ if not self._repair_tools: from .v0.repair_tools import GRPCRepairToolsServiceV0 + from .v1.prepare_tools import GRPCRepairToolsServiceV1 - # TODO: Add V1 later - self._repair_tools = GRPCRepairToolsServiceV0(self.channel) + if self.version == GeometryApiProtos.V0: + self._repair_tools = GRPCRepairToolsServiceV0(self.channel) + elif self.version == GeometryApiProtos.V1: # pragma: no cover + # V1 is not implemented yet + self._repair_tools = GRPCRepairToolsServiceV1(self.channel) + else: # pragma: no cover + # This should never happen as the version is set in the constructor + raise ValueError(f"Unsupported version: {self.version}") return self._repair_tools def prepare_tools(self) -> GRPCPrepareToolsService: @@ -223,7 +238,7 @@ def prepare_tools(self) -> GRPCPrepareToolsService: Returns ------- - NamedSelectionServiceBase + PrepareToolsServiceBase The prepare tools service for the specified version. """ if not self._prepare_tools: From abe23539a9d939f29b7b09402f666ba333429bab Mon Sep 17 00:00:00 2001 From: Umut Soysal Date: Wed, 16 Apr 2025 22:10:04 -0500 Subject: [PATCH 16/58] decorator fix --- src/ansys/geometry/core/_grpc/_services/_service.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ansys/geometry/core/_grpc/_services/_service.py b/src/ansys/geometry/core/_grpc/_services/_service.py index abeab3933e..27bb087b83 100644 --- a/src/ansys/geometry/core/_grpc/_services/_service.py +++ b/src/ansys/geometry/core/_grpc/_services/_service.py @@ -232,6 +232,7 @@ def repair_tools(self) -> GRPCRepairToolsService: raise ValueError(f"Unsupported version: {self.version}") return self._repair_tools + @property def prepare_tools(self) -> GRPCPrepareToolsService: """ Get the prepare tools service for the specified version. From f4e167da3507f79912e603ce50c44e3f53fdefc0 Mon Sep 17 00:00:00 2001 From: Umut Soysal Date: Wed, 16 Apr 2025 22:21:51 -0500 Subject: [PATCH 17/58] doc fix --- .../geometry/core/_grpc/_services/_service.py | 2 +- .../core/_grpc/_services/base/repair_tools.py | 102 ++++++++++++++---- 2 files changed, 84 insertions(+), 20 deletions(-) diff --git a/src/ansys/geometry/core/_grpc/_services/_service.py b/src/ansys/geometry/core/_grpc/_services/_service.py index 27bb087b83..69b9956fe7 100644 --- a/src/ansys/geometry/core/_grpc/_services/_service.py +++ b/src/ansys/geometry/core/_grpc/_services/_service.py @@ -220,7 +220,7 @@ def repair_tools(self) -> GRPCRepairToolsService: """ if not self._repair_tools: from .v0.repair_tools import GRPCRepairToolsServiceV0 - from .v1.prepare_tools import GRPCRepairToolsServiceV1 + from .v1.repair_tools import GRPCRepairToolsServiceV1 if self.version == GeometryApiProtos.V0: self._repair_tools = GRPCRepairToolsServiceV0(self.channel) diff --git a/src/ansys/geometry/core/_grpc/_services/base/repair_tools.py b/src/ansys/geometry/core/_grpc/_services/base/repair_tools.py index d847215002..2cd707b363 100644 --- a/src/ansys/geometry/core/_grpc/_services/base/repair_tools.py +++ b/src/ansys/geometry/core/_grpc/_services/base/repair_tools.py @@ -19,46 +19,110 @@ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -"""Module containing the repair tools service implementation (abstraction layer).""" +"""Module containing the repair tools service implementation (abstraction layer). -from abc import ABC, abstractmethod +This module defines an abstract base class for a gRPC-based repair tools service. +The class provides a set of abstract methods for identifying and repairing various +geometry issues, such as split edges, extra edges, duplicate faces, and more. +""" +from abc import ABC, abstractmethod import grpc class GRPCRepairToolsService(ABC): + """Abstract base class for gRPC-based repair tools service. + + This class defines a set of abstract methods that must be implemented + by any concrete subclass. These methods are used to identify and repair + various geometry issues in a CAD model. + """ + def __init__(self, channel: grpc.Channel): - pass + """Initialize the gRPC repair tools service. + + Parameters: + channel (grpc.Channel): The gRPC channel used to communicate with the service. + """ + pass # pragma: no cover @abstractmethod - def find_split_edges(self, **kwargs): ... + def find_split_edges(self, **kwargs): + """Identify split edges in the geometry.""" + pass # pragma: no cover + + @abstractmethod - def find_extra_edges(self, **kwargs): ... + def find_extra_edges(self, **kwargs): + """Identify extra edges in the geometry.""" + pass # pragma: no cover + @abstractmethod - def find_inexact_edges(self, **kwargs): ... + def find_inexact_edges(self, **kwargs): + """Identify inexact edges in the geometry.""" + pass # pragma: no cover + @abstractmethod - def find_short_edges(self, **kwargs): ... + def find_short_edges(self, **kwargs): + """Identify short edges in the geometry.""" + pass # pragma: no cover + @abstractmethod - def find_duplicate_faces(self, **kwargs): ... + def find_duplicate_faces(self, **kwargs): + """Identify duplicate faces in the geometry.""" + pass # pragma: no cover + @abstractmethod - def find_missing_faces(self, **kwargs): ... + def find_missing_faces(self, **kwargs): + """Identify missing faces in the geometry.""" + pass # pragma: no cover + @abstractmethod - def find_small_faces(self, **kwargs): ... + def find_small_faces(self, **kwargs): + """Identify small faces in the geometry.""" + pass # pragma: no cover + @abstractmethod - def find_stitch_faces(self, **kwargs): ... + def find_stitch_faces(self, **kwargs): + """Identify faces that can be stitched together in the geometry.""" + pass # pragma: no cover + @abstractmethod - def find_simplify(self, **kwargs): ... + def find_simplify(self, **kwargs): + """Identify areas in the geometry that can be simplified.""" + pass # pragma: no cover + @abstractmethod - def find_interferences(self, **kwargs): ... + def find_interferences(self, **kwargs): + """Identify interferences in the geometry.""" + pass # pragma: no cover + @abstractmethod - def find_and_fix_short_edges(self, **kwargs): ... + def find_and_fix_short_edges(self, **kwargs): + """Identify and fix short edges in the geometry.""" + pass # pragma: no cover + @abstractmethod - def find_and_fix_extra_edges(self, **kwargs): ... + def find_and_fix_extra_edges(self, **kwargs): + """Identify and fix extra edges in the geometry.""" + pass # pragma: no cover + @abstractmethod - def find_and_fix_split_edges(self, **kwargs): ... + def find_and_fix_split_edges(self, **kwargs): + """Identify and fix split edges in the geometry.""" + pass # pragma: no cover + @abstractmethod - def find_and_fix_simplify(self, **kwargs): ... + def find_and_fix_simplify(self, **kwargs): + """Identify and simplify areas in the geometry.""" + pass # pragma: no cover + @abstractmethod - def inspect_geometry(self, **kwargs): ... + def inspect_geometry(self, **kwargs): + """Inspect the geometry for issues.""" + pass # pragma: no cover + @abstractmethod - def repair_geometry(self, **kwargs): ... + def repair_geometry(self, **kwargs): + """Repair the geometry by addressing identified issues.""" + pass # pragma: no cover From b4f930c61ee81eef16d322e95b61ab05d620b5b0 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 17 Apr 2025 03:22:08 +0000 Subject: [PATCH 18/58] chore: auto fixes from pre-commit hooks --- src/ansys/geometry/core/_grpc/_services/base/repair_tools.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/ansys/geometry/core/_grpc/_services/base/repair_tools.py b/src/ansys/geometry/core/_grpc/_services/base/repair_tools.py index 2cd707b363..00f5cfcd25 100644 --- a/src/ansys/geometry/core/_grpc/_services/base/repair_tools.py +++ b/src/ansys/geometry/core/_grpc/_services/base/repair_tools.py @@ -27,6 +27,7 @@ """ from abc import ABC, abstractmethod + import grpc @@ -41,7 +42,8 @@ class GRPCRepairToolsService(ABC): def __init__(self, channel: grpc.Channel): """Initialize the gRPC repair tools service. - Parameters: + Parameters + ---------- channel (grpc.Channel): The gRPC channel used to communicate with the service. """ pass # pragma: no cover @@ -51,7 +53,6 @@ def find_split_edges(self, **kwargs): """Identify split edges in the geometry.""" pass # pragma: no cover - @abstractmethod def find_extra_edges(self, **kwargs): """Identify extra edges in the geometry.""" From 6a5c2d1e82e06a4d6c84622cca5cad2baf4e6aa1 Mon Sep 17 00:00:00 2001 From: Umut Soysal Date: Wed, 16 Apr 2025 22:24:39 -0500 Subject: [PATCH 19/58] Update repair_tools.py --- src/ansys/geometry/core/_grpc/_services/base/repair_tools.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/ansys/geometry/core/_grpc/_services/base/repair_tools.py b/src/ansys/geometry/core/_grpc/_services/base/repair_tools.py index 2cd707b363..00f5cfcd25 100644 --- a/src/ansys/geometry/core/_grpc/_services/base/repair_tools.py +++ b/src/ansys/geometry/core/_grpc/_services/base/repair_tools.py @@ -27,6 +27,7 @@ """ from abc import ABC, abstractmethod + import grpc @@ -41,7 +42,8 @@ class GRPCRepairToolsService(ABC): def __init__(self, channel: grpc.Channel): """Initialize the gRPC repair tools service. - Parameters: + Parameters + ---------- channel (grpc.Channel): The gRPC channel used to communicate with the service. """ pass # pragma: no cover @@ -51,7 +53,6 @@ def find_split_edges(self, **kwargs): """Identify split edges in the geometry.""" pass # pragma: no cover - @abstractmethod def find_extra_edges(self, **kwargs): """Identify extra edges in the geometry.""" From 63ce51edf426e6b409701372d9890bcbcc6de950 Mon Sep 17 00:00:00 2001 From: Umut Soysal Date: Wed, 16 Apr 2025 22:45:43 -0500 Subject: [PATCH 20/58] docfix --- src/ansys/geometry/core/_grpc/_services/_service.py | 2 +- src/ansys/geometry/core/_grpc/_services/base/repair_tools.py | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/ansys/geometry/core/_grpc/_services/_service.py b/src/ansys/geometry/core/_grpc/_services/_service.py index 69b9956fe7..74e658a503 100644 --- a/src/ansys/geometry/core/_grpc/_services/_service.py +++ b/src/ansys/geometry/core/_grpc/_services/_service.py @@ -216,7 +216,7 @@ def repair_tools(self) -> GRPCRepairToolsService: Returns ------- RepairToolsServiceBase - The prepare tools service for the specified version. + The repair tools service for the specified version. """ if not self._repair_tools: from .v0.repair_tools import GRPCRepairToolsServiceV0 diff --git a/src/ansys/geometry/core/_grpc/_services/base/repair_tools.py b/src/ansys/geometry/core/_grpc/_services/base/repair_tools.py index 00f5cfcd25..d70339360a 100644 --- a/src/ansys/geometry/core/_grpc/_services/base/repair_tools.py +++ b/src/ansys/geometry/core/_grpc/_services/base/repair_tools.py @@ -34,9 +34,7 @@ class GRPCRepairToolsService(ABC): """Abstract base class for gRPC-based repair tools service. - This class defines a set of abstract methods that must be implemented - by any concrete subclass. These methods are used to identify and repair - various geometry issues in a CAD model. + Defines abstract methods for identifying and repairing geometry issues in a model. """ def __init__(self, channel: grpc.Channel): From cac418a56a53610597a8b1153457bf860ffe7e15 Mon Sep 17 00:00:00 2001 From: Umut Soysal Date: Wed, 23 Apr 2025 10:51:13 -0500 Subject: [PATCH 21/58] doc fix --- .../core/_grpc/_services/base/repair_tools.py | 35 ++++++------ .../core/_grpc/_services/v0/repair_tools.py | 57 ++++++++++++------- 2 files changed, 55 insertions(+), 37 deletions(-) diff --git a/src/ansys/geometry/core/_grpc/_services/base/repair_tools.py b/src/ansys/geometry/core/_grpc/_services/base/repair_tools.py index d70339360a..a6a857f73f 100644 --- a/src/ansys/geometry/core/_grpc/_services/base/repair_tools.py +++ b/src/ansys/geometry/core/_grpc/_services/base/repair_tools.py @@ -42,86 +42,87 @@ def __init__(self, channel: grpc.Channel): Parameters ---------- - channel (grpc.Channel): The gRPC channel used to communicate with the service. + channel: grpc.Channel + The gRPC channel used to communicate with the service. """ pass # pragma: no cover @abstractmethod - def find_split_edges(self, **kwargs): + def find_split_edges(self, **kwargs) -> dict: """Identify split edges in the geometry.""" pass # pragma: no cover @abstractmethod - def find_extra_edges(self, **kwargs): + def find_extra_edges(self, **kwargs) -> dict: """Identify extra edges in the geometry.""" pass # pragma: no cover @abstractmethod - def find_inexact_edges(self, **kwargs): + def find_inexact_edges(self, **kwargs) -> dict: """Identify inexact edges in the geometry.""" pass # pragma: no cover @abstractmethod - def find_short_edges(self, **kwargs): + def find_short_edges(self, **kwargs) -> dict: """Identify short edges in the geometry.""" pass # pragma: no cover @abstractmethod - def find_duplicate_faces(self, **kwargs): + def find_duplicate_faces(self, **kwargs) -> dict: """Identify duplicate faces in the geometry.""" pass # pragma: no cover @abstractmethod - def find_missing_faces(self, **kwargs): + def find_missing_faces(self, **kwargs) -> dict: """Identify missing faces in the geometry.""" pass # pragma: no cover @abstractmethod - def find_small_faces(self, **kwargs): + def find_small_faces(self, **kwargs) -> dict: """Identify small faces in the geometry.""" pass # pragma: no cover @abstractmethod - def find_stitch_faces(self, **kwargs): + def find_stitch_faces(self, **kwargs) -> dict: """Identify faces that can be stitched together in the geometry.""" pass # pragma: no cover @abstractmethod - def find_simplify(self, **kwargs): + def find_simplify(self, **kwargs) -> dict: """Identify areas in the geometry that can be simplified.""" pass # pragma: no cover @abstractmethod - def find_interferences(self, **kwargs): + def find_interferences(self, **kwargs) -> dict: """Identify interferences in the geometry.""" pass # pragma: no cover @abstractmethod - def find_and_fix_short_edges(self, **kwargs): + def find_and_fix_short_edges(self, **kwargs) -> dict: """Identify and fix short edges in the geometry.""" pass # pragma: no cover @abstractmethod - def find_and_fix_extra_edges(self, **kwargs): + def find_and_fix_extra_edges(self, **kwargs) -> dict: """Identify and fix extra edges in the geometry.""" pass # pragma: no cover @abstractmethod - def find_and_fix_split_edges(self, **kwargs): + def find_and_fix_split_edges(self, **kwargs) -> dict: """Identify and fix split edges in the geometry.""" pass # pragma: no cover @abstractmethod - def find_and_fix_simplify(self, **kwargs): + def find_and_fix_simplify(self, **kwargs) -> dict: """Identify and simplify areas in the geometry.""" pass # pragma: no cover @abstractmethod - def inspect_geometry(self, **kwargs): + def inspect_geometry(self, **kwargs) -> dict: """Inspect the geometry for issues.""" pass # pragma: no cover @abstractmethod - def repair_geometry(self, **kwargs): + def repair_geometry(self, **kwargs) -> dict: """Repair the geometry by addressing identified issues.""" pass # pragma: no cover diff --git a/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py b/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py index 01efa12965..729c284adf 100644 --- a/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py +++ b/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py @@ -19,14 +19,13 @@ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -"""Module containing the repair tools service implementation (abstraction layer). +"""Module containing the repair tools service implementation. This module defines an abstract base class for a gRPC-based repair tools service. The class provides a set of abstract methods for identifying and repairing various -geometry issues, such as split edges, extra edges, duplicate faces, and more. +geometry issues, such as split edges, extra edges, duplicate faces etc. """ -from google.protobuf.wrappers_pb2 import BoolValue, DoubleValue import grpc from ansys.geometry.core.errors import protect_grpc @@ -34,7 +33,19 @@ from ..base.repair_tools import GRPCRepairToolsService -class GRPCRepairToolsServiceV0(GRPCRepairToolsService): +class GRPCRepairToolsServiceV0(GRPCRepairToolsService): # noqa: D102 + """Repair tools service for gRPC communication with the Geometry server. + + This class provides methods to interact with the Geometry server's + Repair Tools service. It is specifically designed for the v0 version + of the Geometry API. + + Parameters + ---------- + channel : grpc.Channel + The gRPC channel to the server. + """ + @protect_grpc def __init__(self, channel: grpc.Channel): from ansys.api.geometry.v0.repairtools_pb2_grpc import RepairToolsStub @@ -42,7 +53,7 @@ def __init__(self, channel: grpc.Channel): self.stub = RepairToolsStub(channel) @protect_grpc - def find_split_edges(self, **kwargs): + def find_split_edges(self, **kwargs): # noqa: D102 from ansys.api.geometry.v0.repairtools_pb2 import FindSplitEdgesRequest request = FindSplitEdgesRequest( @@ -53,21 +64,23 @@ def find_split_edges(self, **kwargs): return self.stub.FindSplitEdges(request) @protect_grpc - def find_extra_edges(self, **kwargs): + def find_extra_edges(self, **kwargs): # noqa: D102 from ansys.api.geometry.v0.repairtools_pb2 import FindExtraEdgesRequest request = FindExtraEdgesRequest(selection=kwargs["selection"]) return self.stub.FindExtraEdges(request) @protect_grpc - def find_inexact_edges(self, **kwargs): + def find_inexact_edges(self, **kwargs): # noqa: D102 from ansys.api.geometry.v0.repairtools_pb2 import FindInexactEdgesRequest request = FindInexactEdgesRequest(selection=kwargs["selection"]) return self.stub.FindInexactEdges(request) @protect_grpc - def find_short_edges(self, **kwargs): + def find_short_edges(self, **kwargs): # noqa: D102 + from google.protobuf.wrappers_pb2 import DoubleValue + from ansys.api.geometry.v0.repairtools_pb2 import FindShortEdgesRequest request = FindShortEdgesRequest( @@ -77,42 +90,42 @@ def find_short_edges(self, **kwargs): return self.stub.FindShortEdges(request) @protect_grpc - def find_duplicate_faces(self, **kwargs): + def find_duplicate_faces(self, **kwargs): # noqa: D102 from ansys.api.geometry.v0.repairtools_pb2 import FindDuplicateFacesRequest request = FindDuplicateFacesRequest(faces=kwargs["faces"]) return self.stub.FindDuplicateFaces(request) @protect_grpc - def find_missing_faces(self, **kwargs): + def find_missing_faces(self, **kwargs): # noqa: D102 from ansys.api.geometry.v0.repairtools_pb2 import FindMissingFacesRequest request = FindMissingFacesRequest(faces=kwargs["faces"]) return self.stub.FindMissingFaces(request) @protect_grpc - def find_small_faces(self, **kwargs): + def find_small_faces(self, **kwargs): # noqa: D102 from ansys.api.geometry.v0.repairtools_pb2 import FindSmallFacesRequest request = FindSmallFacesRequest(selection=kwargs["selection"]) return self.stub.FindSmallFaces(request) @protect_grpc - def find_stitch_faces(self, **kwargs): + def find_stitch_faces(self, **kwargs): # noqa: D102 from ansys.api.geometry.v0.repairtools_pb2 import FindStitchFacesRequest request = FindStitchFacesRequest(faces=kwargs["faces"]) return self.stub.FindStitchFaces(request) @protect_grpc - def find_simplify(self, **kwargs): + def find_simplify(self, **kwargs): # noqa: D102 from ansys.api.geometry.v0.repairtools_pb2 import FindAdjustSimplifyRequest request = FindAdjustSimplifyRequest(selection=kwargs["selection"]) return self.stub.FindAdjustSimplify(request) @protect_grpc - def find_and_fix_simplify(self, **kwargs): + def find_and_fix_simplify(self, **kwargs): # noqa: D102 from ansys.api.geometry.v0.repairtools_pb2 import FindAdjustSimplifyRequest request = FindAdjustSimplifyRequest( @@ -122,21 +135,23 @@ def find_and_fix_simplify(self, **kwargs): return self.stub.FindAndSimplify(request) @protect_grpc - def inspect_geometry(self, **kwargs): + def inspect_geometry(self, **kwargs): # noqa: D102 from ansys.api.geometry.v0.repairtools_pb2 import InspectGeometryRequest request = InspectGeometryRequest(bodies=kwargs.get("bodies", [])) return self.stub.InspectGeometry(request) @protect_grpc - def repair_geometry(self, **kwargs): + def repair_geometry(self, **kwargs): # noqa: D102 from ansys.api.geometry.v0.repairtools_pb2 import RepairGeometryRequest request = RepairGeometryRequest(bodies=kwargs.get("bodies", [])) return self.stub.RepairGeometry(request) @protect_grpc - def find_interferences(self, **kwargs): + def find_interferences(self, **kwargs): # noqa: D102 + from google.protobuf.wrappers_pb2 import BoolValue + from ansys.api.geometry.v0.repairtools_pb2 import FindInterferenceRequest request = FindInterferenceRequest( @@ -146,7 +161,9 @@ def find_interferences(self, **kwargs): return self.stub.FindInterference(request) @protect_grpc - def find_and_fix_short_edges(self, **kwargs): + def find_and_fix_short_edges(self, **kwargs): # noqa: D102 + from google.protobuf.wrappers_pb2 import DoubleValue + from ansys.api.geometry.v0.repairtools_pb2 import FindShortEdgesRequest request = FindShortEdgesRequest( @@ -157,7 +174,7 @@ def find_and_fix_short_edges(self, **kwargs): return self.stub.FindAndFixShortEdges(request) @protect_grpc - def find_and_fix_extra_edges(self, **kwargs): + def find_and_fix_extra_edges(self, **kwargs): # noqa: D102 from ansys.api.geometry.v0.repairtools_pb2 import FindExtraEdgesRequest request = FindExtraEdgesRequest( @@ -167,7 +184,7 @@ def find_and_fix_extra_edges(self, **kwargs): return self.stub.FindAndFixExtraEdges(request) @protect_grpc - def find_and_fix_split_edges(self, **kwargs): + def find_and_fix_split_edges(self, **kwargs): # noqa: D102 from ansys.api.geometry.v0.repairtools_pb2 import FindSplitEdgesRequest request = FindSplitEdgesRequest( From b4594f92ce3027de7d110eb8f3ecb1d48fa10632 Mon Sep 17 00:00:00 2001 From: Umut Soysal Date: Wed, 23 Apr 2025 13:01:27 -0500 Subject: [PATCH 22/58] nits bits --- .../core/_grpc/_services/v0/repair_tools.py | 33 +++++++++++-------- .../core/_grpc/_services/v1/repair_tools.py | 32 +++++++++--------- 2 files changed, 35 insertions(+), 30 deletions(-) diff --git a/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py b/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py index 729c284adf..9c077cc9e1 100644 --- a/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py +++ b/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py @@ -56,29 +56,34 @@ def __init__(self, channel: grpc.Channel): def find_split_edges(self, **kwargs): # noqa: D102 from ansys.api.geometry.v0.repairtools_pb2 import FindSplitEdgesRequest + # Create the request - assumes all inputs are valid and of the proper type request = FindSplitEdgesRequest( bodies_or_faces=kwargs["bodies_or_faces"], angle=kwargs["angle"], distance=kwargs["distance"], ) + + # Call the gRPC service + response = self.stub.FindSplitEdges(request) + return self.stub.FindSplitEdges(request) @protect_grpc - def find_extra_edges(self, **kwargs): # noqa: D102 + def find_extra_edges(self, **kwargs) -> dict: # noqa: D102 from ansys.api.geometry.v0.repairtools_pb2 import FindExtraEdgesRequest request = FindExtraEdgesRequest(selection=kwargs["selection"]) return self.stub.FindExtraEdges(request) @protect_grpc - def find_inexact_edges(self, **kwargs): # noqa: D102 + def find_inexact_edges(self, **kwargs) -> dict: # noqa: D102 from ansys.api.geometry.v0.repairtools_pb2 import FindInexactEdgesRequest request = FindInexactEdgesRequest(selection=kwargs["selection"]) return self.stub.FindInexactEdges(request) @protect_grpc - def find_short_edges(self, **kwargs): # noqa: D102 + def find_short_edges(self, **kwargs) -> dict: # noqa: D102 from google.protobuf.wrappers_pb2 import DoubleValue from ansys.api.geometry.v0.repairtools_pb2 import FindShortEdgesRequest @@ -90,42 +95,42 @@ def find_short_edges(self, **kwargs): # noqa: D102 return self.stub.FindShortEdges(request) @protect_grpc - def find_duplicate_faces(self, **kwargs): # noqa: D102 + def find_duplicate_faces(self, **kwargs) -> dict: # noqa: D102 from ansys.api.geometry.v0.repairtools_pb2 import FindDuplicateFacesRequest request = FindDuplicateFacesRequest(faces=kwargs["faces"]) return self.stub.FindDuplicateFaces(request) @protect_grpc - def find_missing_faces(self, **kwargs): # noqa: D102 + def find_missing_faces(self, **kwargs) -> dict: # noqa: D102 from ansys.api.geometry.v0.repairtools_pb2 import FindMissingFacesRequest request = FindMissingFacesRequest(faces=kwargs["faces"]) return self.stub.FindMissingFaces(request) @protect_grpc - def find_small_faces(self, **kwargs): # noqa: D102 + def find_small_faces(self, **kwargs) -> dict: # noqa: D102 from ansys.api.geometry.v0.repairtools_pb2 import FindSmallFacesRequest request = FindSmallFacesRequest(selection=kwargs["selection"]) return self.stub.FindSmallFaces(request) @protect_grpc - def find_stitch_faces(self, **kwargs): # noqa: D102 + def find_stitch_faces(self, **kwargs) -> dict: # noqa: D102 from ansys.api.geometry.v0.repairtools_pb2 import FindStitchFacesRequest request = FindStitchFacesRequest(faces=kwargs["faces"]) return self.stub.FindStitchFaces(request) @protect_grpc - def find_simplify(self, **kwargs): # noqa: D102 + def find_simplify(self, **kwargs) -> dict: # noqa: D102 from ansys.api.geometry.v0.repairtools_pb2 import FindAdjustSimplifyRequest request = FindAdjustSimplifyRequest(selection=kwargs["selection"]) return self.stub.FindAdjustSimplify(request) @protect_grpc - def find_and_fix_simplify(self, **kwargs): # noqa: D102 + def find_and_fix_simplify(self, **kwargs) -> dict: # noqa: D102 from ansys.api.geometry.v0.repairtools_pb2 import FindAdjustSimplifyRequest request = FindAdjustSimplifyRequest( @@ -135,21 +140,21 @@ def find_and_fix_simplify(self, **kwargs): # noqa: D102 return self.stub.FindAndSimplify(request) @protect_grpc - def inspect_geometry(self, **kwargs): # noqa: D102 + def inspect_geometry(self, **kwargs) -> dict: # noqa: D102 from ansys.api.geometry.v0.repairtools_pb2 import InspectGeometryRequest request = InspectGeometryRequest(bodies=kwargs.get("bodies", [])) return self.stub.InspectGeometry(request) @protect_grpc - def repair_geometry(self, **kwargs): # noqa: D102 + def repair_geometry(self, **kwargs) -> dict: # noqa: D102 from ansys.api.geometry.v0.repairtools_pb2 import RepairGeometryRequest request = RepairGeometryRequest(bodies=kwargs.get("bodies", [])) return self.stub.RepairGeometry(request) @protect_grpc - def find_interferences(self, **kwargs): # noqa: D102 + def find_interferences(self, **kwargs) -> dict: # noqa: D102 from google.protobuf.wrappers_pb2 import BoolValue from ansys.api.geometry.v0.repairtools_pb2 import FindInterferenceRequest @@ -174,7 +179,7 @@ def find_and_fix_short_edges(self, **kwargs): # noqa: D102 return self.stub.FindAndFixShortEdges(request) @protect_grpc - def find_and_fix_extra_edges(self, **kwargs): # noqa: D102 + def find_and_fix_extra_edges(self, **kwargs) -> dict: # noqa: D102 from ansys.api.geometry.v0.repairtools_pb2 import FindExtraEdgesRequest request = FindExtraEdgesRequest( @@ -184,7 +189,7 @@ def find_and_fix_extra_edges(self, **kwargs): # noqa: D102 return self.stub.FindAndFixExtraEdges(request) @protect_grpc - def find_and_fix_split_edges(self, **kwargs): # noqa: D102 + def find_and_fix_split_edges(self, **kwargs) -> dict: # noqa: D102 from ansys.api.geometry.v0.repairtools_pb2 import FindSplitEdgesRequest request = FindSplitEdgesRequest( diff --git a/src/ansys/geometry/core/_grpc/_services/v1/repair_tools.py b/src/ansys/geometry/core/_grpc/_services/v1/repair_tools.py index 3d6ae2a9f6..86fcb6ae70 100644 --- a/src/ansys/geometry/core/_grpc/_services/v1/repair_tools.py +++ b/src/ansys/geometry/core/_grpc/_services/v1/repair_tools.py @@ -39,50 +39,50 @@ def __init__(self, channel: grpc.Channel): """Initialize the MeasurementToolsService class.""" pass # pragma: no cover - def find_split_edges(self, **kwargs): + def find_split_edges(self, **kwargs) -> dict: # noqa: D102 raise NotImplementedError - def find_extra_edges(self, **kwargs): + def find_extra_edges(self, **kwargs) -> dict: # noqa: D102 raise NotImplementedError - def find_inexact_edges(self, **kwargs): + def find_inexact_edges(self, **kwargs) -> dict: # noqa: D102 raise NotImplementedError - def find_short_edges(self, **kwargs): + def find_short_edges(self, **kwargs) -> dict: # noqa: D102 raise NotImplementedError - def find_duplicate_faces(self, **kwargs): + def find_duplicate_faces(self, **kwargs) -> dict: # noqa: D102 raise NotImplementedError - def find_missing_faces(self, **kwargs): + def find_missing_faces(self, **kwargs) -> dict: # noqa: D102 raise NotImplementedError - def find_small_faces(self, **kwargs): + def find_small_faces(self, **kwargs) -> dict: # noqa: D102 raise NotImplementedError - def find_stitch_faces(self, **kwargs): + def find_stitch_faces(self, **kwargs) -> dict: # noqa: D102 raise NotImplementedError - def find_simplify(self, **kwargs): + def find_simplify(self, **kwargs) -> dict: # noqa: D102 raise NotImplementedError - def find_interferences(self, **kwargs): + def find_interferences(self, **kwargs) -> dict: # noqa: D102 raise NotImplementedError - def find_and_fix_short_edges(self, **kwargs): + def find_and_fix_short_edges(self, **kwargs) -> dict: # noqa: D102 raise NotImplementedError - def find_and_fix_extra_edges(self, **kwargs): + def find_and_fix_extra_edges(self, **kwargs) -> dict: # noqa: D102 raise NotImplementedError - def find_and_fix_split_edges(self, **kwargs): + def find_and_fix_split_edges(self, **kwargs) -> dict: # noqa: D102 raise NotImplementedError - def find_and_fix_simplify(self, **kwargs): + def find_and_fix_simplify(self, **kwargs) -> dict: # noqa: D102 raise NotImplementedError - def inspect_geometry(self, **kwargs): + def inspect_geometry(self, **kwargs) -> dict: # noqa: D102 raise NotImplementedError - def repair_geometry(self, **kwargs): + def repair_geometry(self, **kwargs) -> dict: # noqa: D102 raise NotImplementedError From 53c09b34746e00e3b8c953373a63dfa919000941 Mon Sep 17 00:00:00 2001 From: Umut Soysal Date: Wed, 23 Apr 2025 13:02:33 -0500 Subject: [PATCH 23/58] bs --- src/ansys/geometry/core/_grpc/_services/v1/repair_tools.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ansys/geometry/core/_grpc/_services/v1/repair_tools.py b/src/ansys/geometry/core/_grpc/_services/v1/repair_tools.py index 86fcb6ae70..611d3400d4 100644 --- a/src/ansys/geometry/core/_grpc/_services/v1/repair_tools.py +++ b/src/ansys/geometry/core/_grpc/_services/v1/repair_tools.py @@ -19,7 +19,7 @@ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -"""Module containing the repair tools service implementation (abstraction layer).""" +"""Module containing the repair tools service implementation.""" from abc import ABC From 9c693bb535b5b4324f71eb3aa10392f6ee38e527 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 23 Apr 2025 18:02:44 +0000 Subject: [PATCH 24/58] chore: auto fixes from pre-commit hooks --- .../core/_grpc/_services/v0/repair_tools.py | 4 +-- .../core/_grpc/_services/v1/repair_tools.py | 32 +++++++++---------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py b/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py index 9c077cc9e1..0b91975854 100644 --- a/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py +++ b/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py @@ -62,14 +62,14 @@ def find_split_edges(self, **kwargs): # noqa: D102 angle=kwargs["angle"], distance=kwargs["distance"], ) - + # Call the gRPC service response = self.stub.FindSplitEdges(request) return self.stub.FindSplitEdges(request) @protect_grpc - def find_extra_edges(self, **kwargs) -> dict: # noqa: D102 + def find_extra_edges(self, **kwargs) -> dict: # noqa: D102 from ansys.api.geometry.v0.repairtools_pb2 import FindExtraEdgesRequest request = FindExtraEdgesRequest(selection=kwargs["selection"]) diff --git a/src/ansys/geometry/core/_grpc/_services/v1/repair_tools.py b/src/ansys/geometry/core/_grpc/_services/v1/repair_tools.py index 611d3400d4..7a088ad260 100644 --- a/src/ansys/geometry/core/_grpc/_services/v1/repair_tools.py +++ b/src/ansys/geometry/core/_grpc/_services/v1/repair_tools.py @@ -39,50 +39,50 @@ def __init__(self, channel: grpc.Channel): """Initialize the MeasurementToolsService class.""" pass # pragma: no cover - def find_split_edges(self, **kwargs) -> dict: # noqa: D102 + def find_split_edges(self, **kwargs) -> dict: # noqa: D102 raise NotImplementedError - def find_extra_edges(self, **kwargs) -> dict: # noqa: D102 + def find_extra_edges(self, **kwargs) -> dict: # noqa: D102 raise NotImplementedError - def find_inexact_edges(self, **kwargs) -> dict: # noqa: D102 + def find_inexact_edges(self, **kwargs) -> dict: # noqa: D102 raise NotImplementedError - def find_short_edges(self, **kwargs) -> dict: # noqa: D102 + def find_short_edges(self, **kwargs) -> dict: # noqa: D102 raise NotImplementedError - def find_duplicate_faces(self, **kwargs) -> dict: # noqa: D102 + def find_duplicate_faces(self, **kwargs) -> dict: # noqa: D102 raise NotImplementedError - def find_missing_faces(self, **kwargs) -> dict: # noqa: D102 + def find_missing_faces(self, **kwargs) -> dict: # noqa: D102 raise NotImplementedError - def find_small_faces(self, **kwargs) -> dict: # noqa: D102 + def find_small_faces(self, **kwargs) -> dict: # noqa: D102 raise NotImplementedError - def find_stitch_faces(self, **kwargs) -> dict: # noqa: D102 + def find_stitch_faces(self, **kwargs) -> dict: # noqa: D102 raise NotImplementedError - def find_simplify(self, **kwargs) -> dict: # noqa: D102 + def find_simplify(self, **kwargs) -> dict: # noqa: D102 raise NotImplementedError - def find_interferences(self, **kwargs) -> dict: # noqa: D102 + def find_interferences(self, **kwargs) -> dict: # noqa: D102 raise NotImplementedError - def find_and_fix_short_edges(self, **kwargs) -> dict: # noqa: D102 + def find_and_fix_short_edges(self, **kwargs) -> dict: # noqa: D102 raise NotImplementedError - def find_and_fix_extra_edges(self, **kwargs) -> dict: # noqa: D102 + def find_and_fix_extra_edges(self, **kwargs) -> dict: # noqa: D102 raise NotImplementedError - def find_and_fix_split_edges(self, **kwargs) -> dict: # noqa: D102 + def find_and_fix_split_edges(self, **kwargs) -> dict: # noqa: D102 raise NotImplementedError - def find_and_fix_simplify(self, **kwargs) -> dict: # noqa: D102 + def find_and_fix_simplify(self, **kwargs) -> dict: # noqa: D102 raise NotImplementedError - def inspect_geometry(self, **kwargs) -> dict: # noqa: D102 + def inspect_geometry(self, **kwargs) -> dict: # noqa: D102 raise NotImplementedError - def repair_geometry(self, **kwargs) -> dict: # noqa: D102 + def repair_geometry(self, **kwargs) -> dict: # noqa: D102 raise NotImplementedError From 36d9136c95ac52f756ffc12244d9a952a48a00cc Mon Sep 17 00:00:00 2001 From: Umut Soysal Date: Wed, 23 Apr 2025 13:15:10 -0500 Subject: [PATCH 25/58] bs --- src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py b/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py index 9c077cc9e1..9d4b584ef9 100644 --- a/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py +++ b/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py @@ -198,4 +198,9 @@ def find_and_fix_split_edges(self, **kwargs) -> dict: # noqa: D102 distance=kwargs["length"], comprehensive=kwargs["comprehensive_result"], ) + + # Call the gRPC service + response = self.stub.FindSplitEdges(request) + + # Return the response - formatted as a dictionary return self.stub.FindAndFixSplitEdges(request) From 5a0f9f90d22f8923070dc495ee39dc6830f62d5c Mon Sep 17 00:00:00 2001 From: Umut Soysal Date: Wed, 30 Apr 2025 08:59:22 -0500 Subject: [PATCH 26/58] refactoring --- .../core/_grpc/_services/v0/repair_tools.py | 205 ++++++++++++++++-- src/ansys/geometry/core/tools/repair_tools.py | 62 +++--- 2 files changed, 220 insertions(+), 47 deletions(-) diff --git a/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py b/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py index dfc69c2993..ad0d247a64 100644 --- a/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py +++ b/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py @@ -53,7 +53,7 @@ def __init__(self, channel: grpc.Channel): self.stub = RepairToolsStub(channel) @protect_grpc - def find_split_edges(self, **kwargs): # noqa: D102 + def find_split_edges(self, **kwargs) -> dict: # noqa: D102 from ansys.api.geometry.v0.repairtools_pb2 import FindSplitEdgesRequest # Create the request - assumes all inputs are valid and of the proper type @@ -66,21 +66,57 @@ def find_split_edges(self, **kwargs): # noqa: D102 # Call the gRPC service response = self.stub.FindSplitEdges(request) - return self.stub.FindSplitEdges(request) + # Return the response - formatted as a dictionary + return { + "problems": [ + { + "id": res.id, + "edges": res.edge_monikers, + } + for res in response.result + ] + } @protect_grpc def find_extra_edges(self, **kwargs) -> dict: # noqa: D102 from ansys.api.geometry.v0.repairtools_pb2 import FindExtraEdgesRequest + # Create the request - assumes all inputs are valid and of the proper type request = FindExtraEdgesRequest(selection=kwargs["selection"]) - return self.stub.FindExtraEdges(request) + + # Return the response - formatted as a dictionary + response = self.stub.FindExtraEdges(request) + + # Return the response - formatted as a dictionary + return { + "problems": [ + { + "id": res.id, + "edges": res.edge_monikers, + } + for res in response.result + ] + } @protect_grpc def find_inexact_edges(self, **kwargs) -> dict: # noqa: D102 from ansys.api.geometry.v0.repairtools_pb2 import FindInexactEdgesRequest request = FindInexactEdgesRequest(selection=kwargs["selection"]) - return self.stub.FindInexactEdges(request) + + # Call the gRPC service + response = self.stub.FindInexactEdges(request) + + # Return the response - formatted as a dictionary + return { + "problems": [ + { + "id": res.id, + "edges": res.edge_monikers, + } + for res in response.result + ] + } @protect_grpc def find_short_edges(self, **kwargs) -> dict: # noqa: D102 @@ -88,46 +124,118 @@ def find_short_edges(self, **kwargs) -> dict: # noqa: D102 from ansys.api.geometry.v0.repairtools_pb2 import FindShortEdgesRequest + # Create the request - assumes all inputs are valid and of the proper type request = FindShortEdgesRequest( selection=kwargs["selection"], max_edge_length=DoubleValue(value=kwargs["length"]), ) - return self.stub.FindShortEdges(request) + + # Call the gRPC service + response = self.stub.FindShortEdges(request) + + # Return the response - formatted as a dictionary + return { + "problems": [ + { + "id": res.id, + "edges": res.edge_monikers, + } + for res in response.result + ] + } @protect_grpc def find_duplicate_faces(self, **kwargs) -> dict: # noqa: D102 from ansys.api.geometry.v0.repairtools_pb2 import FindDuplicateFacesRequest request = FindDuplicateFacesRequest(faces=kwargs["faces"]) - return self.stub.FindDuplicateFaces(request) + + # Call the gRPC service + response = self.stub.FindDuplicateFaces(request) + + # Return the response - formatted as a dictionary + return { + "problems": [ + { + "id": res.id, + "faces": res.face_monikers, + } + for res in response.result + ] + } @protect_grpc def find_missing_faces(self, **kwargs) -> dict: # noqa: D102 from ansys.api.geometry.v0.repairtools_pb2 import FindMissingFacesRequest request = FindMissingFacesRequest(faces=kwargs["faces"]) - return self.stub.FindMissingFaces(request) + # Call the gRPC service + response = self.stub.FindMissingFaces(request) + # Return the response - formatted as a dictionary + return { + "problems": [ + { + "id": res.id, + "edges": res.edge_monikers, + } + for res in response.result + ] + } @protect_grpc def find_small_faces(self, **kwargs) -> dict: # noqa: D102 from ansys.api.geometry.v0.repairtools_pb2 import FindSmallFacesRequest request = FindSmallFacesRequest(selection=kwargs["selection"]) - return self.stub.FindSmallFaces(request) + # Call the gRPC service + response = self.stub.FindSmallFaces(request) + # Return the response - formatted as a dictionary + return { + "problems": [ + { + "id": res.id, + "faces": res.face_monikers, + } + for res in response.result + ] + } @protect_grpc def find_stitch_faces(self, **kwargs) -> dict: # noqa: D102 from ansys.api.geometry.v0.repairtools_pb2 import FindStitchFacesRequest request = FindStitchFacesRequest(faces=kwargs["faces"]) - return self.stub.FindStitchFaces(request) + # Call the gRPC service + response = self.stub.FindStitchFaces(request) + # Return the response - formatted as a dictionary + return { + "problems": [ + { + "id": res.id, + "bodies": res.body_monikers, + } + for res in response.result + ] + } @protect_grpc def find_simplify(self, **kwargs) -> dict: # noqa: D102 from ansys.api.geometry.v0.repairtools_pb2 import FindAdjustSimplifyRequest request = FindAdjustSimplifyRequest(selection=kwargs["selection"]) - return self.stub.FindAdjustSimplify(request) + + # Call the gRPC service + response = self.stub.FindSimplify(request) + # Return the response - formatted as a dictionary + return { + "problems": [ + { + "id": res.id, + "faces": res.face_monikers, + } + for res in response.result + ] + } @protect_grpc def find_and_fix_simplify(self, **kwargs) -> dict: # noqa: D102 @@ -137,21 +245,54 @@ def find_and_fix_simplify(self, **kwargs) -> dict: # noqa: D102 selection=kwargs["selection"], comprehensive=kwargs["comprehensive_result"], ) - return self.stub.FindAndSimplify(request) + # Call the gRPC service + response = self.stub.FindAndSimplify(request) + # Return the response - formatted as a dictionary + return { + "problems": [ + { + "id": res.id, + "faces": res.face_monikers, + } + for res in response.result + ] + } @protect_grpc def inspect_geometry(self, **kwargs) -> dict: # noqa: D102 from ansys.api.geometry.v0.repairtools_pb2 import InspectGeometryRequest request = InspectGeometryRequest(bodies=kwargs.get("bodies", [])) - return self.stub.InspectGeometry(request) + # Call the gRPC service + response = self.stub.InspectGeometry(request) + # Return the response - formatted as a dictionary + return { + "problems": [ + { + "id": res.id, + "faces": res.face_monikers, + } + for res in response.result + ] + } @protect_grpc def repair_geometry(self, **kwargs) -> dict: # noqa: D102 from ansys.api.geometry.v0.repairtools_pb2 import RepairGeometryRequest request = RepairGeometryRequest(bodies=kwargs.get("bodies", [])) - return self.stub.RepairGeometry(request) + # Call the gRPC service + response = self.stub.RepairGeometry(request) + # Return the response - formatted as a dictionary + return { + "problems": [ + { + "id": res.id, + "faces": res.face_monikers, + } + for res in response.result + ] + } @protect_grpc def find_interferences(self, **kwargs) -> dict: # noqa: D102 @@ -163,7 +304,19 @@ def find_interferences(self, **kwargs) -> dict: # noqa: D102 bodies=kwargs["bodies"], cut_smaller_body=BoolValue(value=kwargs["cut_smaller_body"]), ) - return self.stub.FindInterference(request) + # Call the gRPC service + response = self.stub.FindInterference(request) + + # Return the response - formatted as a dictionary + return { + "problems": [ + { + "id": res.id, + "bodies": res.body_monikers, + } + for res in response.result + ] + } @protect_grpc def find_and_fix_short_edges(self, **kwargs): # noqa: D102 @@ -176,7 +329,19 @@ def find_and_fix_short_edges(self, **kwargs): # noqa: D102 max_edge_length=DoubleValue(value=kwargs["length"]), comprehensive=kwargs["comprehensive_result"], ) - return self.stub.FindAndFixShortEdges(request) + # Call the gRPC service + response = self.stub.FindShortEdges(request) + + # Return the response - formatted as a dictionary + return { + "problems": [ + { + "id": res.id, + "edges": res.edge_monikers, + } + for res in response.result + ] + } @protect_grpc def find_and_fix_extra_edges(self, **kwargs) -> dict: # noqa: D102 @@ -203,4 +368,12 @@ def find_and_fix_split_edges(self, **kwargs) -> dict: # noqa: D102 response = self.stub.FindSplitEdges(request) # Return the response - formatted as a dictionary - return self.stub.FindAndFixSplitEdges(request) + return { + "problems": [ + { + "id": res.id, + "edges": res.edge_monikers, + } + for res in response.result + ] + } diff --git a/src/ansys/geometry/core/tools/repair_tools.py b/src/ansys/geometry/core/tools/repair_tools.py index 000c3e0236..f5bb53661d 100644 --- a/src/ansys/geometry/core/tools/repair_tools.py +++ b/src/ansys/geometry/core/tools/repair_tools.py @@ -23,7 +23,7 @@ from typing import TYPE_CHECKING -from google.protobuf.wrappers_pb2 import BoolValue, DoubleValue +from google.protobuf.wrappers_pb2 import DoubleValue from ansys.api.geometry.v0.models_pb2 import ( InspectGeometryMessageId, @@ -110,11 +110,11 @@ def find_split_edges( parent_design = get_design_from_body(bodies[0]) return [ SplitEdgeProblemAreas( - f"{res.id}", + f"{res['id']}", self._grpc_client, - get_edges_from_ids(parent_design, res.edge_monikers), + get_edges_from_ids(parent_design, res["edges"]), ) - for res in problem_areas_response.result + for res in problem_areas_response["problems"] ] @protect_grpc @@ -145,11 +145,11 @@ def find_extra_edges(self, bodies: list["Body"]) -> list[ExtraEdgeProblemAreas]: return [ ExtraEdgeProblemAreas( - f"{res.id}", + f"{res['id']}", self._grpc_client, - get_edges_from_ids(parent_design, res.edge_monikers), + get_edges_from_ids(parent_design, res["edges"]), ) - for res in problem_areas_response.result + for res in problem_areas_response["problems"] ] @protect_grpc @@ -181,11 +181,11 @@ def find_inexact_edges(self, bodies: list["Body"]) -> list[InexactEdgeProblemAre return [ InexactEdgeProblemAreas( - f"{res.id}", + f"{res['id']}", self._grpc_client, - get_edges_from_ids(parent_design, res.edge_monikers), + get_edges_from_ids(parent_design, res["edges"]), ) - for res in problem_areas_response.result + for res in problem_areas_response["problems"] ] @protect_grpc @@ -219,11 +219,11 @@ def find_short_edges( parent_design = get_design_from_body(bodies[0]) return [ ShortEdgeProblemAreas( - f"{res.id}", + f"{res['id']}", self._grpc_client, - get_edges_from_ids(parent_design, res.edge_monikers), + get_edges_from_ids(parent_design, res["edges"]), ) - for res in problem_areas_response.result + for res in problem_areas_response["problems"] ] @protect_grpc @@ -254,11 +254,11 @@ def find_duplicate_faces(self, bodies: list["Body"]) -> list[DuplicateFaceProble parent_design = get_design_from_body(bodies[0]) return [ DuplicateFaceProblemAreas( - f"{res.id}", + f"{res['id']}", self._grpc_client, - get_faces_from_ids(parent_design, res.face_monikers), + get_faces_from_ids(parent_design, res["faces"]), ) - for res in problem_areas_response.result + for res in problem_areas_response["problems"] ] @protect_grpc @@ -288,11 +288,11 @@ def find_missing_faces(self, bodies: list["Body"]) -> list[MissingFaceProblemAre return [ MissingFaceProblemAreas( - f"{res.id}", + f"{res['id']}", self._grpc_client, - get_edges_from_ids(parent_design, res.edge_monikers), + get_edges_from_ids(parent_design, res["edges"]), ) - for res in problem_areas_response.result + for res in problem_areas_response["problems"] ] @protect_grpc @@ -323,11 +323,11 @@ def find_small_faces(self, bodies: list["Body"]) -> list[SmallFaceProblemAreas]: return [ SmallFaceProblemAreas( - f"{res.id}", + f"{res['id']}", self._grpc_client, - get_faces_from_ids(parent_design, res.face_monikers), + get_faces_from_ids(parent_design, res["faces"]), ) - for res in problem_areas_response.result + for res in problem_areas_response["problems"] ] @protect_grpc @@ -354,11 +354,11 @@ def find_stitch_faces(self, bodies: list["Body"]) -> list[StitchFaceProblemAreas parent_design = get_design_from_body(bodies[0]) return [ StitchFaceProblemAreas( - f"{res.id}", + f"{res['id']}", self._grpc_client, - get_bodies_from_ids(parent_design, res.body_monikers), + get_bodies_from_ids(parent_design, res["bodies"]), ) - for res in problem_areas_response.result + for res in problem_areas_response["problems"] ] @protect_grpc @@ -388,11 +388,11 @@ def find_simplify(self, bodies: list["Body"]) -> list[UnsimplifiedFaceProblemAre return [ UnsimplifiedFaceProblemAreas( - f"{res.id}", + f"{res['id']}", self._grpc_client, get_faces_from_ids(parent_design, res.body_monikers), ) - for res in problem_areas_response.result + for res in problem_areas_response["problems"] ] @protect_grpc @@ -431,18 +431,18 @@ def find_interferences( parent_design = get_design_from_body(bodies[0]) body_ids = [body.id for body in bodies] - cut_smaller_body_bool = BoolValue(value=cut_smaller_body) + # cut_smaller_body_bool = BoolValue(value=cut_smaller_body) problem_areas_response = self._grpc_client.services.repair_tools.find_interferences( bodies=body_ids, cut_smaller_body=cut_smaller_body ) return [ InterferenceProblemAreas( - f"{res.id}", + f"{res['id']}", self._grpc_client, - get_bodies_from_ids(parent_design, res.body_monikers), + get_bodies_from_ids(parent_design, res["bodies"]), ) - for res in problem_areas_response.result + for res in problem_areas_response["problems"] ] @protect_grpc From 4849d4780f2c4c1c9314518e2fdbcf6cc1bd94b1 Mon Sep 17 00:00:00 2001 From: Umut Soysal Date: Wed, 30 Apr 2025 09:10:59 -0500 Subject: [PATCH 27/58] name --- src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py b/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py index ad0d247a64..3c4fbb7146 100644 --- a/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py +++ b/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py @@ -225,7 +225,7 @@ def find_simplify(self, **kwargs) -> dict: # noqa: D102 request = FindAdjustSimplifyRequest(selection=kwargs["selection"]) # Call the gRPC service - response = self.stub.FindSimplify(request) + response = self.stub.FindAndSimplify(request) # Return the response - formatted as a dictionary return { "problems": [ From 45a240385242dcb36185d5807f70c12081d34fe8 Mon Sep 17 00:00:00 2001 From: Umut Soysal Date: Wed, 30 Apr 2025 09:24:45 -0500 Subject: [PATCH 28/58] Update repair_tools.py --- src/ansys/geometry/core/tools/repair_tools.py | 40 +++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/src/ansys/geometry/core/tools/repair_tools.py b/src/ansys/geometry/core/tools/repair_tools.py index f5bb53661d..3bd9a933cc 100644 --- a/src/ansys/geometry/core/tools/repair_tools.py +++ b/src/ansys/geometry/core/tools/repair_tools.py @@ -491,11 +491,11 @@ def find_and_fix_short_edges( parent_design = get_design_from_body(bodies[0]) parent_design._update_design_inplace() message = RepairToolMessage( - response.success, - response.created_bodies_monikers, - response.modified_bodies_monikers, - response.found, - response.repaired, + response['success'], + response['created_bodies'], + response['modified_bodies'], + response["found"], + response["repaired"], ) return message @@ -542,11 +542,11 @@ def find_and_fix_extra_edges( parent_design = get_design_from_body(bodies[0]) parent_design._update_design_inplace() message = RepairToolMessage( - response.success, - response.created_bodies_monikers, - response.modified_bodies_monikers, - response.found, - response.repaired, + response['success'], + response['created_bodies'], + response['modified_bodies'], + response["found"], + response["repaired"], ) return message @@ -606,11 +606,11 @@ def find_and_fix_split_edges( parent_design = get_design_from_body(bodies[0]) parent_design._update_design_inplace() message = RepairToolMessage( - response.success, - response.created_bodies_monikers, - response.modified_bodies_monikers, - response.found, - response.repaired, + response['success'], + response['created_bodies'], + response['modified_bodies'], + response["found"], + response["repaired"], ) return message @@ -656,11 +656,11 @@ def find_and_fix_simplify( parent_design = get_design_from_body(bodies[0]) parent_design._update_design_inplace() message = RepairToolMessage( - response.success, - response.created_bodies_monikers, - response.modified_bodies_monikers, - response.found, - response.repaired, + response['success'], + response['created_bodies'], + response['modified_bodies'], + response["found"], + response["repaired"], ) return message From 5414cad727f70ee534f864be7b730556b6a6d95b Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 30 Apr 2025 14:26:07 +0000 Subject: [PATCH 29/58] chore: auto fixes from pre-commit hooks --- src/ansys/geometry/core/tools/repair_tools.py | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/ansys/geometry/core/tools/repair_tools.py b/src/ansys/geometry/core/tools/repair_tools.py index 3bd9a933cc..75e8d45ab2 100644 --- a/src/ansys/geometry/core/tools/repair_tools.py +++ b/src/ansys/geometry/core/tools/repair_tools.py @@ -491,9 +491,9 @@ def find_and_fix_short_edges( parent_design = get_design_from_body(bodies[0]) parent_design._update_design_inplace() message = RepairToolMessage( - response['success'], - response['created_bodies'], - response['modified_bodies'], + response["success"], + response["created_bodies"], + response["modified_bodies"], response["found"], response["repaired"], ) @@ -542,9 +542,9 @@ def find_and_fix_extra_edges( parent_design = get_design_from_body(bodies[0]) parent_design._update_design_inplace() message = RepairToolMessage( - response['success'], - response['created_bodies'], - response['modified_bodies'], + response["success"], + response["created_bodies"], + response["modified_bodies"], response["found"], response["repaired"], ) @@ -606,9 +606,9 @@ def find_and_fix_split_edges( parent_design = get_design_from_body(bodies[0]) parent_design._update_design_inplace() message = RepairToolMessage( - response['success'], - response['created_bodies'], - response['modified_bodies'], + response["success"], + response["created_bodies"], + response["modified_bodies"], response["found"], response["repaired"], ) @@ -656,9 +656,9 @@ def find_and_fix_simplify( parent_design = get_design_from_body(bodies[0]) parent_design._update_design_inplace() message = RepairToolMessage( - response['success'], - response['created_bodies'], - response['modified_bodies'], + response["success"], + response["created_bodies"], + response["modified_bodies"], response["found"], response["repaired"], ) From 8646ad1a208cbcea8797acc4ed873fccb4a5d9ca Mon Sep 17 00:00:00 2001 From: Umut Soysal Date: Wed, 30 Apr 2025 10:59:04 -0500 Subject: [PATCH 30/58] response refactor --- .../core/_grpc/_services/v0/repair_tools.py | 94 +++++++++---------- src/ansys/geometry/core/tools/repair_tools.py | 10 +- 2 files changed, 51 insertions(+), 53 deletions(-) diff --git a/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py b/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py index 3c4fbb7146..d0db7fd3b8 100644 --- a/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py +++ b/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py @@ -53,7 +53,7 @@ def __init__(self, channel: grpc.Channel): self.stub = RepairToolsStub(channel) @protect_grpc - def find_split_edges(self, **kwargs) -> dict: # noqa: D102 + def find_split_edges(self, **kwargs) -> dict: # noqa: D102 from ansys.api.geometry.v0.repairtools_pb2 import FindSplitEdgesRequest # Create the request - assumes all inputs are valid and of the proper type @@ -67,15 +67,12 @@ def find_split_edges(self, **kwargs) -> dict: # noqa: D102 response = self.stub.FindSplitEdges(request) # Return the response - formatted as a dictionary - return { - "problems": [ - { - "id": res.id, - "edges": res.edge_monikers, + return {"problems":[{ + "id": res.id, + "edges": res.edge_monikers, } - for res in response.result - ] - } + for res in response.result]} + @protect_grpc def find_extra_edges(self, **kwargs) -> dict: # noqa: D102 @@ -88,36 +85,28 @@ def find_extra_edges(self, **kwargs) -> dict: # noqa: D102 response = self.stub.FindExtraEdges(request) # Return the response - formatted as a dictionary - return { - "problems": [ - { - "id": res.id, - "edges": res.edge_monikers, + return {"problems":[{ + "id": res.id, + "edges": res.edge_monikers, } - for res in response.result - ] - } + for res in response.result]} @protect_grpc def find_inexact_edges(self, **kwargs) -> dict: # noqa: D102 from ansys.api.geometry.v0.repairtools_pb2 import FindInexactEdgesRequest request = FindInexactEdgesRequest(selection=kwargs["selection"]) - + # Call the gRPC service response = self.stub.FindInexactEdges(request) # Return the response - formatted as a dictionary - return { - "problems": [ - { - "id": res.id, - "edges": res.edge_monikers, + return {"problems":[{ + "id": res.id, + "edges": res.edge_monikers, } - for res in response.result - ] - } - + for res in response.result]} + @protect_grpc def find_short_edges(self, **kwargs) -> dict: # noqa: D102 from google.protobuf.wrappers_pb2 import DoubleValue @@ -163,11 +152,12 @@ def find_duplicate_faces(self, **kwargs) -> dict: # noqa: D102 for res in response.result ] } - + @protect_grpc def find_missing_faces(self, **kwargs) -> dict: # noqa: D102 from ansys.api.geometry.v0.repairtools_pb2 import FindMissingFacesRequest + request = FindMissingFacesRequest(faces=kwargs["faces"]) # Call the gRPC service response = self.stub.FindMissingFaces(request) @@ -181,7 +171,7 @@ def find_missing_faces(self, **kwargs) -> dict: # noqa: D102 for res in response.result ] } - + @protect_grpc def find_small_faces(self, **kwargs) -> dict: # noqa: D102 from ansys.api.geometry.v0.repairtools_pb2 import FindSmallFacesRequest @@ -204,6 +194,7 @@ def find_small_faces(self, **kwargs) -> dict: # noqa: D102 def find_stitch_faces(self, **kwargs) -> dict: # noqa: D102 from ansys.api.geometry.v0.repairtools_pb2 import FindStitchFacesRequest + request = FindStitchFacesRequest(faces=kwargs["faces"]) # Call the gRPC service response = self.stub.FindStitchFaces(request) @@ -225,7 +216,7 @@ def find_simplify(self, **kwargs) -> dict: # noqa: D102 request = FindAdjustSimplifyRequest(selection=kwargs["selection"]) # Call the gRPC service - response = self.stub.FindAndSimplify(request) + response = self.stub.FindSimplify(request) # Return the response - formatted as a dictionary return { "problems": [ @@ -308,7 +299,7 @@ def find_interferences(self, **kwargs) -> dict: # noqa: D102 response = self.stub.FindInterference(request) # Return the response - formatted as a dictionary - return { + return { "problems": [ { "id": res.id, @@ -317,6 +308,7 @@ def find_interferences(self, **kwargs) -> dict: # noqa: D102 for res in response.result ] } + @protect_grpc def find_and_fix_short_edges(self, **kwargs): # noqa: D102 @@ -330,17 +322,15 @@ def find_and_fix_short_edges(self, **kwargs): # noqa: D102 comprehensive=kwargs["comprehensive_result"], ) # Call the gRPC service - response = self.stub.FindShortEdges(request) + response = self.stub.FindAndFixShortEdges(request) # Return the response - formatted as a dictionary return { - "problems": [ - { - "id": res.id, - "edges": res.edge_monikers, - } - for res in response.result - ] + "success": response.success, + "found": response.found, + "repaired": response.repaired, + "created_bodies_monikers": [], + "modified_bodies_monikers": [], } @protect_grpc @@ -351,7 +341,17 @@ def find_and_fix_extra_edges(self, **kwargs) -> dict: # noqa: D102 selection=kwargs["selection"], comprehensive=kwargs["comprehensive_result"], ) - return self.stub.FindAndFixExtraEdges(request) + # Call the gRPC service + response = self.stub.FindAndFixExtraEdges(request) + + # Return the response - formatted as a dictionary + return { + "success": response.success, + "found": response.found, + "repaired": response.repaired, + "created_bodies_monikers": [], + "modified_bodies_monikers": [], + } @protect_grpc def find_and_fix_split_edges(self, **kwargs) -> dict: # noqa: D102 @@ -365,15 +365,13 @@ def find_and_fix_split_edges(self, **kwargs) -> dict: # noqa: D102 ) # Call the gRPC service - response = self.stub.FindSplitEdges(request) + response = self.stub.FindAndFixSplitEdges(request) # Return the response - formatted as a dictionary return { - "problems": [ - { - "id": res.id, - "edges": res.edge_monikers, - } - for res in response.result - ] + "success": response.success, + "found": response.found, + "repaired": response.repaired, + "created_bodies_monikers": [], + "modified_bodies_monikers": [], } diff --git a/src/ansys/geometry/core/tools/repair_tools.py b/src/ansys/geometry/core/tools/repair_tools.py index 75e8d45ab2..376987adbb 100644 --- a/src/ansys/geometry/core/tools/repair_tools.py +++ b/src/ansys/geometry/core/tools/repair_tools.py @@ -491,11 +491,11 @@ def find_and_fix_short_edges( parent_design = get_design_from_body(bodies[0]) parent_design._update_design_inplace() message = RepairToolMessage( - response["success"], - response["created_bodies"], - response["modified_bodies"], - response["found"], - response["repaired"], + success= response["success"], + found = response["found"], + repaired = response["repaired"], + created_bodies = [], + modified_bodies = [], ) return message From 56f56713de6d37b0270455e94bdf33a1f01039cb Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 30 Apr 2025 15:59:23 +0000 Subject: [PATCH 31/58] chore: auto fixes from pre-commit hooks --- .../core/_grpc/_services/v0/repair_tools.py | 52 +++++++++++-------- src/ansys/geometry/core/tools/repair_tools.py | 10 ++-- 2 files changed, 35 insertions(+), 27 deletions(-) diff --git a/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py b/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py index d0db7fd3b8..37d13632c3 100644 --- a/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py +++ b/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py @@ -53,7 +53,7 @@ def __init__(self, channel: grpc.Channel): self.stub = RepairToolsStub(channel) @protect_grpc - def find_split_edges(self, **kwargs) -> dict: # noqa: D102 + def find_split_edges(self, **kwargs) -> dict: # noqa: D102 from ansys.api.geometry.v0.repairtools_pb2 import FindSplitEdgesRequest # Create the request - assumes all inputs are valid and of the proper type @@ -67,12 +67,15 @@ def find_split_edges(self, **kwargs) -> dict: # noqa: D102 response = self.stub.FindSplitEdges(request) # Return the response - formatted as a dictionary - return {"problems":[{ - "id": res.id, - "edges": res.edge_monikers, + return { + "problems": [ + { + "id": res.id, + "edges": res.edge_monikers, } - for res in response.result]} - + for res in response.result + ] + } @protect_grpc def find_extra_edges(self, **kwargs) -> dict: # noqa: D102 @@ -85,28 +88,36 @@ def find_extra_edges(self, **kwargs) -> dict: # noqa: D102 response = self.stub.FindExtraEdges(request) # Return the response - formatted as a dictionary - return {"problems":[{ - "id": res.id, - "edges": res.edge_monikers, + return { + "problems": [ + { + "id": res.id, + "edges": res.edge_monikers, } - for res in response.result]} + for res in response.result + ] + } @protect_grpc def find_inexact_edges(self, **kwargs) -> dict: # noqa: D102 from ansys.api.geometry.v0.repairtools_pb2 import FindInexactEdgesRequest request = FindInexactEdgesRequest(selection=kwargs["selection"]) - + # Call the gRPC service response = self.stub.FindInexactEdges(request) # Return the response - formatted as a dictionary - return {"problems":[{ - "id": res.id, - "edges": res.edge_monikers, + return { + "problems": [ + { + "id": res.id, + "edges": res.edge_monikers, } - for res in response.result]} - + for res in response.result + ] + } + @protect_grpc def find_short_edges(self, **kwargs) -> dict: # noqa: D102 from google.protobuf.wrappers_pb2 import DoubleValue @@ -152,12 +163,11 @@ def find_duplicate_faces(self, **kwargs) -> dict: # noqa: D102 for res in response.result ] } - + @protect_grpc def find_missing_faces(self, **kwargs) -> dict: # noqa: D102 from ansys.api.geometry.v0.repairtools_pb2 import FindMissingFacesRequest - request = FindMissingFacesRequest(faces=kwargs["faces"]) # Call the gRPC service response = self.stub.FindMissingFaces(request) @@ -171,7 +181,7 @@ def find_missing_faces(self, **kwargs) -> dict: # noqa: D102 for res in response.result ] } - + @protect_grpc def find_small_faces(self, **kwargs) -> dict: # noqa: D102 from ansys.api.geometry.v0.repairtools_pb2 import FindSmallFacesRequest @@ -194,7 +204,6 @@ def find_small_faces(self, **kwargs) -> dict: # noqa: D102 def find_stitch_faces(self, **kwargs) -> dict: # noqa: D102 from ansys.api.geometry.v0.repairtools_pb2 import FindStitchFacesRequest - request = FindStitchFacesRequest(faces=kwargs["faces"]) # Call the gRPC service response = self.stub.FindStitchFaces(request) @@ -299,7 +308,7 @@ def find_interferences(self, **kwargs) -> dict: # noqa: D102 response = self.stub.FindInterference(request) # Return the response - formatted as a dictionary - return { + return { "problems": [ { "id": res.id, @@ -308,7 +317,6 @@ def find_interferences(self, **kwargs) -> dict: # noqa: D102 for res in response.result ] } - @protect_grpc def find_and_fix_short_edges(self, **kwargs): # noqa: D102 diff --git a/src/ansys/geometry/core/tools/repair_tools.py b/src/ansys/geometry/core/tools/repair_tools.py index 376987adbb..4b95db4a31 100644 --- a/src/ansys/geometry/core/tools/repair_tools.py +++ b/src/ansys/geometry/core/tools/repair_tools.py @@ -491,11 +491,11 @@ def find_and_fix_short_edges( parent_design = get_design_from_body(bodies[0]) parent_design._update_design_inplace() message = RepairToolMessage( - success= response["success"], - found = response["found"], - repaired = response["repaired"], - created_bodies = [], - modified_bodies = [], + success=response["success"], + found=response["found"], + repaired=response["repaired"], + created_bodies=[], + modified_bodies=[], ) return message From 2c650d5f2b0c926bb00e31913bb6b038bda28c5f Mon Sep 17 00:00:00 2001 From: Umut Soysal Date: Wed, 30 Apr 2025 11:16:43 -0500 Subject: [PATCH 32/58] further ref --- .../core/_grpc/_services/v0/repair_tools.py | 54 +++++++++++-------- src/ansys/geometry/core/tools/repair_tools.py | 22 ++++---- 2 files changed, 42 insertions(+), 34 deletions(-) diff --git a/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py b/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py index d0db7fd3b8..023e95c96f 100644 --- a/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py +++ b/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py @@ -53,7 +53,7 @@ def __init__(self, channel: grpc.Channel): self.stub = RepairToolsStub(channel) @protect_grpc - def find_split_edges(self, **kwargs) -> dict: # noqa: D102 + def find_split_edges(self, **kwargs) -> dict: # noqa: D102 from ansys.api.geometry.v0.repairtools_pb2 import FindSplitEdgesRequest # Create the request - assumes all inputs are valid and of the proper type @@ -67,12 +67,15 @@ def find_split_edges(self, **kwargs) -> dict: # noqa: D102 response = self.stub.FindSplitEdges(request) # Return the response - formatted as a dictionary - return {"problems":[{ - "id": res.id, - "edges": res.edge_monikers, + return { + "problems": [ + { + "id": res.id, + "edges": res.edge_monikers, } - for res in response.result]} - + for res in response.result + ] + } @protect_grpc def find_extra_edges(self, **kwargs) -> dict: # noqa: D102 @@ -85,28 +88,36 @@ def find_extra_edges(self, **kwargs) -> dict: # noqa: D102 response = self.stub.FindExtraEdges(request) # Return the response - formatted as a dictionary - return {"problems":[{ - "id": res.id, - "edges": res.edge_monikers, + return { + "problems": [ + { + "id": res.id, + "edges": res.edge_monikers, } - for res in response.result]} + for res in response.result + ] + } @protect_grpc def find_inexact_edges(self, **kwargs) -> dict: # noqa: D102 from ansys.api.geometry.v0.repairtools_pb2 import FindInexactEdgesRequest request = FindInexactEdgesRequest(selection=kwargs["selection"]) - + # Call the gRPC service response = self.stub.FindInexactEdges(request) # Return the response - formatted as a dictionary - return {"problems":[{ - "id": res.id, - "edges": res.edge_monikers, + return { + "problems": [ + { + "id": res.id, + "edges": res.edge_monikers, } - for res in response.result]} - + for res in response.result + ] + } + @protect_grpc def find_short_edges(self, **kwargs) -> dict: # noqa: D102 from google.protobuf.wrappers_pb2 import DoubleValue @@ -152,12 +163,11 @@ def find_duplicate_faces(self, **kwargs) -> dict: # noqa: D102 for res in response.result ] } - + @protect_grpc def find_missing_faces(self, **kwargs) -> dict: # noqa: D102 from ansys.api.geometry.v0.repairtools_pb2 import FindMissingFacesRequest - request = FindMissingFacesRequest(faces=kwargs["faces"]) # Call the gRPC service response = self.stub.FindMissingFaces(request) @@ -171,7 +181,7 @@ def find_missing_faces(self, **kwargs) -> dict: # noqa: D102 for res in response.result ] } - + @protect_grpc def find_small_faces(self, **kwargs) -> dict: # noqa: D102 from ansys.api.geometry.v0.repairtools_pb2 import FindSmallFacesRequest @@ -194,7 +204,6 @@ def find_small_faces(self, **kwargs) -> dict: # noqa: D102 def find_stitch_faces(self, **kwargs) -> dict: # noqa: D102 from ansys.api.geometry.v0.repairtools_pb2 import FindStitchFacesRequest - request = FindStitchFacesRequest(faces=kwargs["faces"]) # Call the gRPC service response = self.stub.FindStitchFaces(request) @@ -216,7 +225,7 @@ def find_simplify(self, **kwargs) -> dict: # noqa: D102 request = FindAdjustSimplifyRequest(selection=kwargs["selection"]) # Call the gRPC service - response = self.stub.FindSimplify(request) + response = self.stub.FindAndSimplify(request) # Return the response - formatted as a dictionary return { "problems": [ @@ -299,7 +308,7 @@ def find_interferences(self, **kwargs) -> dict: # noqa: D102 response = self.stub.FindInterference(request) # Return the response - formatted as a dictionary - return { + return { "problems": [ { "id": res.id, @@ -308,7 +317,6 @@ def find_interferences(self, **kwargs) -> dict: # noqa: D102 for res in response.result ] } - @protect_grpc def find_and_fix_short_edges(self, **kwargs): # noqa: D102 diff --git a/src/ansys/geometry/core/tools/repair_tools.py b/src/ansys/geometry/core/tools/repair_tools.py index 376987adbb..9a181e36d7 100644 --- a/src/ansys/geometry/core/tools/repair_tools.py +++ b/src/ansys/geometry/core/tools/repair_tools.py @@ -491,11 +491,11 @@ def find_and_fix_short_edges( parent_design = get_design_from_body(bodies[0]) parent_design._update_design_inplace() message = RepairToolMessage( - success= response["success"], - found = response["found"], - repaired = response["repaired"], - created_bodies = [], - modified_bodies = [], + success=response["success"], + found=response["found"], + repaired=response["repaired"], + created_bodies=[], + modified_bodies=[], ) return message @@ -543,8 +543,8 @@ def find_and_fix_extra_edges( parent_design._update_design_inplace() message = RepairToolMessage( response["success"], - response["created_bodies"], - response["modified_bodies"], + response["created_bodies_monikers"], + response["modified_bodies_monikers"], response["found"], response["repaired"], ) @@ -607,8 +607,8 @@ def find_and_fix_split_edges( parent_design._update_design_inplace() message = RepairToolMessage( response["success"], - response["created_bodies"], - response["modified_bodies"], + response["created_bodies_monikers"], + response["modified_bodies_monikers"], response["found"], response["repaired"], ) @@ -657,8 +657,8 @@ def find_and_fix_simplify( parent_design._update_design_inplace() message = RepairToolMessage( response["success"], - response["created_bodies"], - response["modified_bodies"], + response["created_bodies_monikers"], + response["modified_bodies_monikers"], response["found"], response["repaired"], ) From 10587e59ec57f1a69114ea3ec8b0fe2690d0f429 Mon Sep 17 00:00:00 2001 From: Umut Soysal Date: Wed, 30 Apr 2025 11:49:37 -0500 Subject: [PATCH 33/58] further refctrng --- src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py | 4 ++-- src/ansys/geometry/core/tools/repair_tools.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py b/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py index 023e95c96f..201a0b9ba5 100644 --- a/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py +++ b/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py @@ -225,13 +225,13 @@ def find_simplify(self, **kwargs) -> dict: # noqa: D102 request = FindAdjustSimplifyRequest(selection=kwargs["selection"]) # Call the gRPC service - response = self.stub.FindAndSimplify(request) + response = self.stub.FindAdjustSimplify(request) # Return the response - formatted as a dictionary return { "problems": [ { "id": res.id, - "faces": res.face_monikers, + "bodies": res.body_monikers, } for res in response.result ] diff --git a/src/ansys/geometry/core/tools/repair_tools.py b/src/ansys/geometry/core/tools/repair_tools.py index 9a181e36d7..c86e42ab47 100644 --- a/src/ansys/geometry/core/tools/repair_tools.py +++ b/src/ansys/geometry/core/tools/repair_tools.py @@ -390,7 +390,7 @@ def find_simplify(self, bodies: list["Body"]) -> list[UnsimplifiedFaceProblemAre UnsimplifiedFaceProblemAreas( f"{res['id']}", self._grpc_client, - get_faces_from_ids(parent_design, res.body_monikers), + get_faces_from_ids(parent_design, res["bodies"]), ) for res in problem_areas_response["problems"] ] From 3e5589dbc1039878bc4702569ddaaed55e1d9b2c Mon Sep 17 00:00:00 2001 From: Umut Soysal Date: Wed, 30 Apr 2025 13:16:39 -0500 Subject: [PATCH 34/58] Update repair_tools.py --- src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py b/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py index 201a0b9ba5..76400e1986 100644 --- a/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py +++ b/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py @@ -357,8 +357,8 @@ def find_and_fix_extra_edges(self, **kwargs) -> dict: # noqa: D102 "success": response.success, "found": response.found, "repaired": response.repaired, - "created_bodies_monikers": [], - "modified_bodies_monikers": [], + "created_bodies_monikers": response.created_bodies_monikers, + "modified_bodies_monikers": response.modified_bodies_monikers, } @protect_grpc From 7e20d8e8267918681f2f19a221d1df2089b89a81 Mon Sep 17 00:00:00 2001 From: Umut Soysal Date: Fri, 2 May 2025 10:00:48 -0500 Subject: [PATCH 35/58] blind push bc this test is not working in discovery --- .../core/_grpc/_services/v0/repair_tools.py | 82 +++++++++++++------ src/ansys/geometry/core/tools/repair_tools.py | 37 +-------- 2 files changed, 62 insertions(+), 57 deletions(-) diff --git a/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py b/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py index 76400e1986..0f10304aad 100644 --- a/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py +++ b/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py @@ -29,9 +29,18 @@ import grpc from ansys.geometry.core.errors import protect_grpc +from ansys.geometry.core.misc.auxiliary import get_bodies_from_ids +from ansys.geometry.core.tools.check_geometry import GeometryIssue, InspectResult from ..base.repair_tools import GRPCRepairToolsService +from ansys.api.geometry.v0.models_pb2 import ( + InspectGeometryMessageId, + InspectGeometryMessageType, + InspectGeometryResult, + InspectGeometryResultIssue, +) + class GRPCRepairToolsServiceV0(GRPCRepairToolsService): # noqa: D102 """Repair tools service for gRPC communication with the Geometry server. @@ -249,32 +258,63 @@ def find_and_fix_simplify(self, **kwargs) -> dict: # noqa: D102 response = self.stub.FindAndSimplify(request) # Return the response - formatted as a dictionary return { - "problems": [ - { - "id": res.id, - "faces": res.face_monikers, - } - for res in response.result - ] + "success": response.success, + "found": response.found, + "repaired": response.repaired, + "created_bodies_monikers": [], + "modified_bodies_monikers": [], } @protect_grpc def inspect_geometry(self, **kwargs) -> dict: # noqa: D102 from ansys.api.geometry.v0.repairtools_pb2 import InspectGeometryRequest + parent_design = kwargs.get("parent_design") request = InspectGeometryRequest(bodies=kwargs.get("bodies", [])) # Call the gRPC service - response = self.stub.InspectGeometry(request) + inspect_result_response = self.stub.InspectGeometry(request) # Return the response - formatted as a dictionary - return { - "problems": [ - { - "id": res.id, - "faces": res.face_monikers, - } - for res in response.result - ] - } + + result = self.__create_inspect_result_from_response( + parent_design, inspect_result_response.issues_by_body + ) + + return result + + + def __create_inspect_result_from_response( + self, design, inspect_geometry_results: list[InspectGeometryResult] + ) -> list[InspectResult]: + inspect_results = [] + for inspect_geometry_result in inspect_geometry_results: + body = get_bodies_from_ids(design, [inspect_geometry_result.body.id]) + issues = self.__create_issues_from_response(inspect_geometry_result.issues) + inspect_result = InspectResult( + grpc_client=self._grpc_client, body=body[0], issues=issues + ) + inspect_results.append(inspect_result) + + return inspect_results + + def __create_issues_from_response( + self, + inspect_geometry_result_issues: list[InspectGeometryResultIssue], + ) -> list[GeometryIssue]: + issues = [] + for inspect_result_issue in inspect_geometry_result_issues: + message_type = InspectGeometryMessageType.Name(inspect_result_issue.message_type) + message_id = InspectGeometryMessageId.Name(inspect_result_issue.message_id) + message = inspect_result_issue.message + + issue = GeometryIssue( + message_type=message_type, + message_id=message_id, + message=message, + faces=[face.id for face in inspect_result_issue.faces], + edges=[edge.id for edge in inspect_result_issue.edges], + ) + issues.append(issue) + return issues @protect_grpc def repair_geometry(self, **kwargs) -> dict: # noqa: D102 @@ -285,13 +325,7 @@ def repair_geometry(self, **kwargs) -> dict: # noqa: D102 response = self.stub.RepairGeometry(request) # Return the response - formatted as a dictionary return { - "problems": [ - { - "id": res.id, - "faces": res.face_monikers, - } - for res in response.result - ] + "success": response.result.success, } @protect_grpc diff --git a/src/ansys/geometry/core/tools/repair_tools.py b/src/ansys/geometry/core/tools/repair_tools.py index c86e42ab47..ad0efca416 100644 --- a/src/ansys/geometry/core/tools/repair_tools.py +++ b/src/ansys/geometry/core/tools/repair_tools.py @@ -686,45 +686,16 @@ def inspect_geometry(self, bodies: list["Body"] = None) -> list[InspectResult]: parent_design = self._modeler.get_active_design() body_ids = [] if bodies is None else [body._grpc_id for body in bodies] inspect_result_response = self._grpc_client.services.repair_tools.inspect_geometry( + parent_design = parent_design, bodies=body_ids ) return self.__create_inspect_result_from_response( - parent_design, inspect_result_response.issues_by_body + parent_design, inspect_result_response["issues_by_body"] ) - def __create_inspect_result_from_response( - self, design, inspect_geometry_results: list[InspectGeometryResult] - ) -> list[InspectResult]: - inspect_results = [] - for inspect_geometry_result in inspect_geometry_results: - body = get_bodies_from_ids(design, [inspect_geometry_result.body.id]) - issues = self.__create_issues_from_response(inspect_geometry_result.issues) - inspect_result = InspectResult( - grpc_client=self._grpc_client, body=body[0], issues=issues - ) - inspect_results.append(inspect_result) - return inspect_results - def __create_issues_from_response( - self, - inspect_geometry_result_issues: list[InspectGeometryResultIssue], - ) -> list[GeometryIssue]: - issues = [] - for inspect_result_issue in inspect_geometry_result_issues: - message_type = InspectGeometryMessageType.Name(inspect_result_issue.message_type) - message_id = InspectGeometryMessageId.Name(inspect_result_issue.message_id) - message = inspect_result_issue.message - - issue = GeometryIssue( - message_type=message_type, - message_id=message_id, - message=message, - faces=[face.id for face in inspect_result_issue.faces], - edges=[edge.id for edge in inspect_result_issue.edges], - ) - issues.append(issue) - return issues + @protect_grpc @min_backend_version(25, 2, 0) @@ -749,5 +720,5 @@ def repair_geometry(self, bodies: list["Body"] = None) -> RepairToolMessage: bodies=body_ids ) - message = RepairToolMessage(repair_result_response.result.success, [], []) + message = RepairToolMessage(repair_result_response["success"], [], []) return message From 6b744f1cc3826eb50c9f039aa4238dc310a599de Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 2 May 2025 15:01:01 +0000 Subject: [PATCH 36/58] chore: auto fixes from pre-commit hooks --- .../core/_grpc/_services/v0/repair_tools.py | 20 +++++++++---------- src/ansys/geometry/core/tools/repair_tools.py | 15 ++------------ 2 files changed, 11 insertions(+), 24 deletions(-) diff --git a/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py b/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py index 0f10304aad..f8848f7fb7 100644 --- a/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py +++ b/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py @@ -28,18 +28,17 @@ import grpc -from ansys.geometry.core.errors import protect_grpc -from ansys.geometry.core.misc.auxiliary import get_bodies_from_ids -from ansys.geometry.core.tools.check_geometry import GeometryIssue, InspectResult - -from ..base.repair_tools import GRPCRepairToolsService - from ansys.api.geometry.v0.models_pb2 import ( InspectGeometryMessageId, InspectGeometryMessageType, InspectGeometryResult, InspectGeometryResultIssue, ) +from ansys.geometry.core.errors import protect_grpc +from ansys.geometry.core.misc.auxiliary import get_bodies_from_ids +from ansys.geometry.core.tools.check_geometry import GeometryIssue, InspectResult + +from ..base.repair_tools import GRPCRepairToolsService class GRPCRepairToolsServiceV0(GRPCRepairToolsService): # noqa: D102 @@ -274,14 +273,13 @@ def inspect_geometry(self, **kwargs) -> dict: # noqa: D102 # Call the gRPC service inspect_result_response = self.stub.InspectGeometry(request) # Return the response - formatted as a dictionary - + result = self.__create_inspect_result_from_response( - parent_design, inspect_result_response.issues_by_body + parent_design, inspect_result_response.issues_by_body ) return result - - + def __create_inspect_result_from_response( self, design, inspect_geometry_results: list[InspectGeometryResult] ) -> list[InspectResult]: @@ -295,7 +293,7 @@ def __create_inspect_result_from_response( inspect_results.append(inspect_result) return inspect_results - + def __create_issues_from_response( self, inspect_geometry_result_issues: list[InspectGeometryResultIssue], diff --git a/src/ansys/geometry/core/tools/repair_tools.py b/src/ansys/geometry/core/tools/repair_tools.py index ad0efca416..bbda084af6 100644 --- a/src/ansys/geometry/core/tools/repair_tools.py +++ b/src/ansys/geometry/core/tools/repair_tools.py @@ -25,12 +25,6 @@ from google.protobuf.wrappers_pb2 import DoubleValue -from ansys.api.geometry.v0.models_pb2 import ( - InspectGeometryMessageId, - InspectGeometryMessageType, - InspectGeometryResult, - InspectGeometryResultIssue, -) from ansys.geometry.core.connection import GrpcClient from ansys.geometry.core.errors import protect_grpc from ansys.geometry.core.misc.auxiliary import ( @@ -44,7 +38,7 @@ check_type_all_elements_in_iterable, min_backend_version, ) -from ansys.geometry.core.tools.check_geometry import GeometryIssue, InspectResult +from ansys.geometry.core.tools.check_geometry import InspectResult from ansys.geometry.core.tools.problem_areas import ( DuplicateFaceProblemAreas, ExtraEdgeProblemAreas, @@ -686,17 +680,12 @@ def inspect_geometry(self, bodies: list["Body"] = None) -> list[InspectResult]: parent_design = self._modeler.get_active_design() body_ids = [] if bodies is None else [body._grpc_id for body in bodies] inspect_result_response = self._grpc_client.services.repair_tools.inspect_geometry( - parent_design = parent_design, - bodies=body_ids + parent_design=parent_design, bodies=body_ids ) return self.__create_inspect_result_from_response( parent_design, inspect_result_response["issues_by_body"] ) - - - - @protect_grpc @min_backend_version(25, 2, 0) def repair_geometry(self, bodies: list["Body"] = None) -> RepairToolMessage: From cc00bbaccd265c69e361da94fcbb8c673baaa21c Mon Sep 17 00:00:00 2001 From: Umut Soysal Date: Fri, 2 May 2025 11:04:38 -0500 Subject: [PATCH 37/58] updates --- .../core/_grpc/_services/v0/repair_tools.py | 10 +--- src/ansys/geometry/core/tools/repair_tools.py | 48 +++++++++++++++++-- 2 files changed, 46 insertions(+), 12 deletions(-) diff --git a/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py b/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py index f8848f7fb7..1a81e28355 100644 --- a/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py +++ b/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py @@ -268,17 +268,12 @@ def find_and_fix_simplify(self, **kwargs) -> dict: # noqa: D102 def inspect_geometry(self, **kwargs) -> dict: # noqa: D102 from ansys.api.geometry.v0.repairtools_pb2 import InspectGeometryRequest - parent_design = kwargs.get("parent_design") request = InspectGeometryRequest(bodies=kwargs.get("bodies", [])) # Call the gRPC service inspect_result_response = self.stub.InspectGeometry(request) # Return the response - formatted as a dictionary - result = self.__create_inspect_result_from_response( - parent_design, inspect_result_response.issues_by_body - ) - - return result + return inspect_result_response def __create_inspect_result_from_response( self, design, inspect_geometry_results: list[InspectGeometryResult] @@ -287,8 +282,7 @@ def __create_inspect_result_from_response( for inspect_geometry_result in inspect_geometry_results: body = get_bodies_from_ids(design, [inspect_geometry_result.body.id]) issues = self.__create_issues_from_response(inspect_geometry_result.issues) - inspect_result = InspectResult( - grpc_client=self._grpc_client, body=body[0], issues=issues + inspect_result = InspectResult(body=body[0], issues=issues ) inspect_results.append(inspect_result) diff --git a/src/ansys/geometry/core/tools/repair_tools.py b/src/ansys/geometry/core/tools/repair_tools.py index bbda084af6..d3ec6674a8 100644 --- a/src/ansys/geometry/core/tools/repair_tools.py +++ b/src/ansys/geometry/core/tools/repair_tools.py @@ -25,6 +25,13 @@ from google.protobuf.wrappers_pb2 import DoubleValue +from ansys.api.geometry.v0.models_pb2 import ( + InspectGeometryMessageId, + InspectGeometryMessageType, + InspectGeometryResult, + InspectGeometryResultIssue, +) + from ansys.geometry.core.connection import GrpcClient from ansys.geometry.core.errors import protect_grpc from ansys.geometry.core.misc.auxiliary import ( @@ -38,7 +45,7 @@ check_type_all_elements_in_iterable, min_backend_version, ) -from ansys.geometry.core.tools.check_geometry import InspectResult +from ansys.geometry.core.tools.check_geometry import GeometryIssue, InspectResult from ansys.geometry.core.tools.problem_areas import ( DuplicateFaceProblemAreas, ExtraEdgeProblemAreas, @@ -658,8 +665,6 @@ def find_and_fix_simplify( ) return message - @protect_grpc - @min_backend_version(25, 2, 0) def inspect_geometry(self, bodies: list["Body"] = None) -> list[InspectResult]: """Return a list of geometry issues organized by body. @@ -683,8 +688,43 @@ def inspect_geometry(self, bodies: list["Body"] = None) -> list[InspectResult]: parent_design=parent_design, bodies=body_ids ) return self.__create_inspect_result_from_response( - parent_design, inspect_result_response["issues_by_body"] + parent_design, inspect_result_response.issues_by_body ) + + def __create_inspect_result_from_response( + self, design, inspect_geometry_results: list[InspectGeometryResult] + ) -> list[InspectResult]: + inspect_results = [] + for inspect_geometry_result in inspect_geometry_results: + body = get_bodies_from_ids(design, [inspect_geometry_result.body.id]) + issues = self.__create_issues_from_response(inspect_geometry_result.issues) + inspect_result = InspectResult( + grpc_client=self._grpc_client, body=body[0], issues=issues + ) + inspect_results.append(inspect_result) + + return inspect_results + + def __create_issues_from_response( + self, + inspect_geometry_result_issues: list[InspectGeometryResultIssue], + ) -> list[GeometryIssue]: + issues = [] + for inspect_result_issue in inspect_geometry_result_issues: + message_type = InspectGeometryMessageType.Name(inspect_result_issue.message_type) + message_id = InspectGeometryMessageId.Name(inspect_result_issue.message_id) + message = inspect_result_issue.message + + issue = GeometryIssue( + message_type=message_type, + message_id=message_id, + message=message, + faces=[face.id for face in inspect_result_issue.faces], + edges=[edge.id for edge in inspect_result_issue.edges], + ) + issues.append(issue) + return issues + @protect_grpc @min_backend_version(25, 2, 0) From 0fe131bf1746a853f98bfc68822788fdaa1be560 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 2 May 2025 16:04:50 +0000 Subject: [PATCH 38/58] chore: auto fixes from pre-commit hooks --- src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py | 3 +-- src/ansys/geometry/core/tools/repair_tools.py | 4 +--- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py b/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py index 1a81e28355..98c0126bcf 100644 --- a/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py +++ b/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py @@ -282,8 +282,7 @@ def __create_inspect_result_from_response( for inspect_geometry_result in inspect_geometry_results: body = get_bodies_from_ids(design, [inspect_geometry_result.body.id]) issues = self.__create_issues_from_response(inspect_geometry_result.issues) - inspect_result = InspectResult(body=body[0], issues=issues - ) + inspect_result = InspectResult(body=body[0], issues=issues) inspect_results.append(inspect_result) return inspect_results diff --git a/src/ansys/geometry/core/tools/repair_tools.py b/src/ansys/geometry/core/tools/repair_tools.py index d3ec6674a8..c3c2d8a23e 100644 --- a/src/ansys/geometry/core/tools/repair_tools.py +++ b/src/ansys/geometry/core/tools/repair_tools.py @@ -31,7 +31,6 @@ InspectGeometryResult, InspectGeometryResultIssue, ) - from ansys.geometry.core.connection import GrpcClient from ansys.geometry.core.errors import protect_grpc from ansys.geometry.core.misc.auxiliary import ( @@ -690,7 +689,7 @@ def inspect_geometry(self, bodies: list["Body"] = None) -> list[InspectResult]: return self.__create_inspect_result_from_response( parent_design, inspect_result_response.issues_by_body ) - + def __create_inspect_result_from_response( self, design, inspect_geometry_results: list[InspectGeometryResult] ) -> list[InspectResult]: @@ -725,7 +724,6 @@ def __create_issues_from_response( issues.append(issue) return issues - @protect_grpc @min_backend_version(25, 2, 0) def repair_geometry(self, bodies: list["Body"] = None) -> RepairToolMessage: From 7ad68f91fbbadba0d8fa816dadbee689018f695c Mon Sep 17 00:00:00 2001 From: Umut Soysal Date: Fri, 2 May 2025 11:26:31 -0500 Subject: [PATCH 39/58] removal of unused files --- .../core/_grpc/_services/v0/repair_tools.py | 31 ------------------- 1 file changed, 31 deletions(-) diff --git a/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py b/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py index 98c0126bcf..25c2f5324e 100644 --- a/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py +++ b/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py @@ -275,37 +275,6 @@ def inspect_geometry(self, **kwargs) -> dict: # noqa: D102 return inspect_result_response - def __create_inspect_result_from_response( - self, design, inspect_geometry_results: list[InspectGeometryResult] - ) -> list[InspectResult]: - inspect_results = [] - for inspect_geometry_result in inspect_geometry_results: - body = get_bodies_from_ids(design, [inspect_geometry_result.body.id]) - issues = self.__create_issues_from_response(inspect_geometry_result.issues) - inspect_result = InspectResult(body=body[0], issues=issues) - inspect_results.append(inspect_result) - - return inspect_results - - def __create_issues_from_response( - self, - inspect_geometry_result_issues: list[InspectGeometryResultIssue], - ) -> list[GeometryIssue]: - issues = [] - for inspect_result_issue in inspect_geometry_result_issues: - message_type = InspectGeometryMessageType.Name(inspect_result_issue.message_type) - message_id = InspectGeometryMessageId.Name(inspect_result_issue.message_id) - message = inspect_result_issue.message - - issue = GeometryIssue( - message_type=message_type, - message_id=message_id, - message=message, - faces=[face.id for face in inspect_result_issue.faces], - edges=[edge.id for edge in inspect_result_issue.edges], - ) - issues.append(issue) - return issues @protect_grpc def repair_geometry(self, **kwargs) -> dict: # noqa: D102 From cb9a20dbfebfde9c59375a3478ba0fa81a87f650 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 2 May 2025 16:33:19 +0000 Subject: [PATCH 40/58] chore: auto fixes from pre-commit hooks --- .../geometry/core/_grpc/_services/v0/repair_tools.py | 9 --------- 1 file changed, 9 deletions(-) diff --git a/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py b/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py index 25c2f5324e..92fc6306c0 100644 --- a/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py +++ b/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py @@ -28,15 +28,7 @@ import grpc -from ansys.api.geometry.v0.models_pb2 import ( - InspectGeometryMessageId, - InspectGeometryMessageType, - InspectGeometryResult, - InspectGeometryResultIssue, -) from ansys.geometry.core.errors import protect_grpc -from ansys.geometry.core.misc.auxiliary import get_bodies_from_ids -from ansys.geometry.core.tools.check_geometry import GeometryIssue, InspectResult from ..base.repair_tools import GRPCRepairToolsService @@ -275,7 +267,6 @@ def inspect_geometry(self, **kwargs) -> dict: # noqa: D102 return inspect_result_response - @protect_grpc def repair_geometry(self, **kwargs) -> dict: # noqa: D102 from ansys.api.geometry.v0.repairtools_pb2 import RepairGeometryRequest From 2d69f135310bf6e243ad4e6ee0e852d59883683d Mon Sep 17 00:00:00 2001 From: Umut Soysal Date: Fri, 2 May 2025 12:13:04 -0500 Subject: [PATCH 41/58] further simplifications --- .../core/_grpc/_services/v0/repair_tools.py | 69 ++++++++++++++++--- src/ansys/geometry/core/tools/repair_tools.py | 37 +++++----- 2 files changed, 75 insertions(+), 31 deletions(-) diff --git a/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py b/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py index 25c2f5324e..e4cbe43cc5 100644 --- a/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py +++ b/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py @@ -28,15 +28,7 @@ import grpc -from ansys.api.geometry.v0.models_pb2 import ( - InspectGeometryMessageId, - InspectGeometryMessageType, - InspectGeometryResult, - InspectGeometryResultIssue, -) from ansys.geometry.core.errors import protect_grpc -from ansys.geometry.core.misc.auxiliary import get_bodies_from_ids -from ansys.geometry.core.tools.check_geometry import GeometryIssue, InspectResult from ..base.repair_tools import GRPCRepairToolsService @@ -272,9 +264,7 @@ def inspect_geometry(self, **kwargs) -> dict: # noqa: D102 # Call the gRPC service inspect_result_response = self.stub.InspectGeometry(request) # Return the response - formatted as a dictionary - - return inspect_result_response - + return self.serialize_inspect_result_response(inspect_result_response) @protect_grpc def repair_geometry(self, **kwargs) -> dict: # noqa: D102 @@ -377,3 +367,60 @@ def find_and_fix_split_edges(self, **kwargs) -> dict: # noqa: D102 "created_bodies_monikers": [], "modified_bodies_monikers": [], } + + @staticmethod + def serialize_inspect_result_response(response) -> dict: + """Serialize the InspectGeometryResponse to a dictionary.""" + + def serialize_body(body): + return { + "id": body.id, + "name": body.name, + "can_suppress": body.can_suppress, + "transform_to_master": { + "m00": body.transform_to_master.m00, + "m11": body.transform_to_master.m11, + "m22": body.transform_to_master.m22, + "m33": body.transform_to_master.m33, + }, + "master_id": body.master_id, + "parent_id": body.parent_id, + } + + def serialize_face(face): + return { + "id": face.id, + "surface_type": face.surface_type, + "export_id": face.export_id, + "is_reversed": getattr(face, "is_reversed", False), + "parent_id": face.parent_id.id, + } + + def serialize_edge(edge): + return { + "id": edge.id, + "curve_type": edge.curve_type, + "export_id": edge.export_id, + "length": edge.length, + "owner_id": edge.owner_id, + "parent": serialize_body(edge.parent) if hasattr(edge, "parent") else None, + } + + def serialize_issue(issue): + return { + "message_type": issue.message_type, + "message_id": issue.message_id, + "message": issue.message, + "faces": [serialize_face(f) for f in issue.faces], + "edges": [serialize_edge(e) for e in issue.edges], + } + + return { + "issues_by_body": [ + { + "body": serialize_body(body_issues.body), + "issues": [serialize_issue(i) for i in body_issues.issues], + } + for body_issues in response.issues_by_body + ] + } diff --git a/src/ansys/geometry/core/tools/repair_tools.py b/src/ansys/geometry/core/tools/repair_tools.py index c3c2d8a23e..98c50dab2a 100644 --- a/src/ansys/geometry/core/tools/repair_tools.py +++ b/src/ansys/geometry/core/tools/repair_tools.py @@ -25,12 +25,6 @@ from google.protobuf.wrappers_pb2 import DoubleValue -from ansys.api.geometry.v0.models_pb2 import ( - InspectGeometryMessageId, - InspectGeometryMessageType, - InspectGeometryResult, - InspectGeometryResultIssue, -) from ansys.geometry.core.connection import GrpcClient from ansys.geometry.core.errors import protect_grpc from ansys.geometry.core.misc.auxiliary import ( @@ -683,20 +677,20 @@ def inspect_geometry(self, bodies: list["Body"] = None) -> list[InspectResult]: """ parent_design = self._modeler.get_active_design() body_ids = [] if bodies is None else [body._grpc_id for body in bodies] - inspect_result_response = self._grpc_client.services.repair_tools.inspect_geometry( + inspect_result_response_dict = self._grpc_client.services.repair_tools.inspect_geometry( parent_design=parent_design, bodies=body_ids ) return self.__create_inspect_result_from_response( - parent_design, inspect_result_response.issues_by_body + parent_design, inspect_result_response_dict["issues_by_body"] ) def __create_inspect_result_from_response( - self, design, inspect_geometry_results: list[InspectGeometryResult] + self, design, inspect_geometry_results: list[dict] ) -> list[InspectResult]: inspect_results = [] for inspect_geometry_result in inspect_geometry_results: - body = get_bodies_from_ids(design, [inspect_geometry_result.body.id]) - issues = self.__create_issues_from_response(inspect_geometry_result.issues) + body = get_bodies_from_ids(design, [inspect_geometry_result["body"]["id"]]) + issues = self.__create_issues_from_response(inspect_geometry_result["issues"]) inspect_result = InspectResult( grpc_client=self._grpc_client, body=body[0], issues=issues ) @@ -706,22 +700,25 @@ def __create_inspect_result_from_response( def __create_issues_from_response( self, - inspect_geometry_result_issues: list[InspectGeometryResultIssue], + inspect_geometry_result_issues: list[dict], ) -> list[GeometryIssue]: issues = [] - for inspect_result_issue in inspect_geometry_result_issues: - message_type = InspectGeometryMessageType.Name(inspect_result_issue.message_type) - message_id = InspectGeometryMessageId.Name(inspect_result_issue.message_id) - message = inspect_result_issue.message + for issue in inspect_geometry_result_issues: + message_type = issue["message_type"] + message_id = issue["message_id"] + message = issue["message"] + + faces = [face["id"] for face in issue.get("faces", [])] + edges = [edge["id"] for edge in issue.get("edges", [])] - issue = GeometryIssue( + geometry_issue = GeometryIssue( message_type=message_type, message_id=message_id, message=message, - faces=[face.id for face in inspect_result_issue.faces], - edges=[edge.id for edge in inspect_result_issue.edges], + faces=faces, + edges=edges, ) - issues.append(issue) + issues.append(geometry_issue) return issues @protect_grpc From 68e1047151febc6bd65e655d76dd9bcc46418bcb Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 2 May 2025 17:13:58 +0000 Subject: [PATCH 42/58] chore: auto fixes from pre-commit hooks --- src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py b/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py index ba79f8e69c..a053388828 100644 --- a/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py +++ b/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py @@ -267,7 +267,6 @@ def inspect_geometry(self, **kwargs) -> dict: # noqa: D102 return inspect_result_response - @protect_grpc def repair_geometry(self, **kwargs) -> dict: # noqa: D102 from ansys.api.geometry.v0.repairtools_pb2 import RepairGeometryRequest From 1b004b5404b10989f252d43046da78b148862435 Mon Sep 17 00:00:00 2001 From: Umut Soysal Date: Fri, 2 May 2025 12:16:37 -0500 Subject: [PATCH 43/58] further simplifications --- src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py b/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py index ba79f8e69c..b900ca8317 100644 --- a/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py +++ b/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py @@ -265,8 +265,7 @@ def inspect_geometry(self, **kwargs) -> dict: # noqa: D102 inspect_result_response = self.stub.InspectGeometry(request) # Return the response - formatted as a dictionary - return inspect_result_response - + return self.serialize_inspect_result_response(inspect_result_response) @protect_grpc def repair_geometry(self, **kwargs) -> dict: # noqa: D102 From 6116244dc470115b4334c6929a44d6c7a54ca588 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 2 May 2025 17:19:32 +0000 Subject: [PATCH 44/58] chore: auto fixes from pre-commit hooks --- src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py b/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py index 0302232c92..b900ca8317 100644 --- a/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py +++ b/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py @@ -266,6 +266,7 @@ def inspect_geometry(self, **kwargs) -> dict: # noqa: D102 # Return the response - formatted as a dictionary return self.serialize_inspect_result_response(inspect_result_response) + @protect_grpc def repair_geometry(self, **kwargs) -> dict: # noqa: D102 from ansys.api.geometry.v0.repairtools_pb2 import RepairGeometryRequest From 40f84ae441787dacc5c7d4fb52a42f20c40fba2a Mon Sep 17 00:00:00 2001 From: Umut Soysal Date: Fri, 2 May 2025 12:21:06 -0500 Subject: [PATCH 45/58] Update repair_tools.py --- .../core/_grpc/_services/v0/repair_tools.py | 56 ++++++++++++++++++- 1 file changed, 53 insertions(+), 3 deletions(-) diff --git a/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py b/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py index 0302232c92..fbe429b2a7 100644 --- a/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py +++ b/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py @@ -54,9 +54,42 @@ def __init__(self, channel: grpc.Channel): @protect_grpc def find_split_edges(self, **kwargs) -> dict: # noqa: D102 + """Identify split edges in the geometry. + + This method interacts with the gRPC service to identify split edges + in the provided geometry based on the input parameters. + + Parameters + ---------- + **kwargs : dict + Keyword arguments containing the input parameters for the request. + - bodies_or_faces: list + List of body or face identifiers to inspect. + - angle: float + The angle threshold for identifying split edges. + - distance: float + The distance threshold for identifying split edges. + + Returns + ------- + dict + A dictionary containing the identified split edge problems. Each problem + includes an ID and a list of associated edge monikers. + + Example: + { + "problems": [ + { + "id": "problem_id_1", + "edges": ["edge_1", "edge_2"] + }, + ... + ] + } + """ from ansys.api.geometry.v0.repairtools_pb2 import FindSplitEdgesRequest - # Create the request - assumes all inputs are valid and of the proper type + # Create the gRPC request request = FindSplitEdgesRequest( bodies_or_faces=kwargs["bodies_or_faces"], angle=kwargs["angle"], @@ -66,7 +99,7 @@ def find_split_edges(self, **kwargs) -> dict: # noqa: D102 # Call the gRPC service response = self.stub.FindSplitEdges(request) - # Return the response - formatted as a dictionary + # Format and return the response as a dictionary return { "problems": [ { @@ -258,14 +291,31 @@ def find_and_fix_simplify(self, **kwargs) -> dict: # noqa: D102 @protect_grpc def inspect_geometry(self, **kwargs) -> dict: # noqa: D102 + """Inspect the geometry for issues. + + Parameters + ---------- + **kwargs : dict + Keyword arguments containing the input parameters for the inspection. + - bodies: list + List of bodies to inspect. + + Returns + ------- + dict + A dictionary containing the serialized inspection results. + """ from ansys.api.geometry.v0.repairtools_pb2 import InspectGeometryRequest + # Create the gRPC request request = InspectGeometryRequest(bodies=kwargs.get("bodies", [])) + # Call the gRPC service inspect_result_response = self.stub.InspectGeometry(request) - # Return the response - formatted as a dictionary + # Serialize and return the response return self.serialize_inspect_result_response(inspect_result_response) + @protect_grpc def repair_geometry(self, **kwargs) -> dict: # noqa: D102 from ansys.api.geometry.v0.repairtools_pb2 import RepairGeometryRequest From 06e7fdf25fd04db69f848f7463b20326e57692ea Mon Sep 17 00:00:00 2001 From: Umut Soysal <97195410+umutsoysalansys@users.noreply.github.com> Date: Tue, 6 May 2025 10:09:15 -0500 Subject: [PATCH 46/58] Update src/ansys/geometry/core/_grpc/_services/base/repair_tools.py Co-authored-by: Roberto Pastor Muela <37798125+RobPasMue@users.noreply.github.com> --- .../core/_grpc/_services/base/repair_tools.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/ansys/geometry/core/_grpc/_services/base/repair_tools.py b/src/ansys/geometry/core/_grpc/_services/base/repair_tools.py index a6a857f73f..bc89562711 100644 --- a/src/ansys/geometry/core/_grpc/_services/base/repair_tools.py +++ b/src/ansys/geometry/core/_grpc/_services/base/repair_tools.py @@ -34,17 +34,14 @@ class GRPCRepairToolsService(ABC): """Abstract base class for gRPC-based repair tools service. - Defines abstract methods for identifying and repairing geometry issues in a model. + Parameters + ---------- + channel: grpc.Channel + The gRPC channel used to communicate with the service. """ def __init__(self, channel: grpc.Channel): - """Initialize the gRPC repair tools service. - - Parameters - ---------- - channel: grpc.Channel - The gRPC channel used to communicate with the service. - """ + """Initialize the gRPC repair tools service.""" pass # pragma: no cover @abstractmethod From 966fbc488d11eb4d7d796be9c3fabb851f71e526 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 6 May 2025 15:09:27 +0000 Subject: [PATCH 47/58] chore: auto fixes from pre-commit hooks --- src/ansys/geometry/core/_grpc/_services/base/repair_tools.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ansys/geometry/core/_grpc/_services/base/repair_tools.py b/src/ansys/geometry/core/_grpc/_services/base/repair_tools.py index bc89562711..cd1bc9bbea 100644 --- a/src/ansys/geometry/core/_grpc/_services/base/repair_tools.py +++ b/src/ansys/geometry/core/_grpc/_services/base/repair_tools.py @@ -37,7 +37,7 @@ class GRPCRepairToolsService(ABC): Parameters ---------- channel: grpc.Channel - The gRPC channel used to communicate with the service. + The gRPC channel used to communicate with the service. """ def __init__(self, channel: grpc.Channel): From 38d0e049a09c340ae52950e6a6770b132247db07 Mon Sep 17 00:00:00 2001 From: Umut Soysal <97195410+umutsoysalansys@users.noreply.github.com> Date: Tue, 6 May 2025 10:11:47 -0500 Subject: [PATCH 48/58] Update src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py Co-authored-by: Roberto Pastor Muela <37798125+RobPasMue@users.noreply.github.com> --- src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py b/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py index fbe429b2a7..5bccd75a65 100644 --- a/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py +++ b/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py @@ -19,7 +19,7 @@ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -"""Module containing the repair tools service implementation. +"""Module containing the repair tools service implementation for v0. This module defines an abstract base class for a gRPC-based repair tools service. The class provides a set of abstract methods for identifying and repairing various From 2ae7674f75fe7d6cbffccb9363b89f26301f359c Mon Sep 17 00:00:00 2001 From: Umut Soysal <97195410+umutsoysalansys@users.noreply.github.com> Date: Tue, 6 May 2025 10:35:24 -0500 Subject: [PATCH 49/58] Update src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py Co-authored-by: Roberto Pastor Muela <37798125+RobPasMue@users.noreply.github.com> --- src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py b/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py index 5bccd75a65..9e4537a1e0 100644 --- a/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py +++ b/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py @@ -338,6 +338,7 @@ def find_interferences(self, **kwargs) -> dict: # noqa: D102 bodies=kwargs["bodies"], cut_smaller_body=BoolValue(value=kwargs["cut_smaller_body"]), ) + # Call the gRPC service response = self.stub.FindInterference(request) From 18723507a5408d2bcd1f5077256feb8b4ad8a9a7 Mon Sep 17 00:00:00 2001 From: Umut Soysal <97195410+umutsoysalansys@users.noreply.github.com> Date: Tue, 6 May 2025 10:35:41 -0500 Subject: [PATCH 50/58] Update src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py Co-authored-by: Roberto Pastor Muela <37798125+RobPasMue@users.noreply.github.com> --- src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py b/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py index 9e4537a1e0..77f3aeac70 100644 --- a/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py +++ b/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py @@ -204,6 +204,7 @@ def find_missing_faces(self, **kwargs) -> dict: # noqa: D102 request = FindMissingFacesRequest(faces=kwargs["faces"]) # Call the gRPC service response = self.stub.FindMissingFaces(request) + # Return the response - formatted as a dictionary return { "problems": [ From a67f5df1ad6e34318df0d9b1f74dc9a9ae4ee271 Mon Sep 17 00:00:00 2001 From: Umut Soysal <97195410+umutsoysalansys@users.noreply.github.com> Date: Tue, 6 May 2025 10:35:52 -0500 Subject: [PATCH 51/58] Update src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py Co-authored-by: Roberto Pastor Muela <37798125+RobPasMue@users.noreply.github.com> --- src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py b/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py index 77f3aeac70..66871db451 100644 --- a/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py +++ b/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py @@ -322,8 +322,10 @@ def repair_geometry(self, **kwargs) -> dict: # noqa: D102 from ansys.api.geometry.v0.repairtools_pb2 import RepairGeometryRequest request = RepairGeometryRequest(bodies=kwargs.get("bodies", [])) + # Call the gRPC service response = self.stub.RepairGeometry(request) + # Return the response - formatted as a dictionary return { "success": response.result.success, From f8e5454544786fa8b9c234b4542074fa82a0048a Mon Sep 17 00:00:00 2001 From: Umut Soysal <97195410+umutsoysalansys@users.noreply.github.com> Date: Tue, 6 May 2025 10:36:06 -0500 Subject: [PATCH 52/58] Update src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py Co-authored-by: Roberto Pastor Muela <37798125+RobPasMue@users.noreply.github.com> --- src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py b/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py index 66871db451..e8103b539d 100644 --- a/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py +++ b/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py @@ -223,6 +223,7 @@ def find_small_faces(self, **kwargs) -> dict: # noqa: D102 request = FindSmallFacesRequest(selection=kwargs["selection"]) # Call the gRPC service response = self.stub.FindSmallFaces(request) + # Return the response - formatted as a dictionary return { "problems": [ From c82e490de32bf664f31a8f032c549c726739757c Mon Sep 17 00:00:00 2001 From: Umut Soysal Date: Wed, 7 May 2025 07:02:51 -0500 Subject: [PATCH 53/58] more refct --- .../geometry/core/_grpc/_services/v0/repair_tools.py | 12 ++++++++---- src/ansys/geometry/core/tools/repair_tools.py | 12 +++--------- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py b/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py index e8103b539d..7343c1a151 100644 --- a/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py +++ b/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py @@ -87,13 +87,15 @@ def find_split_edges(self, **kwargs) -> dict: # noqa: D102 ] } """ + from google.protobuf.wrappers_pb2 import DoubleValue + from ansys.api.geometry.v0.repairtools_pb2 import FindSplitEdgesRequest # Create the gRPC request request = FindSplitEdgesRequest( bodies_or_faces=kwargs["bodies_or_faces"], - angle=kwargs["angle"], - distance=kwargs["distance"], + angle=DoubleValue(value=float(kwargs["angle"])), + distance=DoubleValue(value=float(kwargs["distance"])), ) # Call the gRPC service @@ -402,12 +404,14 @@ def find_and_fix_extra_edges(self, **kwargs) -> dict: # noqa: D102 @protect_grpc def find_and_fix_split_edges(self, **kwargs) -> dict: # noqa: D102 + from google.protobuf.wrappers_pb2 import DoubleValue + from ansys.api.geometry.v0.repairtools_pb2 import FindSplitEdgesRequest request = FindSplitEdgesRequest( bodies_or_faces=kwargs["bodies_or_faces"], - angle=kwargs["angle"], - distance=kwargs["length"], + angle=DoubleValue(value=float(kwargs["angle"])), + distance=DoubleValue(value=float(kwargs["length"])), comprehensive=kwargs["comprehensive_result"], ) diff --git a/src/ansys/geometry/core/tools/repair_tools.py b/src/ansys/geometry/core/tools/repair_tools.py index 98c50dab2a..a0d468a70b 100644 --- a/src/ansys/geometry/core/tools/repair_tools.py +++ b/src/ansys/geometry/core/tools/repair_tools.py @@ -23,8 +23,6 @@ from typing import TYPE_CHECKING -from google.protobuf.wrappers_pb2 import DoubleValue - from ansys.geometry.core.connection import GrpcClient from ansys.geometry.core.errors import protect_grpc from ansys.geometry.core.misc.auxiliary import ( @@ -93,12 +91,10 @@ def find_split_edges( if not bodies: return [] - angle_value = DoubleValue(value=float(angle)) - length_value = DoubleValue(value=float(length)) body_ids = [body.id for body in bodies] problem_areas_response = self._grpc_client.services.repair_tools.find_split_edges( - bodies_or_faces=body_ids, angle=angle_value, distance=length_value + bodies_or_faces=body_ids, angle=angle, distance=length ) parent_design = get_design_from_body(bodies[0]) @@ -586,14 +582,12 @@ def find_and_fix_split_edges( if not bodies: return RepairToolMessage(False, [], [], 0, 0) - angle_value = DoubleValue(value=float(angle)) - length_value = DoubleValue(value=float(length)) body_ids = [body.id for body in bodies] response = self._grpc_client.services.repair_tools.find_and_fix_split_edges( bodies_or_faces=body_ids, - angle=angle_value, - length=length_value, + angle=angle, + length=length, comprehensive_result=comprehensive_result, ) From c3e5c9853aceae8102cfb4e9010b205108af56d7 Mon Sep 17 00:00:00 2001 From: Umut Soysal Date: Wed, 7 May 2025 07:48:37 -0500 Subject: [PATCH 54/58] Update repair_tools.py --- .../core/_grpc/_services/v0/repair_tools.py | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py b/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py index 7343c1a151..c44fe479b4 100644 --- a/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py +++ b/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py @@ -295,20 +295,6 @@ def find_and_fix_simplify(self, **kwargs) -> dict: # noqa: D102 @protect_grpc def inspect_geometry(self, **kwargs) -> dict: # noqa: D102 - """Inspect the geometry for issues. - - Parameters - ---------- - **kwargs : dict - Keyword arguments containing the input parameters for the inspection. - - bodies: list - List of bodies to inspect. - - Returns - ------- - dict - A dictionary containing the serialized inspection results. - """ from ansys.api.geometry.v0.repairtools_pb2 import InspectGeometryRequest # Create the gRPC request @@ -429,7 +415,6 @@ def find_and_fix_split_edges(self, **kwargs) -> dict: # noqa: D102 @staticmethod def serialize_inspect_result_response(response) -> dict: - """Serialize the InspectGeometryResponse to a dictionary.""" def serialize_body(body): return { From 0362a17bacce73d845fa74e9d13ee5952d1a7457 Mon Sep 17 00:00:00 2001 From: Umut Soysal Date: Wed, 7 May 2025 07:48:47 -0500 Subject: [PATCH 55/58] Update repair_tools.py --- .../core/_grpc/_services/v0/repair_tools.py | 34 +------------------ 1 file changed, 1 insertion(+), 33 deletions(-) diff --git a/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py b/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py index c44fe479b4..3169eb1368 100644 --- a/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py +++ b/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py @@ -54,39 +54,7 @@ def __init__(self, channel: grpc.Channel): @protect_grpc def find_split_edges(self, **kwargs) -> dict: # noqa: D102 - """Identify split edges in the geometry. - - This method interacts with the gRPC service to identify split edges - in the provided geometry based on the input parameters. - - Parameters - ---------- - **kwargs : dict - Keyword arguments containing the input parameters for the request. - - bodies_or_faces: list - List of body or face identifiers to inspect. - - angle: float - The angle threshold for identifying split edges. - - distance: float - The distance threshold for identifying split edges. - - Returns - ------- - dict - A dictionary containing the identified split edge problems. Each problem - includes an ID and a list of associated edge monikers. - - Example: - { - "problems": [ - { - "id": "problem_id_1", - "edges": ["edge_1", "edge_2"] - }, - ... - ] - } - """ + from google.protobuf.wrappers_pb2 import DoubleValue from ansys.api.geometry.v0.repairtools_pb2 import FindSplitEdgesRequest From 8c497919de8f42f0a0fe4e02770b9d4e819b1111 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 7 May 2025 12:48:59 +0000 Subject: [PATCH 56/58] chore: auto fixes from pre-commit hooks --- src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py b/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py index 3169eb1368..fcbb822f64 100644 --- a/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py +++ b/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py @@ -54,7 +54,6 @@ def __init__(self, channel: grpc.Channel): @protect_grpc def find_split_edges(self, **kwargs) -> dict: # noqa: D102 - from google.protobuf.wrappers_pb2 import DoubleValue from ansys.api.geometry.v0.repairtools_pb2 import FindSplitEdgesRequest @@ -383,7 +382,6 @@ def find_and_fix_split_edges(self, **kwargs) -> dict: # noqa: D102 @staticmethod def serialize_inspect_result_response(response) -> dict: - def serialize_body(body): return { "id": body.id, From e9bd066fb27c52fc1add9a7fd331c001bbc686d4 Mon Sep 17 00:00:00 2001 From: Umut Soysal <97195410+umutsoysalansys@users.noreply.github.com> Date: Wed, 7 May 2025 08:10:18 -0500 Subject: [PATCH 57/58] noqa Co-authored-by: Roberto Pastor Muela <37798125+RobPasMue@users.noreply.github.com> --- src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py b/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py index fcbb822f64..5b7000e990 100644 --- a/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py +++ b/src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py @@ -381,7 +381,7 @@ def find_and_fix_split_edges(self, **kwargs) -> dict: # noqa: D102 } @staticmethod - def serialize_inspect_result_response(response) -> dict: + def serialize_inspect_result_response(response) -> dict: # noqa: D102 def serialize_body(body): return { "id": body.id, From 0504552aa4bc1319bdb38452db5722a7f6955878 Mon Sep 17 00:00:00 2001 From: Umut Soysal Date: Wed, 7 May 2025 08:54:03 -0500 Subject: [PATCH 58/58] codality wtf --- src/ansys/geometry/core/_grpc/_services/base/repair_tools.py | 1 - src/ansys/geometry/core/_grpc/_services/v1/repair_tools.py | 1 - 2 files changed, 2 deletions(-) diff --git a/src/ansys/geometry/core/_grpc/_services/base/repair_tools.py b/src/ansys/geometry/core/_grpc/_services/base/repair_tools.py index cd1bc9bbea..f9fbd791cd 100644 --- a/src/ansys/geometry/core/_grpc/_services/base/repair_tools.py +++ b/src/ansys/geometry/core/_grpc/_services/base/repair_tools.py @@ -42,7 +42,6 @@ class GRPCRepairToolsService(ABC): def __init__(self, channel: grpc.Channel): """Initialize the gRPC repair tools service.""" - pass # pragma: no cover @abstractmethod def find_split_edges(self, **kwargs) -> dict: diff --git a/src/ansys/geometry/core/_grpc/_services/v1/repair_tools.py b/src/ansys/geometry/core/_grpc/_services/v1/repair_tools.py index 7a088ad260..75c23aa7f1 100644 --- a/src/ansys/geometry/core/_grpc/_services/v1/repair_tools.py +++ b/src/ansys/geometry/core/_grpc/_services/v1/repair_tools.py @@ -37,7 +37,6 @@ class GRPCRepairToolsServiceV1(ABC): def __init__(self, channel: grpc.Channel): """Initialize the MeasurementToolsService class.""" - pass # pragma: no cover def find_split_edges(self, **kwargs) -> dict: # noqa: D102 raise NotImplementedError