Skip to content

Commit ec8f85e

Browse files
Merge branch 'feat/component-tracking' into feat/tracking-updates
2 parents 6aa7ad7 + ec15305 commit ec8f85e

File tree

4 files changed

+414
-30
lines changed

4 files changed

+414
-30
lines changed

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

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1389,6 +1389,26 @@ def serialize_body(body):
13891389
"parent_id": body.parent_id,
13901390
"is_surface": body.is_surface,
13911391
}
1392+
1393+
def serialize_component(component):
1394+
return {
1395+
"id": component.id,
1396+
1397+
"can_suppress": component.can_suppress,
1398+
"transform_to_master": {
1399+
"m00": component.transform_to_master.m00,
1400+
"m11": component.transform_to_master.m11,
1401+
"m22": component.transform_to_master.m22,
1402+
"m33": component.transform_to_master.m33,
1403+
},
1404+
"master_id": component.master_id,
1405+
"parent_id": component.parent_id,
1406+
}
1407+
1408+
def serialize_part(part):
1409+
return {
1410+
"id": part.id,
1411+
}
13921412

13931413
def serialize_entity_identifier(entity):
13941414
"""Serialize an EntityIdentifier object into a dictionary."""
@@ -1399,14 +1419,34 @@ def serialize_entity_identifier(entity):
13991419
response = kwargs["response"]
14001420
return {
14011421
"success": response.success,
1422+
1423+
"created_parts": [
1424+
serialize_part(part) for part in getattr(response, "created_parts", [])
1425+
],
1426+
"modified_parts": [
1427+
serialize_part(part) for part in getattr(response, "modified_parts", [])
1428+
],
1429+
"deleted_parts": [
1430+
serialize_entity_identifier(entity) for entity in getattr(response, "deleted_parts", [])
1431+
],
1432+
"created_components": [
1433+
serialize_component(component) for component in getattr(response, "created_components", [])
1434+
],
1435+
"modified_components": [
1436+
serialize_component(component) for component in getattr(response, "modified_components", [])
1437+
],
1438+
"deleted_components": [
1439+
serialize_entity_identifier(entity)
1440+
for entity in getattr(response, "deleted_components", [])
1441+
],
1442+
14021443
"created_bodies": [
14031444
serialize_body(body) for body in getattr(response, "created_bodies", [])
14041445
],
14051446
"modified_bodies": [
14061447
serialize_body(body) for body in getattr(response, "modified_bodies", [])
14071448
],
14081449
"deleted_bodies": [
1409-
serialize_entity_identifier(entity)
1410-
for entity in getattr(response, "deleted_bodies", [])
1450+
serialize_entity_identifier(entity) for entity in getattr(response, "deleted_bodies", [])
14111451
],
14121452
}

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

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
from ..base.conversions import from_measurement_to_server_length
2929
from ..base.prepare_tools import GRPCPrepareToolsService
30-
from .conversions import build_grpc_id
30+
from .conversions import build_grpc_id, serialize_tracker_command_response
3131

3232

3333
class GRPCPrepareToolsServiceV0(GRPCPrepareToolsService):
@@ -62,10 +62,15 @@ def extract_volume_from_faces(self, **kwargs) -> dict: # noqa: D102
6262
# Call the gRPC service
6363
response = self.stub.ExtractVolumeFromFaces(request)
6464

65+
serialized_tracker_response = serialize_tracker_command_response(
66+
response=response.changes
67+
)
68+
6569
# Return the response - formatted as a dictionary
6670
return {
6771
"success": response.success,
6872
"created_bodies": [body.id for body in response.created_bodies],
73+
"complete_command_response": serialized_tracker_response,
6974
}
7075

7176
@protect_grpc
@@ -81,10 +86,16 @@ def extract_volume_from_edge_loops(self, **kwargs) -> dict: # noqa: D102
8186
# Call the gRPC service
8287
response = self.stub.ExtractVolumeFromEdgeLoops(request)
8388

89+
serialized_tracker_response = serialize_tracker_command_response(
90+
response=response.complete_command_response
91+
)
92+
8493
# Return the response - formatted as a dictionary
8594
return {
8695
"success": response.success,
8796
"created_bodies": [body.id for body in response.created_bodies],
97+
"complete_command_response": serialized_tracker_response,
98+
8899
}
89100

90101
@protect_grpc

0 commit comments

Comments
 (0)