Skip to content

Commit

Permalink
287 : Nport model find missing
Browse files Browse the repository at this point in the history
  • Loading branch information
amruta3991 committed Apr 24, 2024
1 parent fc72907 commit d20e859
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 0 deletions.
28 changes: 28 additions & 0 deletions src/ansys/edb/core/definition/component_def.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,31 @@ def component_pins(self):
"""
objs = self.__stub.GetComponentPins(self.msg).items
return map_list(objs, component_pin.ComponentPin)

def add_component_model(self, value):
"""Add a component model to this component def.
Parameters
----------
value : :class:`Component Model <ansys.edb.core.definition.ComponentModel>`
Component Model to be added.
Notes
-----
Once a component model is added to one component def, it cannot be added to any other, even when removed.
"""
self.__stub.AddComponentModel(messages.pointer_property_message(self, value))

def remove_component_model(self, value):
"""Remove a component model from this component def.
Parameters
----------
value : :class:`Component Model <ansys.edb.core.definition.ComponentModel>`
Component Model to be removed.
Notes
-----
Once a component model is added to one component def, it cannot be added to any other, even when removed.
"""
self.__stub.RemoveComponentModel(messages.pointer_property_message(self, value))
38 changes: 38 additions & 0 deletions src/ansys/edb/core/definition/component_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,44 @@ def reference_file(self):
def reference_file(self, value):
self.__stub.SetReferenceFile(messages.string_property_message(self, value))

@classmethod
def find_by_name(cls, comp_def, value):
"""Find a component model by name in a given component def.
Parameters
----------
comp_def : :class:`ComponentDef <ansys.edb.core.definition.ComponentDef>`
Component def to search for the component model.
value : str
Name of the cell instance.
Returns
-------
ComponentModel
Component model that is found, ``None`` otherwise.
"""
return ComponentModel(
cls.__stub.FindByName(messages.string_property_message(comp_def, value))
)

@classmethod
def find_by_id(cls, comp_def, value):
"""Find a component model by ID in a given component def.
Parameters
----------
comp_def : :class:`ComponentDef <ansys.edb.core.definition.ComponentDef>`
Component def to search for the component model.
value : int
ID of the cell instance.
Returns
-------
ComponentModel
Component model that is found, ``None`` otherwise.
"""
return ComponentModel(cls.__stub.FindById(messages.int_proprty_message(comp_def, value)))


class NPortComponentModel(ComponentModel):
"""Represents an NPort component model."""
Expand Down

0 comments on commit d20e859

Please sign in to comment.