2626from ansys .geometry .core .errors import protect_grpc
2727
2828from ..base .driving_dimensions import GRPCDrivingDimensionsService
29+ from .conversions import (
30+ build_grpc_id ,
31+ from_driving_dimension_to_grpc_driving_dimension ,
32+ from_grpc_driving_dimension_to_driving_dimension ,
33+ from_grpc_update_status_to_parameter_update_status ,
34+ )
2935
3036
3137class GRPCDrivingDimensionsServiceV1 (GRPCDrivingDimensionsService ): # pragma: no cover
@@ -43,14 +49,51 @@ class GRPCDrivingDimensionsServiceV1(GRPCDrivingDimensionsService): # pragma: n
4349
4450 @protect_grpc
4551 def __init__ (self , channel : grpc .Channel ): # noqa: D102
46- from ansys .api .geometry .v1 .drivingdimensions_pb2_grpc import DrivingDimensionsStub
52+ from ansys .api .discovery .v1 .design .parameters .drivingdimension_pb2_grpc import (
53+ DrivingDimensionStub ,
54+ )
4755
48- self .stub = DrivingDimensionsStub (channel )
56+ self .stub = DrivingDimensionStub (channel )
4957
5058 @protect_grpc
5159 def get_all_parameters (self , ** kwargs ) -> dict : # noqa: D102
52- raise NotImplementedError
60+ from ansys .api .discovery .v1 .commonmessages_pb2 import EntityIdentifier , ParentEntityRequest
61+
62+ # Call the gRPC service
63+ req = ParentEntityRequest (parent_id = EntityIdentifier ())
64+ if "parent_id" in kwargs :
65+ req .parent_id = build_grpc_id (kwargs ["parent_id" ])
66+
67+ response = self .stub .GetAll (req )
68+
69+ # Return the response - formatted as a dictionary
70+ return {
71+ "parameters" : [
72+ from_grpc_driving_dimension_to_driving_dimension (param )
73+ for param in response .driving_dimensions
74+ ],
75+ "success" : response .command_response .success ,
76+ }
5377
5478 @protect_grpc
5579 def set_parameter (self , ** kwargs ) -> dict : # noqa: D102
56- raise NotImplementedError
80+ from ansys .api .discovery .v1 .design .parameters .drivingdimension_pb2 import (
81+ SetDrivingDimensionRequest ,
82+ )
83+
84+ # Create the request - assumes all inputs are valid and of the proper type
85+ request = SetDrivingDimensionRequest (
86+ request_data = [
87+ from_driving_dimension_to_grpc_driving_dimension (kwargs ["driving_dimension" ])
88+ ]
89+ )
90+
91+ # Call the gRPC service
92+ response = self .stub .Set (request )
93+
94+ # Return the response - formatted as a dictionary
95+ return {
96+ "status" : from_grpc_update_status_to_parameter_update_status (
97+ response .response_data [0 ].status
98+ ),
99+ }
0 commit comments