Skip to content

Commit

Permalink
FEAT: edb cfg create polygon (#895)
Browse files Browse the repository at this point in the history
* FEAT: edb cfg create polygon

* MISC: Auto fixes from pre-commit.com hooks

For more information, see https://pre-commit.ci

---------

Co-authored-by: ring630 <@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
hui-zhou-a and pre-commit-ci[bot] authored Nov 20, 2024
1 parent 2204d85 commit d9a5071
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 5 deletions.
15 changes: 13 additions & 2 deletions src/pyedb/configuration/cfg_modeler.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,17 @@ def __init__(self, **kwargs):
self.layer = kwargs["layer"]
self.net_name = kwargs.get("net_name", "")
self.type = kwargs.get("type", "rectangle")
self.lower_left_point = kwargs["lower_left_point"]
self.upper_right_point = kwargs["upper_right_point"]

# rectangle
self.lower_left_point = kwargs.get("lower_left_point", [])
self.upper_right_point = kwargs.get("upper_right_point", [])
self.corner_radius = kwargs.get("corner_radius", 0)
self.rotation = kwargs.get("rotation", 0)
self.voids = kwargs.get("voids", [])

# polygon
self.points = kwargs.get("points", [])


class CfgModeler:
"""Manage configuration general settings."""
Expand Down Expand Up @@ -110,6 +115,12 @@ def apply(self):
rotation=p.rotation,
)
obj.aedt_name = p.name
elif p.type == "polygon":
obj = self._pedb.modeler.create_polygon(
main_shape=p.points, layer_name=p.layer, net_name=p.net_name
)
obj.aedt_name = p.name

for v in p.voids:
for i in self._pedb.layout.primitives:
if i.aedt_name == v:
Expand Down
15 changes: 12 additions & 3 deletions tests/legacy/system/test_edb_configuration_2p0.py
Original file line number Diff line number Diff line change
Expand Up @@ -1174,13 +1174,21 @@ def test_18_modeler(self, edb_examples):
],
"planes": [
{
"type": "rectangle",
"name": "GND_TOP",
"layer": "TOP",
"net_name": "GND",
"lower_left_point": [0, 0],
"upper_right_point": [0, "12mm"],
"upper_right_point": ["12mm", "12mm"],
"voids": ["trace_1_void"],
},
{
"type": "polygon",
"name": "GND_TOP_POLY",
"layer": "TOP",
"net_name": "GND",
"points": [["12mm", 0], ["13mm", 0], ["12mm", "12mm"]],
},
],
"components": [
{
Expand All @@ -1204,8 +1212,9 @@ def test_18_modeler(self, edb_examples):
edbapp.stackup.create_symmetric_stackup(2)
edbapp.configuration.load(data, apply_file=True)
assert [i for i in edbapp.layout.primitives if i.aedt_name == "trace_1"]
plane = [i for i in edbapp.layout.primitives if i.aedt_name == "GND_TOP"][0]
assert plane.voids
rect = [i for i in edbapp.layout.primitives if i.aedt_name == "GND_TOP"][0]
assert rect.voids
assert [i for i in edbapp.layout.primitives if i.aedt_name == "GND_TOP_POLY"][0]
assert edbapp.components["U1"]
edbapp.close()

Expand Down

0 comments on commit d9a5071

Please sign in to comment.