@@ -470,7 +470,7 @@ def find_interferences(
470470 @protect_grpc
471471 @min_backend_version (25 , 2 , 0 )
472472 def find_and_fix_short_edges (
473- self , bodies : list ["Body" ], length : Real = 0.0
473+ self , bodies : list ["Body" ], length : Real = 0.0 , comprehensive_result : bool = False
474474 ) -> RepairToolMessage :
475475 """Find and fix the short edge problem areas.
476476
@@ -484,24 +484,29 @@ def find_and_fix_short_edges(
484484 List of bodies that short edges are investigated on.
485485 length : Real, optional
486486 The maximum length of the edges. By default, 0.0.
487+ comprehensive_result : bool, optional
488+ Whether to fix all problem areas individually.
489+ By default, False.
487490
488491 Returns
489492 -------
490493 RepairToolMessage
491- Message containing created and/or modified bodies.
494+ Message containing number of problem areas found/fixed, created and/or modified bodies.
492495 """
493496 from ansys .geometry .core .designer .body import Body
494497
495498 check_type_all_elements_in_iterable (bodies , Body )
496499 check_type (length , Real )
500+ check_type (comprehensive_result , bool )
497501
498502 if not bodies :
499- return RepairToolMessage (False , [], [])
503+ return RepairToolMessage (False , [], [], 0 , 0 )
500504
501505 response = self ._repair_stub .FindAndFixShortEdges (
502506 FindShortEdgesRequest (
503507 selection = [body .id for body in bodies ],
504508 max_edge_length = DoubleValue (value = length ),
509+ comprehensive = comprehensive_result ,
505510 )
506511 )
507512
@@ -511,12 +516,16 @@ def find_and_fix_short_edges(
511516 response .success ,
512517 response .created_bodies_monikers ,
513518 response .modified_bodies_monikers ,
519+ response .found ,
520+ response .repaired ,
514521 )
515522 return message
516523
517524 @protect_grpc
518525 @min_backend_version (25 , 2 , 0 )
519- def find_and_fix_extra_edges (self , bodies : list ["Body" ]) -> RepairToolMessage :
526+ def find_and_fix_extra_edges (
527+ self , bodies : list ["Body" ], comprehensive_result : bool = False
528+ ) -> RepairToolMessage :
520529 """Find and fix the extra edge problem areas.
521530
522531 Notes
@@ -529,22 +538,26 @@ def find_and_fix_extra_edges(self, bodies: list["Body"]) -> RepairToolMessage:
529538 List of bodies that short edges are investigated on.
530539 length : Real
531540 The maximum length of the edges.
541+ comprehensive_result : bool, optional
542+ Whether to fix all problem areas individually.
543+ By default, False.
532544
533545 Returns
534546 -------
535547 RepairToolMessage
536- Message containing created and/or modified bodies.
548+ Message containing number of problem areas found/fixed, created and/or modified bodies.
537549 """
538550 from ansys .geometry .core .designer .body import Body
539551
540552 check_type_all_elements_in_iterable (bodies , Body )
553+ check_type (comprehensive_result , bool )
541554
542555 if not bodies :
543- return RepairToolMessage (False , [], [])
556+ return RepairToolMessage (False , [], [], 0 , 0 )
544557
545558 response = self ._repair_stub .FindAndFixExtraEdges (
546559 FindExtraEdgesRequest (
547- selection = [body .id for body in bodies ],
560+ selection = [body .id for body in bodies ], comprehensive = comprehensive_result
548561 )
549562 )
550563
@@ -554,13 +567,19 @@ def find_and_fix_extra_edges(self, bodies: list["Body"]) -> RepairToolMessage:
554567 response .success ,
555568 response .created_bodies_monikers ,
556569 response .modified_bodies_monikers ,
570+ response .found ,
571+ response .repaired ,
557572 )
558573 return message
559574
560575 @protect_grpc
561576 @min_backend_version (25 , 2 , 0 )
562577 def find_and_fix_split_edges (
563- self , bodies : list ["Body" ], angle : Real = 0.0 , length : Real = 0.0
578+ self ,
579+ bodies : list ["Body" ],
580+ angle : Real = 0.0 ,
581+ length : Real = 0.0 ,
582+ comprehensive_result : bool = False ,
564583 ) -> RepairToolMessage :
565584 """Find and fix the split edge problem areas.
566585
@@ -576,28 +595,35 @@ def find_and_fix_split_edges(
576595 The maximum angle between edges. By default, 0.0.
577596 length : Real, optional
578597 The maximum length of the edges. By default, 0.0.
598+ comprehensive_result : bool, optional
599+ Whether to fix all problem areas individually.
600+ By default, False.
579601
580602 Returns
581603 -------
582604 RepairToolMessage
583- Message containing created and/or modified bodies.
605+ Message containing number of problem areas found/fixed, created and/or modified bodies.
584606 """
585607 from ansys .geometry .core .designer .body import Body
586608
587609 check_type_all_elements_in_iterable (bodies , Body )
588610 check_type (angle , Real )
589611 check_type (length , Real )
612+ check_type (comprehensive_result , bool )
590613
591614 if not bodies :
592- return RepairToolMessage (False , [], [])
615+ return RepairToolMessage (False , [], [], 0 , 0 )
593616
594617 angle_value = DoubleValue (value = float (angle ))
595618 length_value = DoubleValue (value = float (length ))
596619 body_ids = [body .id for body in bodies ]
597620
598621 response = self ._repair_stub .FindAndFixSplitEdges (
599622 FindSplitEdgesRequest (
600- bodies_or_faces = body_ids , angle = angle_value , distance = length_value
623+ bodies_or_faces = body_ids ,
624+ angle = angle_value ,
625+ distance = length_value ,
626+ comprehensive = comprehensive_result ,
601627 )
602628 )
603629
@@ -607,6 +633,57 @@ def find_and_fix_split_edges(
607633 response .success ,
608634 response .created_bodies_monikers ,
609635 response .modified_bodies_monikers ,
636+ response .found ,
637+ response .repaired ,
638+ )
639+ return message
640+
641+ @protect_grpc
642+ @min_backend_version (25 , 2 , 0 )
643+ def find_and_fix_simplify (
644+ self , bodies : list ["Body" ], comprehensive_result : bool = False
645+ ) -> RepairToolMessage :
646+ """Find and simplify the provided geometry.
647+
648+ Notes
649+ -----
650+ This method simplifies the provided geometry.
651+
652+ Parameters
653+ ----------
654+ bodies : list[Body]
655+ List of bodies to be simplified.
656+ comprehensive_result : bool, optional
657+ Whether to fix all problem areas individually.
658+ By default, False.
659+
660+ Returns
661+ -------
662+ RepairToolMessage
663+ Message containing number of problem areas found/fixed, created and/or modified bodies.
664+ """
665+ from ansys .geometry .core .designer .body import Body
666+
667+ check_type_all_elements_in_iterable (bodies , Body )
668+ check_type (comprehensive_result , bool )
669+
670+ if not bodies :
671+ return RepairToolMessage (False , [], [], 0 , 0 )
672+
673+ body_ids = [body .id for body in bodies ]
674+
675+ response = self ._repair_stub .FindAndSimplify (
676+ FindAdjustSimplifyRequest (selection = body_ids , comprehensive = comprehensive_result )
677+ )
678+
679+ parent_design = get_design_from_body (bodies [0 ])
680+ parent_design ._update_design_inplace ()
681+ message = RepairToolMessage (
682+ response .success ,
683+ response .created_bodies_monikers ,
684+ response .modified_bodies_monikers ,
685+ response .found ,
686+ response .repaired ,
610687 )
611688 return message
612689
0 commit comments