@@ -598,27 +598,79 @@ def delete_nets(self, netlist):
598
598
return nets_deleted
599
599
600
600
@pyaedt_function_handler ()
601
- def find_or_create_net (self , net_name = "" ):
601
+ def find_or_create_net (self , net_name = "" , start_with = "" , contain = "" , end_with = "" ):
602
602
"""Find or create the net with the given name in the layout.
603
603
604
604
Parameters
605
605
----------
606
606
net_name : str, optional
607
607
Name of the net to find or create. The default is ``""``.
608
608
609
+ start_with : str, optional
610
+ All net name starting with the string. Not case-sensitive.
611
+
612
+ contain : str, optional
613
+ All net name containing the string. Not case-sensitive.
614
+
615
+ end_with : str, optional
616
+ All net name ending with the string. Not case-sensitive.
617
+
609
618
Returns
610
619
-------
611
620
object
612
621
Net Object
613
622
"""
614
- if not net_name :
623
+ if not net_name and not start_with and not contain and not end_with :
615
624
net_name = generate_unique_name ("NET_" )
616
625
net = self ._edb .Cell .Net .Create (self ._active_layout , net_name )
626
+ return net
617
627
else :
618
- net = self ._edb .Cell .Net .FindByName (self ._active_layout , net_name )
619
- if net .IsNull ():
620
- net = self ._edb .Cell .Net .Create (self ._active_layout , net_name )
621
- return net
628
+ if not start_with and not contain and not end_with :
629
+ net = self ._edb .Cell .Net .FindByName (self ._active_layout , net_name )
630
+ if net .IsNull ():
631
+ net = self ._edb .Cell .Net .Create (self ._active_layout , net_name )
632
+ return net
633
+ elif start_with :
634
+ nets_found = [
635
+ self .nets [net ].net_object for net in list (self .nets .keys ()) if net .lower ().startswith (start_with )
636
+ ]
637
+ return nets_found
638
+ elif start_with and end_with :
639
+ nets_found = [
640
+ self .nets [net ].net_object
641
+ for net in list (self .nets .keys ())
642
+ if net .lower ().startswith (start_with ) and net .lower ().endswith (end_with )
643
+ ]
644
+ return nets_found
645
+ elif start_with and contain and end_with :
646
+ nets_found = [
647
+ self .nets [net ].net_object
648
+ for net in list (self .nets .keys ())
649
+ if net .lower ().startswith (start_with ) and net .lower ().endswith (end_with ) and contain in net .lower ()
650
+ ]
651
+ return nets_found
652
+ elif start_with and contain :
653
+ nets_found = [
654
+ self .nets [net ].net_object
655
+ for net in list (self .nets .keys ())
656
+ if net .lower ().startswith (start_with ) and contain in net .lower ()
657
+ ]
658
+ return nets_found
659
+ elif contain and end_with :
660
+ nets_found = [
661
+ self .nets [net ].net_object
662
+ for net in list (self .nets .keys ())
663
+ if net .lower ().endswith (end_with ) and contain in net .lower ()
664
+ ]
665
+ return nets_found
666
+ elif end_with and not start_with and not contain :
667
+ nets_found = [
668
+ self .nets [net ].net_object for net in list (self .nets .keys ()) if net .lower ().endswith (end_with )
669
+ ]
670
+ return nets_found
671
+ elif contain and not start_with and not end_with :
672
+ nets_found = [self .nets [net ].net_object for net in list (self .nets .keys ()) if contain in net .lower ()]
673
+ return nets_found
622
674
623
675
@pyaedt_function_handler ()
624
676
def is_net_in_component (self , component_name , net_name ):
0 commit comments