Skip to content

Commit ce97b58

Browse files
david-gormanpre-commit-ci[bot]pyansys-ci-botjacobrkerstetter
authored
chore: Implement Points V1 (#2434)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: pyansys-ci-bot <[email protected]> Co-authored-by: Jacob Kerstetter <[email protected]>
1 parent 0a694ae commit ce97b58

File tree

2 files changed

+25
-3
lines changed

2 files changed

+25
-3
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Implement Points V1

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

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,31 @@ class GRPCPointsServiceV1(GRPCPointsService): # pragma: no cover
4343

4444
@protect_grpc
4545
def __init__(self, channel: grpc.Channel): # noqa: D102
46-
from ansys.api.geometry.v1.geometricentities.points_pb2_grpc import PointsStub
46+
from ansys.api.discovery.v1.design.constructs.datumpoint_pb2_grpc import DatumPointStub
4747

48-
self.stub = PointsStub(channel)
48+
self.stub = DatumPointStub(channel)
4949

5050
@protect_grpc
5151
def create_design_points(self, **kwargs) -> dict: # noqa: D102
52-
raise NotImplementedError
52+
from ansys.api.discovery.v1.design.constructs.datumpoint_pb2_grpc import (
53+
DatumPointCreationRequest,
54+
DatumPointCreationRequestData,
55+
)
56+
57+
from .conversions import from_point3d_to_grpc_point
58+
59+
# Create the request - assumes all inputs are valid and of the proper type
60+
request = DatumPointCreationRequest(
61+
requestData=[
62+
DatumPointCreationRequestData(
63+
points=[from_point3d_to_grpc_point(point) for point in kwargs["points"]],
64+
parent=kwargs["parent_id"],
65+
)
66+
]
67+
)
68+
69+
# Call the gRPC service
70+
response = self.stub.Create(request)
71+
72+
# Return the response - formatted as a dictionary
73+
return {"point_ids": [p.id for p in response.ids]}

0 commit comments

Comments
 (0)