3535 from_length_to_grpc_quantity ,
3636 from_point3d_to_grpc_point ,
3737 from_unit_vector_to_grpc_direction ,
38+ serialize_tracked_command_response ,
3839)
3940
4041
@@ -186,7 +187,10 @@ def get_bounding_box(self, **kwargs) -> dict: # noqa: D102
186187
187188 @protect_grpc
188189 def extrude_edges (self , ** kwargs ) -> dict : # noqa: D102
189- from ansys .api .geometry .v0 .commands_pb2 import ExtrudeEdgesRequest
190+ from ansys .api .discovery .v1 .operations .edit_pb2 import (
191+ ExtrudeEdgesRequest ,
192+ ExtrudeEdgesRequestData ,
193+ )
190194
191195 # Parse some optional arguments
192196 point = from_point3d_to_grpc_point (kwargs ["point" ]) if kwargs ["point" ] else None
@@ -196,34 +200,108 @@ def extrude_edges(self, **kwargs) -> dict: # noqa: D102
196200
197201 # Create the request - assumes all inputs are valid and of the proper type
198202 request = ExtrudeEdgesRequest (
199- edges = [build_grpc_id (edge_id ) for edge_id in kwargs ["edge_ids" ]],
200- distance = from_length_to_grpc_quantity (kwargs ["distance" ]),
201- face = build_grpc_id (kwargs ["face" ]),
202- point = point ,
203- direction = direction ,
204- extrude_type = kwargs ["extrude_type" ].value ,
205- pull_symmetric = kwargs ["pull_symmetric" ],
206- copy = kwargs ["copy" ],
207- natural_extension = kwargs ["natural_extension" ],
203+ request_data = [
204+ ExtrudeEdgesRequestData (
205+ edge_ids = [build_grpc_id (edge_id ) for edge_id in kwargs ["edge_ids" ]],
206+ face_id = build_grpc_id (kwargs ["face" ]),
207+ point = point ,
208+ direction = direction ,
209+ distance = from_length_to_grpc_quantity (kwargs ["distance" ]),
210+ extrude_type = kwargs ["extrude_type" ].value ,
211+ pull_symmetric = kwargs ["pull_symmetric" ],
212+ copy = kwargs ["copy" ],
213+ natural_extension = kwargs ["natural_extension" ],
214+ )
215+ ]
208216 )
209217
210- # Call the gRPC service
211- resp = self .EditStub .ExtrudeEdges (request )
218+ # Call the gRPC service and serialize the response
219+ response = self .EditStub .ExtrudeEdges (request )
220+ tracked_response = serialize_tracked_command_response (response .tracked_command_response )
212221
213222 # Return the response - formatted as a dictionary
214223 return {
215- "created_bodies " : [ body . id for body in resp . created_bodies ] ,
216- "success " : resp . success ,
224+ "success " : tracked_response . get ( "success" ) ,
225+ "created_bodies " : [ body . get ( "id" ) for body in tracked_response . get ( "created_bodies" )] ,
217226 }
218227
219228 @protect_grpc
220229 def extrude_edges_up_to (self , ** kwargs ) -> dict : # noqa: D102
221- return NotImplementedError
230+ from ansys .api .discovery .v1 .operations .edit_pb2 import (
231+ ExtrudeEdgesUpToRequest ,
232+ ExtrudeEdgesUpToRequestData ,
233+ )
234+
235+ # Create the request - assumes all inputs are valid and of the proper type
236+ request = ExtrudeEdgesUpToRequest (
237+ request_data = [
238+ ExtrudeEdgesUpToRequestData (
239+ edge_ids = [build_grpc_id (id ) for id in kwargs ["face_ids" ]],
240+ up_to_selection_id = build_grpc_id (kwargs ["up_to_selection_id" ]),
241+ seed_point = from_point3d_to_grpc_point (kwargs ["seed_point" ]),
242+ direction = from_unit_vector_to_grpc_direction (kwargs ["direction" ]),
243+ extrude_type = kwargs ["extrude_type" ].value ,
244+ )
245+ ]
246+ )
247+
248+ # Call the gRPC service and serialize the response
249+ response = self .EditStub .ExtrudeFacesUpTo (request = request )
250+ tracked_response = serialize_tracked_command_response (response .tracked_command_response )
251+
252+ # Return the response - formatted as a dictionary
253+ return {
254+ "success" : tracked_response .get ("success" ),
255+ "created_bodies" : [body .get ("id" ) for body in tracked_response .get ("created_bodies" )],
256+ }
222257
223258 @protect_grpc
224259 def move_imprint_edges (self , ** kwargs ) -> dict : # noqa: D102
225- return NotImplementedError
260+ from ansys .api .discovery .v1 .operations .edit_pb2 import (
261+ MoveImprintEdgesRequest ,
262+ MoveImprintEdgesRequestData ,
263+ )
264+
265+ # Create the request - assumes all inputs are valid and of the proper type
266+ request = MoveImprintEdgesRequest (
267+ request_data = [
268+ MoveImprintEdgesRequestData (
269+ edge_ids = [build_grpc_id (edge_id ) for edge_id in kwargs ["edge_ids" ]],
270+ direction = from_unit_vector_to_grpc_direction (kwargs ["direction" ]),
271+ distance = from_length_to_grpc_quantity (kwargs ["distance" ]),
272+ )
273+ ]
274+ )
275+
276+ # Call the gRPC service
277+ response = self .EditStub .MoveImprintEdges (request )
278+
279+ # Return the response - formatted as a dictionary
280+ return {
281+ "success" : response .tracked_command_response .command_response .success ,
282+ }
226283
227284 @protect_grpc
228285 def offset_edges (self , ** kwargs ) -> dict : # noqa: D102
229- return NotImplementedError
286+ from ansys .api .discovery .v1 .operations .edit_pb2 import (
287+ OffsetEdgesRequest ,
288+ OffsetEdgesRequestData ,
289+ )
290+
291+ # Create the request - assumes all inputs are valid and of the proper type
292+ request = OffsetEdgesRequest (
293+ request_data = [
294+ OffsetEdgesRequestData (
295+ edge_ids = [build_grpc_id (edge_id ) for edge_id in kwargs ["edge_ids" ]],
296+ value = from_length_to_grpc_quantity (kwargs ["offset" ]),
297+ )
298+ ]
299+ )
300+
301+ # Call the gRPC service
302+ response = self .EditStub .OffsetEdges (request )
303+
304+ # Return the response - formatted as a dictionary
305+ return {
306+ "success" : response .tracked_command_response .command_response .success ,
307+ }
0 commit comments