Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
97eb31a
chore: update CHANGELOG for v0.9.0 (#1753)
pyansys-ci-bot Feb 17, 2025
1547839
Merge branch 'main' of https://github.com/ansys/pyansys-geometry
smereu Mar 10, 2025
5a48878
Merge branch 'main' of https://github.com/ansys/pyansys-geometry
smereu Mar 27, 2025
4109456
Merge branch 'main' of https://github.com/ansys/pyansys-geometry
smereu Apr 8, 2025
e00316b
Merge branch 'main' of https://github.com/ansys/pyansys-geometry
smereu May 20, 2025
1afa37a
Merge branch 'main' of https://github.com/ansys/pyansys-geometry
smereu Jun 11, 2025
7c595bb
Merge branch 'main' of https://github.com/ansys/pyansys-geometry
smereu Jun 24, 2025
6a23076
Merge branch 'main' of https://github.com/ansys/pyansys-geometry
smereu Jul 7, 2025
62ca792
Merge branch 'main' of https://github.com/ansys/pyansys-geometry
smereu Jul 9, 2025
40c19c1
Merge branch 'main' of https://github.com/ansys/pyansys-geometry
smereu Jul 28, 2025
40a13e2
Merge branch 'main' of https://github.com/ansys/pyansys-geometry
smereu Sep 3, 2025
269ec5b
Merge branch 'main' of https://github.com/ansys/pyansys-geometry
smereu Sep 22, 2025
6217f4a
Merge branch 'main' of https://github.com/ansys/pyansys-geometry
smereu Sep 24, 2025
7a728c4
Merge branch 'main' of https://github.com/ansys/pyansys-geometry
smereu Sep 25, 2025
6c462de
Merge branch 'main' of https://github.com/ansys/pyansys-geometry
smereu Sep 30, 2025
3611a99
Merge branch 'main' of https://github.com/ansys/pyansys-geometry
smereu Oct 8, 2025
c5a4e86
Merge branch 'main' of https://github.com/ansys/pyansys-geometry
smereu Oct 11, 2025
ecd7567
Merge branch 'main' of https://github.com/ansys/pyansys-geometry
smereu Oct 13, 2025
8b628a2
Merge branch 'main' of https://github.com/ansys/pyansys-geometry
smereu Nov 18, 2025
f55daa8
Merge branch 'main' of https://github.com/ansys/pyansys-geometry
smereu Nov 21, 2025
38324c1
Merge branch 'main' of https://github.com/ansys/pyansys-geometry
smereu Nov 24, 2025
18f6686
Merge branch 'main' of https://github.com/ansys/pyansys-geometry
smereu Nov 25, 2025
6147028
Merge branch 'main' of https://github.com/ansys/pyansys-geometry
smereu Dec 1, 2025
85a9d0b
Merge branch 'main' of https://github.com/ansys/pyansys-geometry
smereu Dec 1, 2025
a3de5c0
Merge branch 'main' of https://github.com/ansys/pyansys-geometry
smereu Dec 2, 2025
f80402b
v1 implementation of repair tools
smereu Dec 3, 2025
5b3aaa5
chore: adding changelog file 2441.maintenance.md [dependabot-skip]
pyansys-ci-bot Dec 3, 2025
b032622
Merge branch 'main' into ci/v1-implementation-of-repair-stub
jacobrkerstetter Dec 3, 2025
68dacd8
chore: adding changelog file 2441.maintenance.md [dependabot-skip]
pyansys-ci-bot Dec 3, 2025
659dc43
code review
smereu Dec 3, 2025
3f13da1
clean_up from copilot
smereu Dec 3, 2025
7082ad7
fix error
smereu Dec 4, 2025
c596a69
chore: auto fixes from pre-commit hooks
pre-commit-ci[bot] Dec 4, 2025
bc61363
fix typos
smereu Dec 4, 2025
10ee4ee
Merge branch 'ci/v1-implementation-of-repair-stub' of https://github.…
smereu Dec 4, 2025
dcc902c
chore: auto fixes from pre-commit hooks
pre-commit-ci[bot] Dec 4, 2025
441d85f
Update conversions.py
smereu Dec 5, 2025
d44153a
chore: auto fixes from pre-commit hooks
pre-commit-ci[bot] Dec 5, 2025
b3156ed
misc clean-up
smereu Dec 5, 2025
a40a76b
Merge branch 'ci/v1-implementation-of-repair-stub' of https://github.…
smereu Dec 5, 2025
6add48c
chore: auto fixes from pre-commit hooks
pre-commit-ci[bot] Dec 5, 2025
432c223
misc clean-up
smereu Dec 5, 2025
edaa8e0
Merge branch 'ci/v1-implementation-of-repair-stub' of https://github.…
smereu Dec 5, 2025
00633fc
chore: auto fixes from pre-commit hooks
pre-commit-ci[bot] Dec 5, 2025
db48bd5
Merge branch 'main' into ci/v1-implementation-of-repair-stub
jacobrkerstetter Dec 5, 2025
cc381ec
Merge branch 'main' into ci/v1-implementation-of-repair-stub
jacobrkerstetter Dec 8, 2025
18f956f
chore: auto fixes from pre-commit hooks
pre-commit-ci[bot] Dec 8, 2025
864d3e4
removing boolvalues
jacobrkerstetter Dec 8, 2025
e3f37ba
Merge branch 'ci/v1-implementation-of-repair-stub' of https://github.…
jacobrkerstetter Dec 8, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/changelog.d/1753.maintenance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
update CHANGELOG for v0.9.0
1 change: 1 addition & 0 deletions doc/changelog.d/2441.maintenance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Chore: v1 implementation of repair stubs
68 changes: 38 additions & 30 deletions src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +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 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
geometry issues, such as split edges, extra edges, duplicate faces etc.
"""
"""Module containing the repair tools service implementation for v0."""

from google.protobuf.wrappers_pb2 import Int32Value
import grpc
Expand Down Expand Up @@ -393,7 +388,7 @@ def find_and_fix_short_edges(self, **kwargs): # noqa: D102
"repaired": response.repaired,
"created_bodies_monikers": [],
"modified_bodies_monikers": [],
"complete_command_response": serialized_tracker_response,
"tracker_response": serialized_tracker_response,
}

@protect_grpc
Expand All @@ -420,7 +415,7 @@ def find_and_fix_extra_edges(self, **kwargs) -> dict: # noqa: D102
"repaired": response.repaired,
"created_bodies_monikers": response.created_bodies_monikers,
"modified_bodies_monikers": response.modified_bodies_monikers,
"complete_command_response": serialized_tracker_response,
"tracker_response": serialized_tracker_response,
}

@protect_grpc
Expand Down Expand Up @@ -449,7 +444,7 @@ def find_and_fix_split_edges(self, **kwargs) -> dict: # noqa: D102
"repaired": response.repaired,
"created_bodies_monikers": [],
"modified_bodies_monikers": [],
"complete_command_response": serialized_tracker_response,
"tracker_response": serialized_tracker_response,
}

@protect_grpc
Expand All @@ -476,7 +471,7 @@ def find_and_fix_simplify(self, **kwargs) -> dict: # noqa: D102
"repaired": response.repaired,
"created_bodies_monikers": [],
"modified_bodies_monikers": [],
"complete_command_response": serialized_tracker_response,
"tracker_response": serialized_tracker_response,
}

@protect_grpc
Expand Down Expand Up @@ -514,15 +509,15 @@ def find_and_fix_stitch_faces(self, **kwargs) -> dict: # noqa: D102
"modified_bodies_monikers": response.modified_bodies_monikers,
"found": response.found,
"repaired": response.repaired,
"complete_command_response": serialized_tracker_response,
"tracker_response": serialized_tracker_response,
}

@protect_grpc
def inspect_geometry(self, **kwargs) -> dict: # noqa: D102
from ansys.api.geometry.v0.repairtools_pb2 import InspectGeometryRequest

# Create the request - assumes all inputs are valid and of the proper type
request = InspectGeometryRequest(bodies=kwargs.get("bodies", []))
request = InspectGeometryRequest(bodies=kwargs.get("bodies"))

# Call the gRPC service
inspect_result_response = self.stub.InspectGeometry(request)
Expand All @@ -535,7 +530,7 @@ def repair_geometry(self, **kwargs) -> dict: # noqa: D102
from ansys.api.geometry.v0.repairtools_pb2 import RepairGeometryRequest

# Create the request - assumes all inputs are valid and of the proper type
request = RepairGeometryRequest(bodies=kwargs.get("bodies", []))
request = RepairGeometryRequest(bodies=kwargs.get("bodies"))

# Call the gRPC service
response = self.stub.RepairGeometry(request)
Expand Down Expand Up @@ -566,7 +561,9 @@ def fix_duplicate_faces(self, **kwargs) -> dict: # noqa: D102
# Return the response - formatted as a dictionary
return {
"tracker_response": serialized_tracker_response,
"repair_tracker_response": self.__serialize_message_response(response),
"success": response.result.success,
"created_bodies_monikers": response.result.created_bodies_monikers,
"modified_bodies_monikers": response.result.modified_bodies_monikers,
}

@protect_grpc
Expand All @@ -590,7 +587,9 @@ def fix_missing_faces(self, **kwargs) -> dict: # noqa: D102
# Return the response - formatted as a dictionary
return {
"tracker_response": serialized_tracker_response,
"repair_tracker_response": self.__serialize_message_response(response),
"success": response.result.success,
"created_bodies_monikers": response.result.created_bodies_monikers,
"modified_bodies_monikers": response.result.modified_bodies_monikers,
}

@protect_grpc
Expand All @@ -614,7 +613,9 @@ def fix_inexact_edges(self, **kwargs) -> dict: # noqa: D102
# Return the response - formatted as a dictionary
return {
"tracker_response": serialized_tracker_response,
"repair_tracker_response": self.__serialize_message_response(response),
"success": response.result.success,
"created_bodies_monikers": response.result.created_bodies_monikers,
"modified_bodies_monikers": response.result.modified_bodies_monikers,
}

@protect_grpc
Expand All @@ -636,7 +637,9 @@ def fix_extra_edges(self, **kwargs) -> dict: # noqa: D102
# Return the response - formatted as a dictionary
return {
"tracker_response": serialized_tracker_response,
"repair_tracker_response": self.__serialize_message_response(response),
"success": response.result.success,
"created_bodies_monikers": response.result.created_bodies_monikers,
"modified_bodies_monikers": response.result.modified_bodies_monikers,
}

@protect_grpc
Expand All @@ -658,7 +661,9 @@ def fix_short_edges(self, **kwargs) -> dict: # noqa: D102
# Return the response - formatted as a dictionary
return {
"tracker_response": serialized_tracker_response,
"repair_tracker_response": self.__serialize_message_response(response),
"success": response.result.success,
"created_bodies_monikers": response.result.created_bodies_monikers,
"modified_bodies_monikers": response.result.modified_bodies_monikers,
}

@protect_grpc
Expand All @@ -680,7 +685,9 @@ def fix_small_faces(self, **kwargs) -> dict: # noqa: D102
# Return the response - formatted as a dictionary
return {
"tracker_response": serialized_tracker_response,
"repair_tracker_response": self.__serialize_message_response(response),
"success": response.result.success,
"created_bodies_monikers": response.result.created_bodies_monikers,
"modified_bodies_monikers": response.result.modified_bodies_monikers,
}

@protect_grpc
Expand All @@ -702,7 +709,9 @@ def fix_split_edges(self, **kwargs) -> dict: # noqa: D102
# Return the response - formatted as a dictionary
return {
"tracker_response": serialized_tracker_response,
"repair_tracker_response": self.__serialize_message_response(response),
"success": response.result.success,
"created_bodies_monikers": response.result.created_bodies_monikers,
"modified_bodies_monikers": response.result.modified_bodies_monikers,
}

@protect_grpc
Expand All @@ -726,7 +735,9 @@ def fix_stitch_faces(self, **kwargs) -> dict: # noqa: D102
# Return the response - formatted as a dictionary
return {
"tracker_response": serialized_tracker_response,
"repair_tracker_response": self.__serialize_message_response(response),
"success": response.result.success,
"created_bodies_monikers": response.result.created_bodies_monikers,
"modified_bodies_monikers": response.result.modified_bodies_monikers,
}

@protect_grpc
Expand All @@ -750,7 +761,9 @@ def fix_unsimplified_faces(self, **kwargs) -> dict: # noqa: D102
# Return the response - formatted as a dictionary
return {
"tracker_response": serialized_tracker_response,
"repair_tracker_response": self.__serialize_message_response(response),
"success": response.result.success,
"created_bodies_monikers": response.result.created_bodies_monikers,
"modified_bodies_monikers": response.result.modified_bodies_monikers,
}

@protect_grpc
Expand All @@ -774,7 +787,9 @@ def fix_interference(self, **kwargs) -> dict: # noqa: D102
# Return the response - formatted as a dictionary
return {
"tracker_response": serialized_tracker_response,
"repair_tracker_response": self.__serialize_message_response(response),
"success": response.result.success,
"created_bodies_monikers": response.result.created_bodies_monikers,
"modified_bodies_monikers": response.result.modified_bodies_monikers,
}

def __serialize_inspect_result_response(self, response) -> dict: # noqa: D102
Expand Down Expand Up @@ -830,10 +845,3 @@ def serialize_issue(issue):
for body_issues in response.issues_by_body
]
}

def __serialize_message_response(self, response):
return {
"success": response.result.success,
"created_bodies_monikers": response.result.created_bodies_monikers,
"modified_bodies_monikers": response.result.modified_bodies_monikers,
}
123 changes: 123 additions & 0 deletions src/ansys/geometry/core/_grpc/_services/v1/conversions.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
CurveGeometry as GRPCCurveGeometry,
DrivingDimensionEntity as GRPCDrivingDimension,
EdgeTessellation as GRPCEdgeTessellation,
EnhancedRepairToolMessage as GRPCEnhancedRepairToolResponse,
Geometries as GRPCGeometries,
Knot as GRPCKnot,
MaterialEntity as GRPCMaterial,
Expand Down Expand Up @@ -1382,6 +1383,38 @@ def from_angle_to_grpc_quantity(input: "Measurement") -> GRPCQuantity:
return GRPCQuantity(value_in_geometry_units=input.value.m_as(DEFAULT_UNITS.SERVER_ANGLE))


def from_area_to_grpc_quantity(input: "Measurement") -> GRPCQuantity:
"""Convert a ``Measurement`` containing an area to a gRPC quantity.

Parameters
----------
input : Measurement
Source measurement data.

Returns
-------
GRPCQuantity
Converted gRPC quantity.
"""
return GRPCQuantity(value_in_geometry_units=input.value.m_as(DEFAULT_UNITS.SERVER_AREA))


def from_volume_to_grpc_quantity(input: "Measurement") -> GRPCQuantity:
"""Convert a ``Measurement`` containing a volume to a gRPC quantity.

Parameters
----------
input : Measurement
Source measurement data.

Returns
-------
GRPCQuantity
Converted gRPC quantity.
"""
return GRPCQuantity(value_in_geometry_units=input.value.m_as(DEFAULT_UNITS.SERVER_VOLUME))


def from_grpc_volume_to_volume(grpc_quantity: GRPCQuantity) -> "pint.Quantity":
"""Convert a gRPC quantity representing volume to a pint Quantity.

Expand Down Expand Up @@ -1633,3 +1666,93 @@ def get_tracker_response_with_created_bodies(response) -> dict:
"created_bodies", []
)
return serialized_response


def serialize_repair_command_response(response: GRPCEnhancedRepairToolResponse) -> dict:
"""Serialize a EnhancedRepairToolResponse object into a dictionary.

Parameters
----------
response : GRPCEnhancedRepairToolResponse
The gRPC EnhancedRepairToolResponse object to serialize.
A dictionary representation of the EnhancedRepairToolResponse object.
"""
return {
"success": response.tracked_command_response.command_response.success,
"found": response.found,
"repaired": response.repaired,
"complete_command_response": serialize_tracked_command_response(response.tracked_changes),
"created_bodies_monikers": [
created_body.id for created_body in response.tracked_changes.get("created_bodies", [])
],
"modified_bodies_monikers": [
modified_body.id
for modified_body in response.tracked_changes.get("modified_bodies", [])
],
"deleted_bodies_monikers": [
deleted_body.id for deleted_body in response.tracked_changes.get("deleted_bodies", [])
],
}


def response_problem_area_for_body(response) -> dict:
"""Get a dictionary response from problem areas for a body.

Parameters
----------
response
The response to convert.

Returns
-------
dict
A dictionary representation of the ProblemAreaForBody object.
"""
return {
"problems": [
{"id": res.problem_area_id, "bodies": [body.id for body in res.body_ids]}
for res in response.result
]
}


def response_problem_area_for_face(response) -> dict:
"""Get a dictionary response from problem areas for a face.

Parameters
----------
response
The response to convert.

Returns
-------
dict
A dictionary representation of the ProblemAreaForFace object.
"""
return {
"problems": [
{"id": res.problem_area_id, "faces": [face.id for face in res.face_ids]}
for res in response.result
]
}


def response_problem_area_for_edge(response) -> dict:
"""Get a dictionary response from problem areas for an edge.

Parameters
----------
response
The response to convert.

Returns
-------
dict
A dictionary representation of the ProblemAreaForEdge object.
"""
return {
"problems": [
{"id": res.problem_area_id, "edges": [edge.id for edge in res.edge_ids]}
for res in response.result
]
}
Loading
Loading