@@ -470,7 +470,7 @@ def find_interferences(
470
470
@protect_grpc
471
471
@min_backend_version (25 , 2 , 0 )
472
472
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
474
474
) -> RepairToolMessage :
475
475
"""Find and fix the short edge problem areas.
476
476
@@ -484,24 +484,29 @@ def find_and_fix_short_edges(
484
484
List of bodies that short edges are investigated on.
485
485
length : Real, optional
486
486
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.
487
490
488
491
Returns
489
492
-------
490
493
RepairToolMessage
491
- Message containing created and/or modified bodies.
494
+ Message containing number of problem areas found/fixed, created and/or modified bodies.
492
495
"""
493
496
from ansys .geometry .core .designer .body import Body
494
497
495
498
check_type_all_elements_in_iterable (bodies , Body )
496
499
check_type (length , Real )
500
+ check_type (comprehensive_result , bool )
497
501
498
502
if not bodies :
499
- return RepairToolMessage (False , [], [])
503
+ return RepairToolMessage (False , [], [], 0 , 0 )
500
504
501
505
response = self ._repair_stub .FindAndFixShortEdges (
502
506
FindShortEdgesRequest (
503
507
selection = [body .id for body in bodies ],
504
508
max_edge_length = DoubleValue (value = length ),
509
+ comprehensive = comprehensive_result ,
505
510
)
506
511
)
507
512
@@ -511,12 +516,16 @@ def find_and_fix_short_edges(
511
516
response .success ,
512
517
response .created_bodies_monikers ,
513
518
response .modified_bodies_monikers ,
519
+ response .found ,
520
+ response .repaired ,
514
521
)
515
522
return message
516
523
517
524
@protect_grpc
518
525
@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 :
520
529
"""Find and fix the extra edge problem areas.
521
530
522
531
Notes
@@ -529,22 +538,26 @@ def find_and_fix_extra_edges(self, bodies: list["Body"]) -> RepairToolMessage:
529
538
List of bodies that short edges are investigated on.
530
539
length : Real
531
540
The maximum length of the edges.
541
+ comprehensive_result : bool, optional
542
+ Whether to fix all problem areas individually.
543
+ By default, False.
532
544
533
545
Returns
534
546
-------
535
547
RepairToolMessage
536
- Message containing created and/or modified bodies.
548
+ Message containing number of problem areas found/fixed, created and/or modified bodies.
537
549
"""
538
550
from ansys .geometry .core .designer .body import Body
539
551
540
552
check_type_all_elements_in_iterable (bodies , Body )
553
+ check_type (comprehensive_result , bool )
541
554
542
555
if not bodies :
543
- return RepairToolMessage (False , [], [])
556
+ return RepairToolMessage (False , [], [], 0 , 0 )
544
557
545
558
response = self ._repair_stub .FindAndFixExtraEdges (
546
559
FindExtraEdgesRequest (
547
- selection = [body .id for body in bodies ],
560
+ selection = [body .id for body in bodies ], comprehensive = comprehensive_result
548
561
)
549
562
)
550
563
@@ -554,13 +567,19 @@ def find_and_fix_extra_edges(self, bodies: list["Body"]) -> RepairToolMessage:
554
567
response .success ,
555
568
response .created_bodies_monikers ,
556
569
response .modified_bodies_monikers ,
570
+ response .found ,
571
+ response .repaired ,
557
572
)
558
573
return message
559
574
560
575
@protect_grpc
561
576
@min_backend_version (25 , 2 , 0 )
562
577
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 ,
564
583
) -> RepairToolMessage :
565
584
"""Find and fix the split edge problem areas.
566
585
@@ -576,28 +595,35 @@ def find_and_fix_split_edges(
576
595
The maximum angle between edges. By default, 0.0.
577
596
length : Real, optional
578
597
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.
579
601
580
602
Returns
581
603
-------
582
604
RepairToolMessage
583
- Message containing created and/or modified bodies.
605
+ Message containing number of problem areas found/fixed, created and/or modified bodies.
584
606
"""
585
607
from ansys .geometry .core .designer .body import Body
586
608
587
609
check_type_all_elements_in_iterable (bodies , Body )
588
610
check_type (angle , Real )
589
611
check_type (length , Real )
612
+ check_type (comprehensive_result , bool )
590
613
591
614
if not bodies :
592
- return RepairToolMessage (False , [], [])
615
+ return RepairToolMessage (False , [], [], 0 , 0 )
593
616
594
617
angle_value = DoubleValue (value = float (angle ))
595
618
length_value = DoubleValue (value = float (length ))
596
619
body_ids = [body .id for body in bodies ]
597
620
598
621
response = self ._repair_stub .FindAndFixSplitEdges (
599
622
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 ,
601
627
)
602
628
)
603
629
@@ -607,6 +633,57 @@ def find_and_fix_split_edges(
607
633
response .success ,
608
634
response .created_bodies_monikers ,
609
635
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 ,
610
687
)
611
688
return message
612
689
0 commit comments