Skip to content

Commit

Permalink
padstack dcir equipotential region (#3554)
Browse files Browse the repository at this point in the history
* fix

* fix

* [pre-commit.ci] 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 Sep 13, 2023
1 parent 2edc70a commit 7b96bc5
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 0 deletions.
4 changes: 4 additions & 0 deletions _unittest/test_00_EDB.py
Original file line number Diff line number Diff line change
Expand Up @@ -2437,6 +2437,10 @@ def test_130_create_padstack_instance(self):
pad_instance3 = edb.padstacks.place(position=["-1.65mm", "-1.665mm"], definition_name="test2")
assert pad_instance3.start_layer == "1_Top"
assert pad_instance3.stop_layer == "1_Top"
pad_instance3.dcir_equipotential_region = True
assert pad_instance3.dcir_equipotential_region
pad_instance3.dcir_equipotential_region = False
assert not pad_instance3.dcir_equipotential_region
edb.close()

def test_131_assign_hfss_extent_non_multiple_with_simconfig(self):
Expand Down
64 changes: 64 additions & 0 deletions pyaedt/edb_core/edb_data/padstacks_data.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from collections import OrderedDict
import math
import re
import warnings

from pyaedt import is_ironpython
Expand Down Expand Up @@ -1001,6 +1002,69 @@ def __init__(self, edb_padstackinstance, _pedb):
self._position = []
self._pdef = None

@property
def _em_properties(self):
"""Get EM properties."""
default = (
r"$begin 'EM properties'\n"
r"\tType('Mesh')\n"
r"\tDataId='EM properties1'\n"
r"\t$begin 'Properties'\n"
r"\t\tGeneral=''\n"
r"\t\tModeled='true'\n"
r"\t\tUnion='true'\n"
r"\t\t'Use Precedence'='false'\n"
r"\t\t'Precedence Value'='1'\n"
r"\t\tPlanarEM=''\n"
r"\t\tRefined='true'\n"
r"\t\tRefineFactor='1'\n"
r"\t\tNoEdgeMesh='false'\n"
r"\t\tHFSS=''\n"
r"\t\t'Solve Inside'='false'\n"
r"\t\tSIwave=''\n"
r"\t\t'DCIR Equipotential Region'='false'\n"
r"\t$end 'Properties'\n"
r"$end 'EM properties'\n"
)

pid = self._pedb.edb_api.ProductId.Designer
_, p = self._edb_padstackinstance.GetProductProperty(pid, 18, "")
if p:
return p
else:
return default

@_em_properties.setter
def _em_properties(self, em_prop):
"""Set EM properties"""
pid = self._pedb.edb_api.ProductId.Designer
self._edb_padstackinstance.SetProductProperty(pid, 18, em_prop)

@property
def dcir_equipotential_region(self):
"""Check whether dcir equipotential region is enabled.
Returns
-------
bool
"""
pattern = r"'DCIR Equipotential Region'='([^']+)'"
em_pp = self._em_properties
result = re.search(pattern, em_pp).group(1)
if result == "true":
return True
else:
return False

@dcir_equipotential_region.setter
def dcir_equipotential_region(self, value):
"""Set dcir equipotential region."""
pp = r"'DCIR Equipotential Region'='true'" if value else r"'DCIR Equipotential Region'='false'"
em_pp = self._em_properties
pattern = r"'DCIR Equipotential Region'='([^']+)'"
new_em_pp = re.sub(pattern, pp, em_pp)
self._em_properties = new_em_pp

@property
def object_instance(self):
"""Edb Object Instance."""
Expand Down

0 comments on commit 7b96bc5

Please sign in to comment.