@@ -456,23 +456,24 @@ def create_surface_body_from_trimmed_curves(self, **kwargs) -> dict: # noqa: D1
456456 @protect_grpc
457457 def translate (self , ** kwargs ) -> dict : # noqa: D102
458458 from ansys .api .discovery .v1 .operations .edit_pb2 import (
459- MoveTranslateRequest ,
460- MoveTranslateRequestData ,
459+ TranslateRequest ,
460+ TranslateRequestData ,
461461 )
462462
463463 # Create the request with selection_ids, direction, and distance
464- request = MoveTranslateRequest (
464+ request = TranslateRequest (
465465 request_data = [
466- MoveTranslateRequestData (
467- selection_ids = [ build_grpc_id (body_id ) for body_id in kwargs [ "ids" ]] ,
468- direction = from_unit_vector_to_grpc_direction (kwargs ["direction" ]),
469- distance = from_length_to_grpc_quantity (kwargs ["distance" ]),
466+ TranslateRequestData (
467+ id = build_grpc_id (id ) ,
468+ translation = from_unit_vector_to_grpc_direction (kwargs ["direction" ]),
469+ distance = from_measurement_to_server_length (kwargs ["distance" ]),
470470 )
471+ for id in kwargs ["ids" ]
471472 ]
472473 )
473474
474475 # Call the gRPC service
475- self .edit_stub .MoveTranslate (request = request )
476+ self .edit_stub .Translate (request = request )
476477
477478 # Return the response - formatted as a dictionary
478479 return {}
@@ -788,30 +789,27 @@ def set_suppressed(self, **kwargs) -> dict: # noqa: D102
788789 @protect_grpc
789790 def rotate (self , ** kwargs ) -> dict : # noqa: D102
790791 from ansys .api .discovery .v1 .operations .edit_pb2 import (
791- MoveRotateRequest ,
792- MoveRotateRequestData ,
792+ RotateOptions ,
793+ RotateRequest ,
794+ RotateRequestData ,
793795 )
794796
795- from ansys .geometry .core .shapes .curves .line import Line
796-
797- from .conversions import from_angle_to_grpc_quantity , from_line_to_grpc_line
797+ from .conversions import from_angle_to_grpc_quantity
798798
799- # Create a Line from axis_origin and axis_direction
800- axis = Line (kwargs ["axis_origin" ], kwargs ["axis_direction" ])
799+ # Create options
800+ options = RotateOptions (
801+ angle = from_angle_to_grpc_quantity (kwargs ["angle" ]),
802+ axis_origin = from_point3d_to_grpc_point (kwargs ["axis_origin" ]),
803+ axis_direction = from_unit_vector_to_grpc_direction (kwargs ["axis_direction" ]),
804+ )
801805
802806 # Create the request with selection_ids, axis, and angle
803- request = MoveRotateRequest (
804- request_data = [
805- MoveRotateRequestData (
806- selection_ids = [build_grpc_id (kwargs ["id" ])],
807- axis = from_line_to_grpc_line (axis ),
808- angle = from_angle_to_grpc_quantity (kwargs ["angle" ]),
809- )
810- ]
807+ request = RotateRequest (
808+ request_data = [RotateRequestData (id = build_grpc_id (kwargs ["id" ]), options = options )]
811809 )
812810
813811 # Call the gRPC service
814- self .edit_stub .MoveRotate (request = request )
812+ self .edit_stub .Rotate (request = request )
815813
816814 # Return the response - formatted as a dictionary
817815 return {}
@@ -838,12 +836,16 @@ def scale(self, **kwargs) -> dict: # noqa: D102
838836
839837 @protect_grpc
840838 def mirror (self , ** kwargs ) -> dict : # noqa: D102
841- from ansys .api .discovery .v1 .operations .edit_pb2 import MirrorRequest
839+ from ansys .api .discovery .v1 .operations .edit_pb2 import MirrorRequest , MirrorRequestData
842840
843841 # Create the request - assumes all inputs are valid and of the proper type
844842 request = MirrorRequest (
845- selection_ids = [build_grpc_id (kwargs ["id" ])],
846- plane = from_plane_to_grpc_plane (kwargs ["plane" ]),
843+ request_data = [
844+ MirrorRequestData (
845+ ids = [build_grpc_id (kwargs ["id" ])],
846+ mirror_plane = from_plane_to_grpc_plane (kwargs ["plane" ]),
847+ )
848+ ]
847849 )
848850
849851 # Call the gRPC service
@@ -988,87 +990,82 @@ def get_tesellation_with_options(self, **kwargs) -> dict: # noqa: D102
988990
989991 @protect_grpc
990992 def boolean (self , ** kwargs ) -> dict : # noqa: D102
991- # v1 uses the combine method instead of a separate boolean method
992- # Map the v0 parameters to v1 combine parameters
993- return self .combine (
994- target = kwargs ["target" ],
995- other = kwargs ["other" ],
996- type_bool_op = kwargs ["method" ],
993+ from ansys .api .discovery .v1 .operations .edit_pb2 import BooleanRequest
994+
995+ # Create the request - assumes all inputs are valid and of the proper type
996+ request = BooleanRequest (
997+ body1_id = build_grpc_id (kwargs ["target" ]),
998+ tool_body_ids = [build_grpc_id (id ) for id in kwargs ["other" ]],
999+ method = kwargs ["method" ],
9971000 keep_other = kwargs ["keep_other" ],
998- transfer_named_selections = False ,
9991001 )
10001002
1003+ # Call the gRPC service
1004+ response = self .edit_stub .Boolean (request = request )
1005+
1006+ if not response .tracked_command_response .command_response .success :
1007+ raise ValueError (f"Boolean operation failed: { kwargs ['err_msg' ]} " )
1008+
1009+ # Return the response - formatted as a dictionary
1010+ return {"complete_command_response" : response }
1011+
10011012 @protect_grpc
10021013 def combine (self , ** kwargs ) -> dict : # noqa: D102
10031014 from ansys .api .discovery .v1 .operations .edit_pb2 import (
10041015 CombineIntersectBodiesRequest ,
10051016 CombineIntersectBodiesRequestData ,
1006- CombineMergeBodiesRequest ,
1007- CombineMergeBodiesRequestData ,
10081017 )
10091018
1010- target_body = kwargs ["target" ]
1011- other_bodies = kwargs ["other" ]
1012- type_bool_op = kwargs ["type_bool_op" ]
1013- keep_other = kwargs ["keep_other" ]
1014- transfer_named_selections = kwargs .get ("transfer_named_selections" , False )
1019+ # Create the request - assumes all inputs are valid and of the proper type
1020+ request = CombineIntersectBodiesRequest (
1021+ request_data = [
1022+ CombineIntersectBodiesRequestData (
1023+ target_selection_ids = [build_grpc_id (kwargs ["target" ])],
1024+ tool_selection_ids = [build_grpc_id (id ) for id in kwargs ["other" ]],
1025+ keep_cutter = kwargs ["keep_other" ],
1026+ subtract_from_target = True ,
1027+ transfer_named_selections = kwargs ["transfer_named_selections" ],
1028+ )
1029+ ]
1030+ )
10151031
1016- if type_bool_op == "intersect" :
1017- request_data = CombineIntersectBodiesRequestData (
1018- target_selection_ids = [build_grpc_id (target_body )],
1019- tool_selection_ids = [build_grpc_id (body ) for body in other_bodies ],
1020- keep_cutter = keep_other ,
1021- subtract_from_target = False ,
1022- transfer_named_selections = transfer_named_selections ,
1023- )
1024- request = CombineIntersectBodiesRequest (request_data = [request_data ])
1025- response = self .edit_stub .CombineIntersectBodies (request = request )
1026- elif type_bool_op == "subtract" :
1027- request_data = CombineIntersectBodiesRequestData (
1028- target_selection_ids = [build_grpc_id (target_body )],
1029- tool_selection_ids = [build_grpc_id (body ) for body in other_bodies ],
1030- keep_cutter = keep_other ,
1031- subtract_from_target = True ,
1032- transfer_named_selections = transfer_named_selections ,
1033- )
1034- request = CombineIntersectBodiesRequest (request_data = [request_data ])
1035- response = self .edit_stub .CombineIntersectBodies (request = request )
1036- elif type_bool_op == "unite" :
1037- # Create request data with all body IDs
1038- all_body_ids = [build_grpc_id (target_body )]
1039- all_body_ids .extend ([build_grpc_id (body ) for body in other_bodies ])
1040-
1041- request_data = CombineMergeBodiesRequestData (target_selection_ids = all_body_ids )
1042- request = CombineMergeBodiesRequest (request_data = [request_data ])
1043- response = self .edit_stub .CombineMergeBodies (request = request )
1044- else :
1045- raise ValueError (f"Invalid boolean operation type: { type_bool_op } " )
1046-
1047- if not response .success :
1048- raise ValueError (f"Boolean operation failed: { response } " )
1032+ # Call the gRPC service
1033+ response = self .edit_stub .CombineIntersectBodies (request = request )
1034+
1035+ if not response .tracked_command_response .command_response .success :
1036+ raise ValueError (f"Boolean operation failed: { kwargs ['err_msg' ]} " )
10491037
10501038 # Return the response - formatted as a dictionary
10511039 return {"complete_command_response" : response }
10521040
10531041 @protect_grpc
10541042 def split_body (self , ** kwargs ) -> dict : # noqa: D102
1055- from ansys .api .discovery .v1 .operations .edit_pb2 import SplitBodyRequest
1043+ from ansys .api .discovery .v1 .operations .edit_pb2 import (
1044+ SplitBodyRequest ,
1045+ SplitBodyRequestData ,
1046+ )
10561047
10571048 # Create the request - assumes all inputs are valid and of the proper type
10581049 request = SplitBodyRequest (
1059- selection = [build_grpc_id (id ) for id in kwargs ["body_ids" ]],
1060- split_by_plane = from_plane_to_grpc_plane (kwargs ["plane" ]) if kwargs ["plane" ] else None ,
1061- split_by_slicer = [build_grpc_id (id ) for id in kwargs ["slicer_ids" ]],
1062- split_by_faces = [build_grpc_id (id ) for id in kwargs ["face_ids" ]],
1063- extend_surfaces = kwargs ["extend_surfaces" ],
1050+ request_data = [
1051+ SplitBodyRequestData (
1052+ selection_ids = [build_grpc_id (id ) for id in kwargs ["body_ids" ]],
1053+ split_by_plane = (
1054+ from_plane_to_grpc_plane (kwargs ["plane" ]) if kwargs ["plane" ] else None
1055+ ),
1056+ split_by_slicer_ids = [build_grpc_id (id ) for id in kwargs ["slicer_ids" ]],
1057+ split_by_face_ids = [build_grpc_id (id ) for id in kwargs ["face_ids" ]],
1058+ extend_surfaces = kwargs ["extend_surfaces" ],
1059+ )
1060+ ]
10641061 )
10651062
10661063 # Call the gRPC service
10671064 resp = self .edit_stub .SplitBodies (request = request )
10681065
10691066 # Return the response - formatted as a dictionary
10701067 return {
1071- "success" : resp .success ,
1068+ "success" : resp .tracked_command_response . command_response . success ,
10721069 }
10731070
10741071 @protect_grpc
@@ -1145,7 +1142,7 @@ def assign_midsurface_thickness(self, **kwargs) -> dict: # noqa: D102
11451142 request_data = [
11461143 SetMidSurfaceThicknessRequestData (
11471144 ids = [build_grpc_id (id ) for id in kwargs ["ids" ]],
1148- thickness = from_measurement_to_server_length (kwargs ["thickness" ]),
1145+ thickness = from_length_to_grpc_quantity (kwargs ["thickness" ]),
11491146 )
11501147 ]
11511148 )
0 commit comments