Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FEATURE: Extend create port with name #505

Merged
merged 2 commits into from
May 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/pyedb/dotnet/edb.py
Original file line number Diff line number Diff line change
Expand Up @@ -3987,7 +3987,7 @@ def _get_connected_ports_from_multizone_cutout(self, terminal_info_dict):
return connected_ports_list

@pyedb_function_handler
def create_port(self, terminal, ref_terminal=None, is_circuit_port=False):
def create_port(self, terminal, ref_terminal=None, is_circuit_port=False, name=None):
"""Create a port.

Parameters
Expand All @@ -4005,7 +4005,8 @@ def create_port(self, terminal, ref_terminal=None, is_circuit_port=False):
Negative terminal of the port.
is_circuit_port : bool, optional
Whether it is a circuit port. The default is ``False``.

name: str, optional
Name of the created port. The default is None, a random name is generated.
Returns
-------
list: [:class:`pyedb.dotnet.edb_core.edb_data.ports.GapPort`,
Expand All @@ -4018,7 +4019,8 @@ def create_port(self, terminal, ref_terminal=None, is_circuit_port=False):
if ref_terminal:
ref_terminal.boundary_type = "PortBoundary"
terminal.ref_terminal = ref_terminal

if name:
terminal.name = name
return self.ports[terminal.name]

@pyedb_function_handler
Expand Down
10 changes: 10 additions & 0 deletions tests/legacy/system/test_edb.py
Original file line number Diff line number Diff line change
Expand Up @@ -1184,6 +1184,16 @@ def test_siwave_create_port_between_pin_and_layer(self):
]
for term in padstack_instance_terminals:
assert term.position
pos_pin = edbapp.padstacks.get_pinlist_from_component_and_net("C173")[1]
neg_pin = edbapp.padstacks.get_pinlist_from_component_and_net("C172")[0]
edbapp.create_port(
pos_pin.get_terminal(create_new_terminal=True),
neg_pin.get_terminal(create_new_terminal=True),
is_circuit_port=True,
name="test",
)
assert edbapp.ports["test"]
assert edbapp.ports["test"].is_circuit_port == True
edbapp.close()

def test_siwave_source_setter(self):
Expand Down
Loading