diff --git a/_unittest/test_00_EDB.py b/_unittest/test_00_EDB.py index 1f77b22fb80..ecc931946eb 100644 --- a/_unittest/test_00_EDB.py +++ b/_unittest/test_00_EDB.py @@ -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): diff --git a/pyaedt/edb_core/edb_data/padstacks_data.py b/pyaedt/edb_core/edb_data/padstacks_data.py index d5990c9641a..b3e01bd158e 100644 --- a/pyaedt/edb_core/edb_data/padstacks_data.py +++ b/pyaedt/edb_core/edb_data/padstacks_data.py @@ -1,5 +1,6 @@ from collections import OrderedDict import math +import re import warnings from pyaedt import is_ironpython @@ -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."""