Skip to content

Commit

Permalink
component.create() metod rlc values and location bug fix (#4083)
Browse files Browse the repository at this point in the history
* edb intersection bug fix

* component.is_top property added

---------

Co-authored-by: Samuel Lopez <[email protected]>
  • Loading branch information
svandenb-dev and Samuelopez-ansys authored Jan 16, 2024
1 parent 8414d15 commit 2ea82c7
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
17 changes: 17 additions & 0 deletions _unittest/test_00_EDB.py
Original file line number Diff line number Diff line change
Expand Up @@ -3184,3 +3184,20 @@ def test_159_json_configuration(self):
edbapp.configuration.load(path_dc_json)

edbapp.close()

def test_160_define_component(self):
example_folder = os.path.join(local_path, "example_models", test_subfolder)
source_path_edb = os.path.join(example_folder, "ANSYS-HSD_V1.aedb")
target_path_edb = os.path.join(self.local_scratch.path, "test_component", "test.aedb")
self.local_scratch.copyfolder(source_path_edb, target_path_edb)
edbapp = Edb(target_path_edb, desktop_version)
comp_pins = edbapp.components.instances["U1"].pins
pins = [comp_pins["AM38"], comp_pins["AL37"]]
edbapp.components.create(
component_part_name="Test_part", component_name="Test", is_rlc=True, r_value=12.2, pins=pins
)
assert edbapp.components.instances["Test"]
assert edbapp.components.instances["Test"].res_value == str(12.2)
assert edbapp.components.instances["Test"].ind_value == "0"
assert edbapp.components.instances["Test"].cap_value == "0"
assert edbapp.components.instances["Test"].center == [0.06800000116, 0.01649999875]
10 changes: 5 additions & 5 deletions pyaedt/edb_core/components.py
Original file line number Diff line number Diff line change
Expand Up @@ -1429,9 +1429,9 @@ def create(
placement_layer=None,
component_part_name=None,
is_rlc=False,
r_value=1.0,
c_value=1e-9,
l_value=1e-9,
r_value=0,
c_value=0,
l_value=0,
is_parallel=False,
):
"""Create a component from pins.
Expand Down Expand Up @@ -1483,6 +1483,7 @@ def create(

if isinstance(pins[0], EDBPadstackInstance):
pins = [i._edb_padstackinstance for i in pins]
hosting_component_location = pins[0].GetComponent().GetTransform()
for pin in pins:
pin.SetIsLayoutPin(True)
new_cmp.AddMember(pin)
Expand All @@ -1493,9 +1494,8 @@ def create(
new_cmp_layer_name = placement_layer
new_cmp_placement_layer = self._edb.cell.layer.FindByName(self._layout.layer_collection, new_cmp_layer_name)
new_cmp.SetPlacementLayer(new_cmp_placement_layer)
hosting_component_location = pins[0].GetComponent().GetTransform()

if is_rlc:
if is_rlc and len(pins) == 2:
rlc = self._edb.utility.utility.Rlc()
rlc.IsParallel = is_parallel
if r_value:
Expand Down

0 comments on commit 2ea82c7

Please sign in to comment.