@@ -99,11 +99,11 @@ def find_split_edges(
9999 parent_design = get_design_from_body (bodies [0 ])
100100 return [
101101 SplitEdgeProblemAreas (
102- f"{ res [ 'id' ] } " ,
102+ f"{ res . get ( 'id' ) } " ,
103103 self ._grpc_client ,
104- get_edges_from_ids (parent_design , res [ "edges" ] ),
104+ get_edges_from_ids (parent_design , res . get ( "edges" ) ),
105105 )
106- for res in problem_areas_response [ "problems" ]
106+ for res in problem_areas_response . get ( "problems" )
107107 ]
108108
109109 def find_extra_edges (self , bodies : list ["Body" ]) -> list [ExtraEdgeProblemAreas ]:
@@ -133,11 +133,11 @@ def find_extra_edges(self, bodies: list["Body"]) -> list[ExtraEdgeProblemAreas]:
133133
134134 return [
135135 ExtraEdgeProblemAreas (
136- f"{ res [ 'id' ] } " ,
136+ f"{ res . get ( 'id' ) } " ,
137137 self ._grpc_client ,
138- get_edges_from_ids (parent_design , res [ "edges" ] ),
138+ get_edges_from_ids (parent_design , res . get ( "edges" ) ),
139139 )
140- for res in problem_areas_response [ "problems" ]
140+ for res in problem_areas_response . get ( "problems" )
141141 ]
142142
143143 def find_inexact_edges (self , bodies : list ["Body" ]) -> list [InexactEdgeProblemAreas ]:
@@ -168,11 +168,11 @@ def find_inexact_edges(self, bodies: list["Body"]) -> list[InexactEdgeProblemAre
168168
169169 return [
170170 InexactEdgeProblemAreas (
171- f"{ res [ 'id' ] } " ,
171+ f"{ res . get ( 'id' ) } " ,
172172 self ._grpc_client ,
173- get_edges_from_ids (parent_design , res [ "edges" ] ),
173+ get_edges_from_ids (parent_design , res . get ( "edges" ) ),
174174 )
175- for res in problem_areas_response [ "problems" ]
175+ for res in problem_areas_response . get ( "problems" )
176176 ]
177177
178178 def find_short_edges (
@@ -205,11 +205,11 @@ def find_short_edges(
205205 parent_design = get_design_from_body (bodies [0 ])
206206 return [
207207 ShortEdgeProblemAreas (
208- f"{ res [ 'id' ] } " ,
208+ f"{ res . get ( 'id' ) } " ,
209209 self ._grpc_client ,
210- get_edges_from_ids (parent_design , res [ "edges" ] ),
210+ get_edges_from_ids (parent_design , res . get ( "edges" ) ),
211211 )
212- for res in problem_areas_response [ "problems" ]
212+ for res in problem_areas_response . get ( "problems" )
213213 ]
214214
215215 def find_duplicate_faces (self , bodies : list ["Body" ]) -> list [DuplicateFaceProblemAreas ]:
@@ -239,11 +239,11 @@ def find_duplicate_faces(self, bodies: list["Body"]) -> list[DuplicateFaceProble
239239 parent_design = get_design_from_body (bodies [0 ])
240240 return [
241241 DuplicateFaceProblemAreas (
242- f"{ res [ 'id' ] } " ,
242+ f"{ res . get ( 'id' ) } " ,
243243 self ._grpc_client ,
244- get_faces_from_ids (parent_design , res [ "faces" ] ),
244+ get_faces_from_ids (parent_design , res . get ( "faces" ) ),
245245 )
246- for res in problem_areas_response [ "problems" ]
246+ for res in problem_areas_response . get ( "problems" )
247247 ]
248248
249249 def find_missing_faces (
@@ -276,18 +276,18 @@ def find_missing_faces(
276276 body_ids = [body .id for body in bodies ]
277277 problem_areas_response = self ._grpc_client .services .repair_tools .find_missing_faces (
278278 faces = body_ids ,
279- angle = angle . value if angle is not None else None ,
280- distance = distance . value if distance is not None else None ,
279+ angle = angle ,
280+ distance = distance ,
281281 )
282282 parent_design = get_design_from_body (bodies [0 ])
283283
284284 return [
285285 MissingFaceProblemAreas (
286- f"{ res [ 'id' ] } " ,
286+ f"{ res . get ( 'id' ) } " ,
287287 self ._grpc_client ,
288- get_edges_from_ids (parent_design , res [ "edges" ] ),
288+ get_edges_from_ids (parent_design , res . get ( "edges" ) ),
289289 )
290- for res in problem_areas_response [ "problems" ]
290+ for res in problem_areas_response . get ( "problems" )
291291 ]
292292
293293 def find_small_faces (self , bodies : list ["Body" ]) -> list [SmallFaceProblemAreas ]:
@@ -317,11 +317,11 @@ def find_small_faces(self, bodies: list["Body"]) -> list[SmallFaceProblemAreas]:
317317
318318 return [
319319 SmallFaceProblemAreas (
320- f"{ res [ 'id' ] } " ,
320+ f"{ res . get ( 'id' ) } " ,
321321 self ._grpc_client ,
322- get_faces_from_ids (parent_design , res [ "faces" ] ),
322+ get_faces_from_ids (parent_design , res . get ( "faces" ) ),
323323 )
324- for res in problem_areas_response [ "problems" ]
324+ for res in problem_areas_response . get ( "problems" )
325325 ]
326326
327327 def find_stitch_faces (
@@ -349,16 +349,16 @@ def find_stitch_faces(
349349 body_ids = [body .id for body in bodies ]
350350 problem_areas_response = self ._grpc_client .services .repair_tools .find_stitch_faces (
351351 faces = body_ids ,
352- distance = max_distance . value if max_distance is not None else None ,
352+ distance = max_distance ,
353353 )
354354 parent_design = get_design_from_body (bodies [0 ])
355355 return [
356356 StitchFaceProblemAreas (
357- f"{ res [ 'id' ] } " ,
357+ f"{ res . get ( 'id' ) } " ,
358358 self ._grpc_client ,
359- get_bodies_from_ids (parent_design , res [ "bodies" ] ),
359+ get_bodies_from_ids (parent_design , res . get ( "bodies" ) ),
360360 )
361- for res in problem_areas_response [ "problems" ]
361+ for res in problem_areas_response . get ( "problems" )
362362 ]
363363
364364 @min_backend_version (25 , 2 , 0 )
@@ -387,11 +387,11 @@ def find_simplify(self, bodies: list["Body"]) -> list[UnsimplifiedFaceProblemAre
387387
388388 return [
389389 UnsimplifiedFaceProblemAreas (
390- f"{ res [ 'id' ] } " ,
390+ f"{ res . get ( 'id' ) } " ,
391391 self ._grpc_client ,
392- get_faces_from_ids (parent_design , res [ "bodies" ] ),
392+ get_faces_from_ids (parent_design , res . get ( "bodies" ) ),
393393 )
394- for res in problem_areas_response [ "problems" ]
394+ for res in problem_areas_response . get ( "problems" )
395395 ]
396396
397397 @min_backend_version (25 , 2 , 0 )
@@ -436,11 +436,11 @@ def find_interferences(
436436
437437 return [
438438 InterferenceProblemAreas (
439- f"{ res [ 'id' ] } " ,
439+ f"{ res . get ( 'id' ) } " ,
440440 self ._grpc_client ,
441- get_bodies_from_ids (parent_design , res [ "bodies" ] ),
441+ get_bodies_from_ids (parent_design , res . get ( "bodies" ) ),
442442 )
443- for res in problem_areas_response [ "problems" ]
443+ for res in problem_areas_response . get ( "problems" )
444444 ]
445445
446446 @min_backend_version (25 , 2 , 0 )
@@ -488,9 +488,9 @@ def find_and_fix_short_edges(
488488 parent_design = get_design_from_body (bodies [0 ])
489489 parent_design ._update_design_inplace ()
490490 message = RepairToolMessage (
491- success = response [ "success" ] ,
492- found = response [ "found" ] ,
493- repaired = response [ "repaired" ] ,
491+ success = response . get ( "success" ) ,
492+ found = response . get ( "found" ) ,
493+ repaired = response . get ( "repaired" ) ,
494494 created_bodies = [],
495495 modified_bodies = [],
496496 )
@@ -538,11 +538,11 @@ def find_and_fix_extra_edges(
538538 parent_design = get_design_from_body (bodies [0 ])
539539 parent_design ._update_design_inplace ()
540540 message = RepairToolMessage (
541- response [ "success" ] ,
542- response [ "created_bodies_monikers" ] ,
543- response [ "modified_bodies_monikers" ] ,
544- response [ "found" ] ,
545- response [ "repaired" ] ,
541+ response . get ( "success" ) ,
542+ response . get ( "created_bodies_monikers" ) ,
543+ response . get ( "modified_bodies_monikers" ) ,
544+ response . get ( "found" ) ,
545+ response . get ( "repaired" ) ,
546546 )
547547 return message
548548
@@ -599,11 +599,11 @@ def find_and_fix_split_edges(
599599 parent_design = get_design_from_body (bodies [0 ])
600600 parent_design ._update_design_inplace ()
601601 message = RepairToolMessage (
602- response [ "success" ] ,
603- response [ "created_bodies_monikers" ] ,
604- response [ "modified_bodies_monikers" ] ,
605- response [ "found" ] ,
606- response [ "repaired" ] ,
602+ response . get ( "success" ) ,
603+ response . get ( "created_bodies_monikers" ) ,
604+ response . get ( "modified_bodies_monikers" ) ,
605+ response . get ( "found" ) ,
606+ response . get ( "repaired" ) ,
607607 )
608608 return message
609609
@@ -648,11 +648,11 @@ def find_and_fix_simplify(
648648 parent_design = get_design_from_body (bodies [0 ])
649649 parent_design ._update_design_inplace ()
650650 message = RepairToolMessage (
651- response [ "success" ] ,
652- response [ "created_bodies_monikers" ] ,
653- response [ "modified_bodies_monikers" ] ,
654- response [ "found" ] ,
655- response [ "repaired" ] ,
651+ response . get ( "success" ) ,
652+ response . get ( "created_bodies_monikers" ) ,
653+ response . get ( "modified_bodies_monikers" ) ,
654+ response . get ( "found" ) ,
655+ response . get ( "repaired" ) ,
656656 )
657657 return message
658658
@@ -705,7 +705,7 @@ def find_and_fix_stitch_faces(
705705
706706 response = self ._grpc_client .services .repair_tools .find_and_fix_stitch_faces (
707707 body_ids = body_ids ,
708- max_distance = max_distance . value if max_distance is not None else None ,
708+ max_distance = max_distance ,
709709 allow_multiple_bodies = allow_multiple_bodies ,
710710 maintain_components = maintain_components ,
711711 check_for_coincidence = check_for_coincidence ,
@@ -746,7 +746,7 @@ def inspect_geometry(self, bodies: list["Body"] = None) -> list[InspectResult]:
746746 parent_design = parent_design , bodies = body_ids
747747 )
748748 return self .__create_inspect_result_from_response (
749- parent_design , inspect_result_response_dict [ "issues_by_body" ]
749+ parent_design , inspect_result_response_dict . get ( "issues_by_body" )
750750 )
751751
752752 def __create_inspect_result_from_response (
@@ -755,7 +755,7 @@ def __create_inspect_result_from_response(
755755 inspect_results = []
756756 for inspect_geometry_result in inspect_geometry_results :
757757 body = get_bodies_from_ids (design , [inspect_geometry_result ["body" ]["id" ]])
758- issues = self .__create_issues_from_response (inspect_geometry_result [ "issues" ] )
758+ issues = self .__create_issues_from_response (inspect_geometry_result . get ( "issues" ) )
759759 inspect_result = InspectResult (
760760 grpc_client = self ._grpc_client , body = body [0 ], issues = issues
761761 )
@@ -769,9 +769,9 @@ def __create_issues_from_response(
769769 ) -> list [GeometryIssue ]:
770770 issues = []
771771 for issue in inspect_geometry_result_issues :
772- message_type = issue [ "message_type" ]
773- message_id = issue [ "message_id" ]
774- message = issue [ "message" ]
772+ message_type = issue . get ( "message_type" )
773+ message_id = issue . get ( "message_id" )
774+ message = issue . get ( "message" )
775775
776776 faces = [face ["id" ] for face in issue .get ("faces" , [])]
777777 edges = [edge ["id" ] for edge in issue .get ("edges" , [])]
@@ -808,5 +808,5 @@ def repair_geometry(self, bodies: list["Body"] = None) -> RepairToolMessage:
808808 bodies = body_ids
809809 )
810810
811- message = RepairToolMessage (repair_result_response [ "success" ] , [], [])
811+ message = RepairToolMessage (repair_result_response . get ( "success" ) , [], [])
812812 return message
0 commit comments