2626
2727from ansys .api .geometry .v0 .commands_pb2 import (
2828 CreateAlignTangentOrientGearConditionRequest ,
29- MoveImprintEdgesRequest ,
30- OffsetEdgesRequest ,
3129 RenameObjectRequest ,
32- RoundInfoRequest ,
3330 SplitBodyRequest ,
3431)
3532from ansys .api .geometry .v0 .commands_pb2_grpc import CommandsStub
3936from ansys .geometry .core .connection .client import GrpcClient
4037from ansys .geometry .core .connection .conversions import (
4138 plane_to_grpc_plane ,
42- unit_vector_to_grpc_direction ,
4339)
4440from ansys .geometry .core .designer .component import Component
4541from ansys .geometry .core .designer .mating_conditions import (
6561 check_type_all_elements_in_iterable ,
6662 min_backend_version ,
6763)
68- from ansys .geometry .core .misc .measurements import DEFAULT_UNITS , Angle , Distance
64+ from ansys .geometry .core .misc .measurements import Angle , Distance
6965from ansys .geometry .core .shapes .curves .line import Line
7066from ansys .geometry .core .typing import Real
7167
@@ -945,8 +941,14 @@ def create_fill_pattern(
945941 margin = margin if isinstance (margin , Distance ) else Distance (margin )
946942 x_spacing = x_spacing if isinstance (x_spacing , Distance ) else Distance (x_spacing )
947943 y_spacing = y_spacing if isinstance (y_spacing , Distance ) else Distance (y_spacing )
948- row_x_offset = row_x_offset if isinstance (row_x_offset , Distance ) else Distance (row_x_offset )
949- row_y_offset = row_y_offset if isinstance (row_y_offset , Distance ) else Distance (row_y_offset )
944+ row_x_offset = (
945+ row_x_offset if isinstance (row_x_offset , Distance )
946+ else Distance (row_x_offset )
947+ )
948+ row_y_offset = (
949+ row_y_offset if isinstance (row_y_offset , Distance )
950+ else Distance (row_y_offset )
951+ )
950952 column_x_offset = (
951953 column_x_offset if isinstance (column_x_offset , Distance )
952954 else Distance (column_x_offset )
@@ -1343,9 +1345,11 @@ def get_round_info(self, face: "Face") -> tuple[bool, Real]:
13431345 --------
13441346 This method is only available starting on Ansys release 25R2.
13451347 """
1346- result = self ._commands_stub .GetRoundInfo (RoundInfoRequest (face = face ._grpc_id ))
1348+ result = self ._grpc_client ._services .faces .get_round_info (
1349+ face_id = face .id
1350+ )
13471351
1348- return (result .along_u , result .radius )
1352+ return (result .get ( " along_u" ) , result .get ( " radius" ) )
13491353
13501354 @protect_grpc
13511355 @check_input_types
@@ -1677,30 +1681,23 @@ def move_imprint_edges(
16771681 The edges to move.
16781682 direction : UnitVector3D
16791683 The direction to move the edges.
1680- distance : Distance
1684+ distance : Distance | Quantity | Real
16811685 The distance to move the edges.
16821686
16831687 Returns
16841688 -------
16851689 bool
16861690 Returns True if the edges were moved successfully, False otherwise.
16871691 """
1688- # Convert the distance object
16891692 distance = distance if isinstance (distance , Distance ) else Distance (distance )
1690- move_magnitude = distance .value .m_as (DEFAULT_UNITS .SERVER_LENGTH )
16911693
1692- # Create the request object
1693- request = MoveImprintEdgesRequest (
1694- edges = [edge ._grpc_id for edge in edges ],
1695- direction = unit_vector_to_grpc_direction (direction ),
1696- distance = move_magnitude ,
1694+ response = self ._grpc_client ._services .edges .move_imprint_edges (
1695+ edge_ids = [edge .id for edge in edges ],
1696+ direction = direction ,
1697+ distance = distance ,
16971698 )
16981699
1699- # Call the gRPC service
1700- response = self ._commands_stub .MoveImprintEdges (request )
1701-
1702- # Return success flag
1703- return response .result .success
1700+ return response .get ("success" )
17041701
17051702 @protect_grpc
17061703 @min_backend_version (26 , 1 , 0 )
@@ -1711,29 +1708,22 @@ def offset_edges(self, edges: list["Edge"], offset: Distance | Quantity | Real)
17111708 ----------
17121709 edges : list[Edge]
17131710 The edges to offset.
1714- offset : Distance
1711+ offset : Distance | Quantity | Real
17151712 The distance to offset the edges.
17161713
17171714 Returns
17181715 -------
17191716 bool
17201717 Returns True if the edges were offset successfully, False otherwise.
17211718 """
1722- # Convert the distance object
17231719 offset = offset if isinstance (offset , Distance ) else Distance (offset )
1724- offset_magnitude = offset .value .m_as (DEFAULT_UNITS .SERVER_LENGTH )
17251720
1726- # Create the request object
1727- request = OffsetEdgesRequest (
1728- edges = [edge ._grpc_id for edge in edges ],
1729- value = offset_magnitude ,
1721+ response = self ._grpc_client ._services .edges .offset_edges (
1722+ edge_ids = [edge .id for edge in edges ],
1723+ offset = offset ,
17301724 )
17311725
1732- # Call the gRPC service
1733- response = self ._commands_stub .OffsetEdges (request )
1734-
1735- # Return success flag
1736- return response .success
1726+ return response .get ("success" )
17371727
17381728 @protect_grpc
17391729 @min_backend_version (26 , 1 , 0 )
0 commit comments