From 32ea8339c657dfa7e477778602e00970065831ad Mon Sep 17 00:00:00 2001 From: svandenb-dev <74993647+svandenb-dev@users.noreply.github.com> Date: Wed, 24 Jul 2024 17:06:42 +0200 Subject: [PATCH] FEAT: Via fencing improvement supporting specific angle (#693) * hfsspi SimsetupInfo bug fixed * temp * via fence improved * via fence improved --- src/pyedb/dotnet/edb_core/padstack.py | 10 +++++++++- tests/legacy/system/test_edb_padstacks.py | 15 ++++++++++++--- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/src/pyedb/dotnet/edb_core/padstack.py b/src/pyedb/dotnet/edb_core/padstack.py index 834d39b7d0..bfc684141b 100644 --- a/src/pyedb/dotnet/edb_core/padstack.py +++ b/src/pyedb/dotnet/edb_core/padstack.py @@ -1579,7 +1579,9 @@ def get_padstack_instances_intersecting_bounding_box(self, bounding_box, nets=No bounding_box = tuple(bounding_box) return list(index.intersection(bounding_box)) - def merge_via_along_lines(self, net_name="GND", distance_threshold=5e-3, minimum_via_number=6): + def merge_via_along_lines( + self, net_name="GND", distance_threshold=5e-3, minimum_via_number=6, selected_angles=None + ): """Replace padstack instances along lines into a single polygon. Detect all padstack instances that are placed along lines and replace them by a single polygon based one @@ -1598,6 +1600,11 @@ def merge_via_along_lines(self, net_name="GND", distance_threshold=5e-3, minimum minimum_via_number : int, optional The minimum number of points that a line must contain. Default is ``6``. + selected_angles : list[int, float] + Specify angle in degrees to detected, for instance [0, 180] is only detecting horizontal and vertical lines. + Other values can be assigned like 45 degrees. When `None` is provided all lines are detected. Default value + is `None`. + Returns ------- bool @@ -1622,6 +1629,7 @@ def merge_via_along_lines(self, net_name="GND", distance_threshold=5e-3, minimum points=instances_location, minimum_number_of_points=minimum_via_number, distance_threshold=distance_threshold, + selected_angles=selected_angles, ) for line in line_indexes: [_instances_to_delete.append(pdstk_series[ind]) for ind in line] diff --git a/tests/legacy/system/test_edb_padstacks.py b/tests/legacy/system/test_edb_padstacks.py index 1d8f548bb9..6696ab2c72 100644 --- a/tests/legacy/system/test_edb_padstacks.py +++ b/tests/legacy/system/test_edb_padstacks.py @@ -430,9 +430,11 @@ def test_polygon_based_padsatck(self): def test_via_fence(self): source_path = os.path.join(local_path, "example_models", test_subfolder, "via_fence_generic_project.aedb") - target_path = os.path.join(self.local_scratch.path, "test_pvia_fence", "via_fence.aedb") - self.local_scratch.copyfolder(source_path, target_path) - edbapp = Edb(target_path, edbversion=desktop_version) + target_path1 = os.path.join(self.local_scratch.path, "test_pvia_fence", "via_fence1.aedb") + target_path2 = os.path.join(self.local_scratch.path, "test_pvia_fence", "via_fence2.aedb") + self.local_scratch.copyfolder(source_path, target_path1) + self.local_scratch.copyfolder(source_path, target_path2) + edbapp = Edb(target_path1, edbversion=desktop_version) assert edbapp.padstacks.merge_via_along_lines(net_name="GND", distance_threshold=2e-3, minimum_via_number=6) assert not edbapp.padstacks.merge_via_along_lines( net_name="test_dummy", distance_threshold=2e-3, minimum_via_number=6 @@ -440,3 +442,10 @@ def test_via_fence(self): assert "main_via" in edbapp.padstacks.definitions assert "via_central" in edbapp.padstacks.definitions edbapp.close() + edbapp = Edb(target_path2, edbversion=desktop_version) + assert edbapp.padstacks.merge_via_along_lines( + net_name="GND", distance_threshold=2e-3, minimum_via_number=6, selected_angles=[0, 180] + ) + assert "main_via" in edbapp.padstacks.definitions + assert "via_central" in edbapp.padstacks.definitions + edbapp.close()