From d20e85998000eadd2aa888dbb71cf1d95b61f534 Mon Sep 17 00:00:00 2001 From: amruta Date: Tue, 23 Apr 2024 22:30:18 -0600 Subject: [PATCH 1/2] 287 : Nport model find missing --- .../edb/core/definition/component_def.py | 28 ++++++++++++++ .../edb/core/definition/component_model.py | 38 +++++++++++++++++++ 2 files changed, 66 insertions(+) diff --git a/src/ansys/edb/core/definition/component_def.py b/src/ansys/edb/core/definition/component_def.py index 536ce76aab..3ba03d5a19 100644 --- a/src/ansys/edb/core/definition/component_def.py +++ b/src/ansys/edb/core/definition/component_def.py @@ -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 ` + 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 ` + 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)) diff --git a/src/ansys/edb/core/definition/component_model.py b/src/ansys/edb/core/definition/component_model.py index 0230d7c506..57df871ba6 100644 --- a/src/ansys/edb/core/definition/component_model.py +++ b/src/ansys/edb/core/definition/component_model.py @@ -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 ` + 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 ` + 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.""" From 023b551b94392e97927d26a4b83aecf051d47556 Mon Sep 17 00:00:00 2001 From: amruta Date: Wed, 24 Apr 2024 14:10:52 -0600 Subject: [PATCH 2/2] 287 : Nport model find missing --- src/ansys/edb/core/definition/component_model.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ansys/edb/core/definition/component_model.py b/src/ansys/edb/core/definition/component_model.py index 57df871ba6..eca9a776e4 100644 --- a/src/ansys/edb/core/definition/component_model.py +++ b/src/ansys/edb/core/definition/component_model.py @@ -33,7 +33,7 @@ def find_by_name(cls, comp_def, value): comp_def : :class:`ComponentDef ` Component def to search for the component model. value : str - Name of the cell instance. + Name of the component model. Returns ------- @@ -53,7 +53,7 @@ def find_by_id(cls, comp_def, value): comp_def : :class:`ComponentDef ` Component def to search for the component model. value : int - ID of the cell instance. + ID of the component model. Returns -------