Skip to content

Commit

Permalink
FEAT: adding support to extra properties in layer and vias (#888)
Browse files Browse the repository at this point in the history
* adding support to extra properties in layer and vias

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

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

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
felipeescastro and pre-commit-ci[bot] authored Nov 8, 2024
1 parent 527d617 commit 98981e4
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/pyedb/dotnet/edb_core/edb_data/control_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,19 @@ def _write_xml(self, root):
content.set("Thickness", self.properties.get("Thickness", "0.001"))
if self.properties.get("Type"):
content.set("Type", self.properties.get("Type", "conductor"))
if self.properties.get("ConvertPolygonToCircle"):
content.set("ConvertPolygonToCircle", self.properties["ConvertPolygonToCircle"])
if self.properties.get("ConvertPolygonToCircleRatio"):
content.set("ConvertPolygonToCircleRatio", self.properties["ConvertPolygonToCircleRatio"])
if self.properties.get("ReconstructArcs"):
content.set("ReconstructArcs", self.properties["ReconstructArcs"])
if self.properties.get("ArcTolerance"):
content.set("ArcTolerance", self.properties["ArcTolerance"])
if self.properties.get("UnionPrimitives"):
content.set("UnionPrimitives", self.properties["UnionPrimitives"])
# To confirm syntax with development
if self.properties.get("DefeatureMinTraceWidth"):
content.set("DefeatureMinTraceWidth", self.properties["DefeatureMinTraceWidth"])


class ControlFileVia(ControlFileLayer):
Expand Down Expand Up @@ -226,6 +239,14 @@ def _write_xml(self, root):
content.set("Thickness", self.properties.get("Thickness", "0.001"))
if self.properties.get("Type"):
content.set("Type", self.properties.get("Type", "conductor"))
if self.properties.get("ConvertPolygonToCircle"):
content.set("ConvertPolygonToCircle", self.properties["ConvertPolygonToCircle"])
if self.properties.get("ConvertPolygonToCircleRatio"):
content.set("ConvertPolygonToCircleRatio", self.properties["ConvertPolygonToCircleRatio"])
if self.properties.get("ReconstructArcs"):
content.set("ReconstructArcs", self.properties["ReconstructArcs"])
if self.properties.get("ArcTolerance"):
content.set("ArcTolerance", self.properties["ArcTolerance"])
if self.create_via_group:
viagroup = ET.SubElement(content, "CreateViaGroups")
viagroup.set("CheckContainment", "true" if self.check_containment else "false")
Expand Down
35 changes: 35 additions & 0 deletions tests/legacy/system/test_edb.py
Original file line number Diff line number Diff line change
Expand Up @@ -1395,6 +1395,41 @@ def test_backdrill_via_with_offset(self):
assert padstack_instance2.backdrill_bottom[2] == "100um"
edb.close()

def test_add_via_with_options_control_file(self):
"""Add new via layer with option in control file."""
from pyedb.dotnet.edb_core.edb_data.control_file import ControlFile

ctrl = ControlFile()
ctrl.stackup.add_layer(
"m2",
properties={
"Elevation": "0.0",
"Material": "copper",
"Type": "conductor",
"Thickness": "1.0",
"UnionPrimitives": "true",
},
)
assert [layer for layer in ctrl.stackup.layers if layer.name == "m2"]

ctrl.stackup.add_layer(
"m1",
properties={
"Elevation": "1.0",
"Material": "copper",
"Type": "conductor",
"Thickness": "1.5",
"UnionPrimitives": "false",
"ConvertPolygonToCircle": "true",
},
)
assert [layer for layer in ctrl.stackup.layers if layer.properties["Elevation"] == "1.0"]

ctrl.stackup.add_via(
"via12", properties={"StartLayer": "m2", "StopLayer": "m1", "ConvertPolygonToCircle": "true"}
)
assert [via for via in ctrl.stackup.vias if via.properties["ConvertPolygonToCircle"] == "true"]

def test_add_layer_api_with_control_file(self):
"""Add new layers with control file."""
from pyedb.dotnet.edb_core.edb_data.control_file import ControlFile
Expand Down

0 comments on commit 98981e4

Please sign in to comment.