Skip to content

Commit 38f8799

Browse files
fixing rotate and helix detection
1 parent 6ac79b1 commit 38f8799

File tree

2 files changed

+18
-17
lines changed

2 files changed

+18
-17
lines changed

src/ansys/geometry/core/_grpc/_services/v1/bodies.py

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -788,30 +788,32 @@ def set_suppressed(self, **kwargs) -> dict: # noqa: D102
788788
@protect_grpc
789789
def rotate(self, **kwargs) -> dict: # noqa: D102
790790
from ansys.api.discovery.v1.operations.edit_pb2 import (
791-
MoveRotateRequest,
792-
MoveRotateRequestData,
791+
RotateOptions,
792+
RotateRequest,
793+
RotateRequestData,
793794
)
794795

795-
from ansys.geometry.core.shapes.curves.line import Line
796+
from .conversions import from_angle_to_grpc_quantity
796797

797-
from .conversions import from_angle_to_grpc_quantity, from_line_to_grpc_line
798-
799-
# Create a Line from axis_origin and axis_direction
800-
axis = Line(kwargs["axis_origin"], kwargs["axis_direction"])
798+
# Create options
799+
options = RotateOptions(
800+
angle=from_angle_to_grpc_quantity(kwargs["angle"]),
801+
axis_origin=from_point3d_to_grpc_point(kwargs["axis_origin"]),
802+
axis_direction=from_unit_vector_to_grpc_direction(kwargs["axis_direction"]),
803+
)
801804

802805
# Create the request with selection_ids, axis, and angle
803-
request = MoveRotateRequest(
806+
request = RotateRequest(
804807
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"]),
808+
RotateRequestData(
809+
id=build_grpc_id(kwargs["id"]),
810+
options=options
809811
)
810812
]
811813
)
812814

813815
# Call the gRPC service
814-
self.edit_stub.MoveRotate(request=request)
816+
self.edit_stub.Rotate(request=request)
815817

816818
# Return the response - formatted as a dictionary
817819
return {}

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,6 @@ def detect_helixes(self, **kwargs) -> dict: # noqa: D102
251251

252252
from ansys.geometry.core.shapes.parameterization import Interval
253253

254-
from ..base.conversions import to_distance
255254
from .conversions import (
256255
from_grpc_curve_to_curve,
257256
from_grpc_point_to_point3d,
@@ -285,12 +284,12 @@ def detect_helixes(self, **kwargs) -> dict: # noqa: D102
285284
"interval": Interval(
286285
helix.trimmed_curve.interval_start, helix.trimmed_curve.interval_end
287286
),
288-
"length": to_distance(helix.trimmed_curve.length).value,
287+
"length": helix.trimmed_curve.length.value_in_geometry_units,
289288
},
290289
"edges": [
291290
{
292-
"id": edge.id,
293-
"parent_id": edge.parent.id,
291+
"id": edge.id.id,
292+
"parent_id": edge.parent.id.id,
294293
"curve_type": edge.curve_type,
295294
"is_reversed": edge.is_reversed,
296295
}

0 commit comments

Comments
 (0)