diff --git a/src/ansys/edb/core/database.py b/src/ansys/edb/core/database.py index 4e71b7e954..b0742661fd 100644 --- a/src/ansys/edb/core/database.py +++ b/src/ansys/edb/core/database.py @@ -18,7 +18,7 @@ PadstackDef, ) from ansys.edb.core.edb_defs import DefinitionObjType -from ansys.edb.core.inner import ObjBase, variable_server +from ansys.edb.core.inner.base import ObjBase from ansys.edb.core.inner.messages import ( double_property_message, edb_obj_collection_message, @@ -29,6 +29,7 @@ str_message, ) from ansys.edb.core.inner.utils import map_list +from ansys.edb.core.inner.variable_server import VariableServer from ansys.edb.core.layout import Cell from ansys.edb.core.session import DatabaseServiceStub, StubAccessor, StubType @@ -50,7 +51,7 @@ class ProductIdType(Enum): INVALID_PRODUCT = edb_defs_pb2.INVALID_PRODUCT -class Database(ObjBase, variable_server.VariableServer): +class Database(ObjBase, VariableServer): """Class representing a database object.""" __stub: DatabaseServiceStub = StubAccessor(StubType.database) @@ -63,7 +64,7 @@ def __init__(self, msg): msg : EDBObjMessage """ ObjBase.__init__(self, msg) - variable_server.VariableServer.__init__(self, msg) + VariableServer.__init__(self, msg) @classmethod def create(cls, db_path): diff --git a/src/ansys/edb/core/definition/bondwire_def.py b/src/ansys/edb/core/definition/bondwire_def.py index 53a17af9c9..c8d019624a 100644 --- a/src/ansys/edb/core/definition/bondwire_def.py +++ b/src/ansys/edb/core/definition/bondwire_def.py @@ -6,7 +6,8 @@ import ansys.api.edb.v1.bondwire_def_pb2 as pb from ansys.edb.core.edb_defs import DefinitionObjType -from ansys.edb.core.inner import ObjBase, messages +from ansys.edb.core.inner.base import ObjBase +from ansys.edb.core.inner.messages import value_message from ansys.edb.core.session import StubAccessor, StubType from ansys.edb.core.utility import Value @@ -176,7 +177,7 @@ class _Jedec4QueryBuilder: def jedec4_bondwire_def_set_parameters_message(j, top_to_die_distance): return pb.Jedec4BondwireDefSetParametersMessage( target=j.msg, - top_to_die_distance=messages.value_message(top_to_die_distance), + top_to_die_distance=value_message(top_to_die_distance), ) @@ -264,9 +265,9 @@ class _Jedec5QueryBuilder: @staticmethod def jedec5_bondwire_def_parameters_message(top_to_die_distance, die_pad_angle, lead_pad_angle): return pb.Jedec5BondwireDefParametersMessage( - top_to_die_distance=messages.value_message(top_to_die_distance), - die_pad_angle=messages.value_message(die_pad_angle), - lead_pad_angle=messages.value_message(lead_pad_angle), + top_to_die_distance=value_message(top_to_die_distance), + die_pad_angle=value_message(die_pad_angle), + lead_pad_angle=value_message(lead_pad_angle), ) @staticmethod diff --git a/src/ansys/edb/core/definition/component_def.py b/src/ansys/edb/core/definition/component_def.py index ac5febe955..3c8e11cd91 100644 --- a/src/ansys/edb/core/definition/component_def.py +++ b/src/ansys/edb/core/definition/component_def.py @@ -3,7 +3,13 @@ from ansys.edb.core.definition import component_model, component_pin from ansys.edb.core.edb_defs import DefinitionObjType -from ansys.edb.core.inner import ObjBase, messages +from ansys.edb.core.inner.base import ObjBase +from ansys.edb.core.inner.messages import ( + component_def_creation_message, + edb_obj_pair_message, + object_name_in_layout_message, + string_property_message, +) from ansys.edb.core.inner.utils import map_list from ansys.edb.core.layout import cell from ansys.edb.core.session import StubAccessor, StubType @@ -33,7 +39,7 @@ def create(cls, db, comp_def_name, fp): Newly created component definition. """ return ComponentDef( - cls.__stub.Create(messages.component_def_creation_message(db, comp_def_name, fp)) + cls.__stub.Create(component_def_creation_message(db, comp_def_name, fp)) ) @classmethod @@ -52,9 +58,7 @@ def find(cls, db, comp_def_name): ComponentDef Component definition that was found, None otherwise. """ - return ComponentDef( - cls.__stub.FindByName(messages.object_name_in_layout_message(db, comp_def_name)) - ) + return ComponentDef(cls.__stub.FindByName(object_name_in_layout_message(db, comp_def_name))) @property def definition_type(self): @@ -68,7 +72,7 @@ def name(self): @name.setter def name(self, value): - self.__stub.SetName(messages.string_property_message(self, value)) + self.__stub.SetName(string_property_message(self, value)) @property def footprint(self): @@ -77,7 +81,7 @@ def footprint(self): @footprint.setter def footprint(self, value): - self.__stub.SetFootprintCell(messages.edb_obj_pair_message(self, value)) + self.__stub.SetFootprintCell(edb_obj_pair_message(self, value)) @property def component_models(self): diff --git a/src/ansys/edb/core/definition/component_model.py b/src/ansys/edb/core/definition/component_model.py index 24c542e20d..ebd5740f7c 100644 --- a/src/ansys/edb/core/definition/component_model.py +++ b/src/ansys/edb/core/definition/component_model.py @@ -6,7 +6,8 @@ ) import google.protobuf.wrappers_pb2 as proto_wrappers -from ansys.edb.core.inner import ObjBase, messages +from ansys.edb.core.inner.base import ObjBase +from ansys.edb.core.inner.messages import string_property_message from ansys.edb.core.session import StubAccessor, StubType @@ -22,7 +23,7 @@ def reference_file(self): @reference_file.setter def reference_file(self, value): - self.__stub.SetReferenceFile(messages.string_property_message(self, value)) + self.__stub.SetReferenceFile(string_property_message(self, value)) class NPortComponentModel(ComponentModel): @@ -85,4 +86,4 @@ def design_name(self): @design_name.setter def design_name(self, value): - self.__stub.SetDesignName(messages.string_property_message(self, value)) + self.__stub.SetDesignName(string_property_message(self, value)) diff --git a/src/ansys/edb/core/definition/component_pin.py b/src/ansys/edb/core/definition/component_pin.py index 739fd7e336..e942370855 100644 --- a/src/ansys/edb/core/definition/component_pin.py +++ b/src/ansys/edb/core/definition/component_pin.py @@ -2,7 +2,8 @@ from ansys.api.edb.v1.component_pin_pb2_grpc import ComponentPinServiceStub from ansys.edb.core.definition import component_def -from ansys.edb.core.inner import ObjBase, messages +from ansys.edb.core.inner.base import ObjBase +from ansys.edb.core.inner.messages import edb_obj_name_message, string_property_message from ansys.edb.core.session import StubAccessor, StubType @@ -27,7 +28,7 @@ def create(cls, comp_def, name): ComponentPin Newly created component pin. """ - return ComponentPin(cls.__stub.Create(messages.edb_obj_name_message(comp_def, name))) + return ComponentPin(cls.__stub.Create(edb_obj_name_message(comp_def, name))) @classmethod def find(cls, comp_def, name): @@ -45,7 +46,7 @@ def find(cls, comp_def, name): ComponentPin Component pin that was found, None otherwise. """ - return ComponentPin(cls.__stub.FindByName(messages.edb_obj_name_message(comp_def, name))) + return ComponentPin(cls.__stub.FindByName(edb_obj_name_message(comp_def, name))) @property def name(self): @@ -54,7 +55,7 @@ def name(self): @name.setter def name(self, value): - self.__stub.SetName(messages.string_property_message(self, value)) + self.__stub.SetName(string_property_message(self, value)) @property def number(self): diff --git a/src/ansys/edb/core/definition/component_property.py b/src/ansys/edb/core/definition/component_property.py index 67fb1941db..2c0fafb7df 100644 --- a/src/ansys/edb/core/definition/component_property.py +++ b/src/ansys/edb/core/definition/component_property.py @@ -4,7 +4,13 @@ import ansys.api.edb.v1.model_pb2 as model_pb2 from ansys.edb.core.definition import package_def -from ansys.edb.core.inner import ObjBase, messages +from ansys.edb.core.inner.base import ObjBase +from ansys.edb.core.inner.messages import ( + edb_obj_message, + pointer_property_message, + value_message, + value_property_message, +) from ansys.edb.core.session import StubAccessor, StubType from ansys.edb.core.utility import Value @@ -21,7 +27,7 @@ def clone(self): ------- ComponentProperty """ - return ComponentProperty(self.__stub.Clone(messages.edb_obj_message(self))) + return ComponentProperty(self.__stub.Clone(edb_obj_message(self))) @property def package_mounting_offset(self): @@ -29,22 +35,20 @@ def package_mounting_offset(self): Property can be set with :term:`ValueLike` """ - return Value(self.__stub.GetPackageMountingOffset(messages.edb_obj_message(self))) + return Value(self.__stub.GetPackageMountingOffset(edb_obj_message(self))) @package_mounting_offset.setter def package_mounting_offset(self, offset): - self.__stub.SetPackageMountingOffset( - messages.value_property_message(self, messages.value_message(offset)) - ) + self.__stub.SetPackageMountingOffset(value_property_message(self, value_message(offset))) @property def package_def(self): """:obj:`PackageDef` : Package definition object.""" - return package_def.PackageDef(self.__stub.GetPackageDef(messages.edb_obj_message(self))) + return package_def.PackageDef(self.__stub.GetPackageDef(edb_obj_message(self))) @package_def.setter def package_def(self, value): - self.__stub.SetPackageDef(messages.pointer_property_message(target=self, value=value)) + self.__stub.SetPackageDef(pointer_property_message(target=self, value=value)) @property def model(self): @@ -52,7 +56,7 @@ def model(self): A copy is returned. Use the setter for any modifications to be reflected. """ - comp_model_msg = self.__stub.GetModel(messages.edb_obj_message(self)) + comp_model_msg = self.__stub.GetModel(edb_obj_message(self)) def get_model_obj_type(): from ansys.edb.core.hierarchy import ( @@ -77,4 +81,4 @@ def get_model_obj_type(): @model.setter def model(self, value): - self.__stub.SetModel(messages.pointer_property_message(target=self, value=value)) + self.__stub.SetModel(pointer_property_message(target=self, value=value)) diff --git a/src/ansys/edb/core/definition/dataset_def.py b/src/ansys/edb/core/definition/dataset_def.py index 9394379426..118462336d 100644 --- a/src/ansys/edb/core/definition/dataset_def.py +++ b/src/ansys/edb/core/definition/dataset_def.py @@ -2,7 +2,7 @@ from ansys.api.edb.v1.dataset_def_pb2_grpc import DatasetDefServiceStub from ansys.edb.core.edb_defs import DefinitionObjType -from ansys.edb.core.inner import ObjBase +from ansys.edb.core.inner.base import ObjBase from ansys.edb.core.inner.messages import ( edb_obj_message, edb_obj_name_message, diff --git a/src/ansys/edb/core/definition/debye_model.py b/src/ansys/edb/core/definition/debye_model.py index 8805abd859..1a95f3ff9c 100644 --- a/src/ansys/edb/core/definition/debye_model.py +++ b/src/ansys/edb/core/definition/debye_model.py @@ -5,15 +5,18 @@ from ansys.edb.core import session from ansys.edb.core.definition.dielectric_material_model import DielectricMaterialModel -from ansys.edb.core.inner import messages +from ansys.edb.core.inner.messages import ( + bool_property_message, + double_message, + double_property_message, + edb_obj_message, +) class _DebyeModelQueryBuilder: @staticmethod def frequency_range_message(low, high): - return pb.FrequencyRangeMessage( - low=messages.double_message(low), high=messages.double_message(high) - ) + return pb.FrequencyRangeMessage(low=double_message(low), high=double_message(high)) @staticmethod def set_frequency_range_message(target, low, high): @@ -38,12 +41,12 @@ def create(cls): ------- DebyeModelService """ - return DebyeModel(DielectricMaterialModel(cls.__stub.Create(empty_pb2.Empty()))) + return DebyeModel(cls.__stub.Create(empty_pb2.Empty())) @property def frequency_range(self): """:obj:`tuple` of :obj:`float`, :obj:`float`: Frequency range (low, high).""" - range_msg = self.__stub.GetFrequencyRange(messages.edb_obj_message(self)) + range_msg = self.__stub.GetFrequencyRange(edb_obj_message(self)) return range_msg.low.value, range_msg.high.value @frequency_range.setter @@ -57,9 +60,7 @@ def frequency_range(self, freq): @property def relative_permitivity_at_high_low_frequency(self): """:obj:`tuple` of :obj:`float`, :obj:`float`: Relative permitivity frequency range (low, high).""" - range_msg = self.__stub.GetRelativePermitivityAtHighLowFrequency( - messages.edb_obj_message(self) - ) + range_msg = self.__stub.GetRelativePermitivityAtHighLowFrequency(edb_obj_message(self)) return range_msg.low.value, range_msg.high.value @relative_permitivity_at_high_low_frequency.setter @@ -73,7 +74,7 @@ def relative_permitivity_at_high_low_frequency(self, freq): @property def loss_tangent_at_high_low_frequency(self): """:obj:`tuple` of :obj:`float`, :obj:`float`: Loss tangent frequency range (low, high).""" - range_msg = self.__stub.GetLossTangentAtHighLowFrequency(messages.edb_obj_message(self)) + range_msg = self.__stub.GetLossTangentAtHighLowFrequency(edb_obj_message(self)) return range_msg.low.value, range_msg.high.value @loss_tangent_at_high_low_frequency.setter @@ -92,7 +93,7 @@ def is_relative_permitivity_enabled_at_optical_frequency(self): @is_relative_permitivity_enabled_at_optical_frequency.setter def is_relative_permitivity_enabled_at_optical_frequency(self, enabled): self.__stub.SetRelativePermitivityEnabledAtOpticalFrequency( - messages.bool_property_message(self, enabled) + bool_property_message(self, enabled) ) @property @@ -102,7 +103,7 @@ def use_dc_conductivity(self): @use_dc_conductivity.setter def use_dc_conductivity(self, enabled): - self.__stub.SetUseDCConductivity(messages.bool_property_message(self, enabled)) + self.__stub.SetUseDCConductivity(bool_property_message(self, enabled)) @property def relative_permitivity_at_optical_frequency(self): @@ -112,7 +113,7 @@ def relative_permitivity_at_optical_frequency(self): @relative_permitivity_at_optical_frequency.setter def relative_permitivity_at_optical_frequency(self, frequency): self.__stub.SetRelativePermitivityAtOpticalFrequency( - messages.double_property_message(self, frequency) + double_property_message(self, frequency) ) @property @@ -122,4 +123,4 @@ def dc_conductivity(self): @dc_conductivity.setter def dc_conductivity(self, conductivity): - self.__stub.SetDCConductivity(messages.double_property_message(self, conductivity)) + self.__stub.SetDCConductivity(double_property_message(self, conductivity)) diff --git a/src/ansys/edb/core/definition/die_property.py b/src/ansys/edb/core/definition/die_property.py index 36f29ad759..10cc0c7107 100644 --- a/src/ansys/edb/core/definition/die_property.py +++ b/src/ansys/edb/core/definition/die_property.py @@ -6,7 +6,14 @@ from ansys.api.edb.v1.die_property_pb2_grpc import DiePropertyServiceStub import google.protobuf.empty_pb2 as empty_pb2 -from ansys.edb.core.inner import ObjBase, messages +from ansys.edb.core.inner.base import ObjBase +from ansys.edb.core.inner.messages import ( + edb_obj_message, + set_die_orientation_message, + set_die_type_message, + value_message, + value_property_message, +) from ansys.edb.core.session import StubAccessor, StubType from ansys.edb.core.utility import Value @@ -61,7 +68,7 @@ def clone(self): DieProperty The cloned die property created. """ - return DieProperty(self.__stub.Clone(messages.edb_obj_message(self))) + return DieProperty(self.__stub.Clone(edb_obj_message(self))) @property def die_type(self): @@ -70,7 +77,7 @@ def die_type(self): @die_type.setter def die_type(self, value): - self.__stub.SetDieType(messages.set_die_type_message(self, value)) + self.__stub.SetDieType(set_die_type_message(self, value)) @property def height(self): @@ -78,11 +85,11 @@ def height(self): Property can be set with :term:`ValueLike` """ - return Value(self.__stub.GetHeight(messages.edb_obj_message(self))) + return Value(self.__stub.GetHeight(edb_obj_message(self))) @height.setter def height(self, height): - self.__stub.SetHeight(messages.value_property_message(self, messages.value_message(height))) + self.__stub.SetHeight(value_property_message(self, value_message(height))) @property def die_orientation(self): @@ -91,4 +98,4 @@ def die_orientation(self): @die_orientation.setter def die_orientation(self, value): - self.__stub.SetOrientation(messages.set_die_orientation_message(self, value)) + self.__stub.SetOrientation(set_die_orientation_message(self, value)) diff --git a/src/ansys/edb/core/definition/dielectric_material_model.py b/src/ansys/edb/core/definition/dielectric_material_model.py index d0bf25ecbb..53b85981d2 100644 --- a/src/ansys/edb/core/definition/dielectric_material_model.py +++ b/src/ansys/edb/core/definition/dielectric_material_model.py @@ -4,7 +4,7 @@ from ansys.api.edb.v1 import dielectric_material_model_pb2_grpc from ansys.edb.core import session -from ansys.edb.core.inner import ObjBase +from ansys.edb.core.inner.base import ObjBase class DielectricMaterialModelType(Enum): diff --git a/src/ansys/edb/core/definition/djordjecvic_sarkar_model.py b/src/ansys/edb/core/definition/djordjecvic_sarkar_model.py index 1bd6353e38..b80f094186 100644 --- a/src/ansys/edb/core/definition/djordjecvic_sarkar_model.py +++ b/src/ansys/edb/core/definition/djordjecvic_sarkar_model.py @@ -4,7 +4,7 @@ from ansys.edb.core import session from ansys.edb.core.definition.dielectric_material_model import DielectricMaterialModel -from ansys.edb.core.inner import messages +from ansys.edb.core.inner.messages import bool_property_message, double_property_message class DjordjecvicSarkarModel(DielectricMaterialModel): @@ -31,7 +31,7 @@ def use_dc_relative_conductivity(self): @use_dc_relative_conductivity.setter def use_dc_relative_conductivity(self, enabled): - self.__stub.SetUseDCRelativePermitivity(messages.bool_property_message(self, enabled)) + self.__stub.SetUseDCRelativePermitivity(bool_property_message(self, enabled)) @property def frequency(self): @@ -40,7 +40,7 @@ def frequency(self): @frequency.setter def frequency(self, frequency): - self.__stub.SetFrequency(messages.double_property_message(self, frequency)) + self.__stub.SetFrequency(double_property_message(self, frequency)) @property def relative_permitivity_at_frequency(self): @@ -49,9 +49,7 @@ def relative_permitivity_at_frequency(self): @relative_permitivity_at_frequency.setter def relative_permitivity_at_frequency(self, frequency): - self.__stub.SetRelativePermitivityAtFrequency( - messages.double_property_message(self, frequency) - ) + self.__stub.SetRelativePermitivityAtFrequency(double_property_message(self, frequency)) @property def loss_tangent_at_frequency(self): @@ -60,7 +58,7 @@ def loss_tangent_at_frequency(self): @loss_tangent_at_frequency.setter def loss_tangent_at_frequency(self, frequency): - self.__stub.SetLossTangentAtFrequency(messages.double_property_message(self, frequency)) + self.__stub.SetLossTangentAtFrequency(double_property_message(self, frequency)) @property def dc_relative_permitivity(self): @@ -69,7 +67,7 @@ def dc_relative_permitivity(self): @dc_relative_permitivity.setter def dc_relative_permitivity(self, permitivity): - self.__stub.SetDCRelativePermitivity(messages.double_property_message(self, permitivity)) + self.__stub.SetDCRelativePermitivity(double_property_message(self, permitivity)) @property def dc_conductivity(self): @@ -78,4 +76,4 @@ def dc_conductivity(self): @dc_conductivity.setter def dc_conductivity(self, conductivity): - self.__stub.SetDCConductivity(messages.double_property_message(self, conductivity)) + self.__stub.SetDCConductivity(double_property_message(self, conductivity)) diff --git a/src/ansys/edb/core/definition/ic_component_property.py b/src/ansys/edb/core/definition/ic_component_property.py index ce01088e5b..e484ed94a7 100644 --- a/src/ansys/edb/core/definition/ic_component_property.py +++ b/src/ansys/edb/core/definition/ic_component_property.py @@ -9,7 +9,7 @@ port_property, solder_ball_property, ) -from ansys.edb.core.inner import messages +from ansys.edb.core.inner.messages import edb_obj_message, pointer_property_message from ansys.edb.core.session import StubAccessor, StubType @@ -37,14 +37,12 @@ def solder_ball_property(self): A copy is returned. Use the setter for any modifications to be reflected. """ return solder_ball_property.SolderBallProperty( - self.__stub.GetSolderBallProperty(messages.edb_obj_message(self)) + self.__stub.GetSolderBallProperty(edb_obj_message(self)) ) @solder_ball_property.setter def solder_ball_property(self, value): - self.__stub.SetSolderBallProperty( - messages.pointer_property_message(target=self, value=value) - ) + self.__stub.SetSolderBallProperty(pointer_property_message(target=self, value=value)) @property def die_property(self): @@ -52,11 +50,11 @@ def die_property(self): A copy is returned. Use the setter for any modifications to be reflected. """ - return die_property.DieProperty(self.__stub.GetDieProperty(messages.edb_obj_message(self))) + return die_property.DieProperty(self.__stub.GetDieProperty(edb_obj_message(self))) @die_property.setter def die_property(self, value): - self.__stub.SetDieProperty(messages.pointer_property_message(target=self, value=value)) + self.__stub.SetDieProperty(pointer_property_message(target=self, value=value)) @property def port_property(self): @@ -64,10 +62,8 @@ def port_property(self): A copy is returned. Use the setter for any modifications to be reflected. """ - return port_property.PortProperty( - self.__stub.GetPortProperty(messages.edb_obj_message(self)) - ) + return port_property.PortProperty(self.__stub.GetPortProperty(edb_obj_message(self))) @port_property.setter def port_property(self, value): - self.__stub.SetPortProperty(messages.pointer_property_message(target=self, value=value)) + self.__stub.SetPortProperty(pointer_property_message(target=self, value=value)) diff --git a/src/ansys/edb/core/definition/io_component_property.py b/src/ansys/edb/core/definition/io_component_property.py index 45b0c533d8..63dfc6ce2e 100644 --- a/src/ansys/edb/core/definition/io_component_property.py +++ b/src/ansys/edb/core/definition/io_component_property.py @@ -4,7 +4,7 @@ import google.protobuf.empty_pb2 as empty_pb2 from ansys.edb.core.definition import component_property, port_property, solder_ball_property -from ansys.edb.core.inner import messages +from ansys.edb.core.inner.messages import edb_obj_message, pointer_property_message from ansys.edb.core.session import StubAccessor, StubType @@ -32,14 +32,12 @@ def solder_ball_property(self): A copy is returned. Use the setter for any modifications to be reflected. """ return solder_ball_property.SolderBallProperty( - self.__stub.GetSolderBallProperty(messages.edb_obj_message(self)) + self.__stub.GetSolderBallProperty(edb_obj_message(self)) ) @solder_ball_property.setter def solder_ball_property(self, value): - self.__stub.SetSolderBallProperty( - messages.pointer_property_message(target=self, value=value) - ) + self.__stub.SetSolderBallProperty(pointer_property_message(target=self, value=value)) @property def port_property(self): @@ -47,10 +45,8 @@ def port_property(self): A copy is returned. Use the setter for any modifications to be reflected. """ - return port_property.PortProperty( - self.__stub.GetPortProperty(messages.edb_obj_message(self)) - ) + return port_property.PortProperty(self.__stub.GetPortProperty(edb_obj_message(self))) @port_property.setter def port_property(self, value): - self.__stub.SetPortProperty(messages.pointer_property_message(target=self, value=value)) + self.__stub.SetPortProperty(pointer_property_message(target=self, value=value)) diff --git a/src/ansys/edb/core/definition/material_def.py b/src/ansys/edb/core/definition/material_def.py index 0ef5a23a19..38e52189a4 100644 --- a/src/ansys/edb/core/definition/material_def.py +++ b/src/ansys/edb/core/definition/material_def.py @@ -6,7 +6,15 @@ from ansys.edb.core.definition import DielectricMaterialModel from ansys.edb.core.edb_defs import DefinitionObjType -from ansys.edb.core.inner import ObjBase, messages +from ansys.edb.core.inner.base import ObjBase +from ansys.edb.core.inner.messages import ( + edb_internal_id_message, + edb_obj_message, + edb_obj_name_message, + material_properties_message, + pointer_property_message, + value_message, +) from ansys.edb.core.session import MaterialDefServiceStub, StubAccessor, StubType from ansys.edb.core.utility import Value @@ -62,9 +70,9 @@ class _QueryBuilder: @staticmethod def create(database, name, **kwargs): return pb.MaterialDefCreationMessage( - database=messages.edb_obj_message(database), + database=edb_obj_message(database), name=name, - properties=messages.material_properties_message(**kwargs), + properties=material_properties_message(**kwargs), ) @staticmethod @@ -77,12 +85,12 @@ def tensor_pos_message(col, row): @staticmethod def set_property(material_def, material_property, value, component, col, row): msg_params = { - "materialDef": messages.edb_obj_message(material_def), + "materialDef": edb_obj_message(material_def), "propertyId": material_property.value, - "value": messages.value_message(value), + "value": value_message(value), } if component is not None: - msg_params["component"] = messages.edb_internal_id_message(component) + msg_params["component"] = edb_internal_id_message(component) elif row is not None and col is not None: msg_params["tensor"] = _QueryBuilder.tensor_pos_message(col, row) return pb.MaterialDefSetPropertyMessage(**msg_params) @@ -90,11 +98,11 @@ def set_property(material_def, material_property, value, component, col, row): @staticmethod def get_property(material_def, material_property, component, col, row): msg_params = { - "materialDef": messages.edb_obj_message(material_def), + "materialDef": edb_obj_message(material_def), "propertyId": material_property.value, } if component is not None: - msg_params["component"] = messages.edb_internal_id_message(component) + msg_params["component"] = edb_internal_id_message(component) elif row is not None and col is not None: msg_params["tensor"] = _QueryBuilder.tensor_pos_message(col, row) return pb.MaterialDefGetPropertyMessage(**msg_params) @@ -102,7 +110,7 @@ def get_property(material_def, material_property, component, col, row): @staticmethod def material_def_get_property_message(material_def, material_property_id): return pb.MaterialDefPropertyMessage( - materialDef=messages.edb_obj_message(material_def), + materialDef=edb_obj_message(material_def), propertyId=material_property_id.value, ) @@ -111,9 +119,9 @@ def material_def_set_thermal_modifier_message( material_def, material_property_id, thermal_modifier ): return pb.SetMaterialDefPropertyMessage( - materialDef=messages.edb_obj_message(material_def), + materialDef=edb_obj_message(material_def), propertyId=material_property_id.value, - thermal_modifier=messages.edb_obj_message(thermal_modifier), + thermal_modifier=edb_obj_message(thermal_modifier), ) @staticmethod @@ -121,7 +129,7 @@ def material_def_get_anisotropic_thermal_modifier_message( material_def, material_property_id, component ): return pb.MaterialDefPropertyComponentMessage( - materialDef=messages.edb_obj_message(material_def), + materialDef=edb_obj_message(material_def), propertyId=material_property_id.value, component=component, ) @@ -131,10 +139,10 @@ def material_def_set_anisotropic_thermal_modifier_message( material_def, material_property_id, component, thermal_modifier ): return pb.SetMaterialDefPropertyComponentMessage( - materialDef=messages.edb_obj_message(material_def), + materialDef=edb_obj_message(material_def), propertyId=material_property_id.value, component=component, - thermal_modifier=messages.edb_obj_message(thermal_modifier), + thermal_modifier=edb_obj_message(thermal_modifier), ) @@ -193,7 +201,7 @@ def find_by_name(cls, database, name): MaterialDef The material definition object found. """ - return MaterialDef(cls.__stub.FindByName(messages.edb_obj_name_message(database, name))) + return MaterialDef(cls.__stub.FindByName(edb_obj_name_message(database, name))) @property def definition_type(self): @@ -206,7 +214,7 @@ def name(self): Read-Only. """ - return self.__stub.GetName(messages.edb_obj_message(self)).value + return self.__stub.GetName(edb_obj_message(self)).value @property def dielectric_material_model(self): @@ -214,16 +222,16 @@ def dielectric_material_model(self): `: \ Dielectric material model of the material definition.""" return DielectricMaterialModel( - self.__stub.GetDielectricMaterialModel(messages.edb_obj_message(self)) + self.__stub.GetDielectricMaterialModel(edb_obj_message(self)) ) @dielectric_material_model.setter def dielectric_material_model(self, dielectric): - self.__stub.SetDielectricMaterialModel(messages.pointer_property_message(self, dielectric)) + self.__stub.SetDielectricMaterialModel(pointer_property_message(self, dielectric)) def delete(self): """Delete a material definition.""" - self.__stub.Delete(messages.edb_obj_message(self)) + self.__stub.Delete(edb_obj_message(self)) def set_property(self, material_property, value, component_id=None, col=None, row=None): """Set a property value of a material. @@ -278,7 +286,7 @@ def get_all_properties(self): list [:class:`MaterialProperty`] List with Material Properties of the material definition. """ - msg = self.__stub.GetAllProperties(messages.edb_obj_message(self)) + msg = self.__stub.GetAllProperties(edb_obj_message(self)) return [MaterialProperty(i) for i in msg.properties] def remove_property(self, material_property): @@ -290,9 +298,7 @@ def remove_property(self, material_property): Property id. """ self.__stub.RemoveProperty( - _QueryBuilder.get_property( - messages.edb_obj_message(self), material_property, None, None, None - ) + _QueryBuilder.get_property(edb_obj_message(self), material_property, None, None, None) ) def get_dimensions(self, material_property_id): diff --git a/src/ansys/edb/core/definition/material_property_thermal_modifier.py b/src/ansys/edb/core/definition/material_property_thermal_modifier.py index b211724a05..8c2b10dc9c 100644 --- a/src/ansys/edb/core/definition/material_property_thermal_modifier.py +++ b/src/ansys/edb/core/definition/material_property_thermal_modifier.py @@ -3,7 +3,8 @@ from ansys.api.edb.v1 import material_property_thermal_modifier_pb2_grpc import ansys.api.edb.v1.material_def_pb2 as pb -from ansys.edb.core.inner import ObjBase, messages +from ansys.edb.core.inner.base import ObjBase +from ansys.edb.core.inner.messages import edb_obj_message, value_message from ansys.edb.core.session import StubAccessor, StubType from ansys.edb.core.utility import AdvancedQuadraticParams, BasicQuadraticParams, Value @@ -12,16 +13,16 @@ class _QueryBuilder: @staticmethod def create(basic_quadratic_params, advanced_quadratic_params): return pb.MaterialPropertyThermalModifierParamsMessage( - temp_ref=messages.value_message(basic_quadratic_params.temp_ref_val), - c1=messages.value_message(basic_quadratic_params.c1_val), - c2=messages.value_message(basic_quadratic_params.c2_val), - temp_lower_limit=messages.value_message(advanced_quadratic_params.temp_lower_limit_val), - temp_upper_limit=messages.value_message(advanced_quadratic_params.temp_upper_limit_val), + temp_ref=value_message(basic_quadratic_params.temp_ref_val), + c1=value_message(basic_quadratic_params.c1_val), + c2=value_message(basic_quadratic_params.c2_val), + temp_lower_limit=value_message(advanced_quadratic_params.temp_lower_limit_val), + temp_upper_limit=value_message(advanced_quadratic_params.temp_upper_limit_val), auto_calc_constant_thermal_modifier=advanced_quadratic_params.auto_calc_constant_thermal_modifier_vals, - lower_const_therm_mod=messages.value_message( + lower_const_therm_mod=value_message( advanced_quadratic_params.lower_constant_thermal_modifier_val ), - upper_const_therm_mod=messages.value_message( + upper_const_therm_mod=value_message( advanced_quadratic_params.upper_constant_thermal_modifier_val ), ) @@ -72,7 +73,7 @@ def quadratic_model_params(self): Read-Only. """ - msg = self.__stub.GetQuadraticModelParams(messages.edb_obj_message(self)) + msg = self.__stub.GetQuadraticModelParams(edb_obj_message(self)) return BasicQuadraticParams( Value(msg.temp_ref), Value(msg.c1), @@ -91,4 +92,4 @@ def expression(self): Read-Only. """ - return Value(self.__stub.GetThermalModifierExpression(messages.edb_obj_message(self))) + return Value(self.__stub.GetThermalModifierExpression(edb_obj_message(self))) diff --git a/src/ansys/edb/core/definition/multipole_debye_model.py b/src/ansys/edb/core/definition/multipole_debye_model.py index ea3174b071..84ed15af6f 100644 --- a/src/ansys/edb/core/definition/multipole_debye_model.py +++ b/src/ansys/edb/core/definition/multipole_debye_model.py @@ -5,15 +5,15 @@ from ansys.edb.core import session from ansys.edb.core.definition.dielectric_material_model import DielectricMaterialModel -from ansys.edb.core.inner import messages +from ansys.edb.core.inner.messages import double_message, edb_obj_message class _MultipoleDebyeModelQueryBuilder: @staticmethod def multmultipole_debye_model_params(frequencies, permitivities, loss_tangents): - frequencies_msg = [messages.double_message(i) for i in frequencies] - permitivities_msg = [messages.double_message(i) for i in permitivities] - loss_tangents_msg = [messages.double_message(i) for i in loss_tangents] + frequencies_msg = [double_message(i) for i in frequencies] + permitivities_msg = [double_message(i) for i in permitivities] + loss_tangents_msg = [double_message(i) for i in loss_tangents] return pb.MultipoleDebyeModelGetParams( frequencies=frequencies_msg, relative_permitivities=permitivities_msg, @@ -59,7 +59,7 @@ def get_parameters(self): loss_tangents : list[float] List of loss tangents at each frequency. """ - parameters_msg = self.__stub.GetParameters(messages.edb_obj_message(self)) + parameters_msg = self.__stub.GetParameters(edb_obj_message(self)) return ( [i.value for i in parameters_msg.frequencies], [i.value for i in parameters_msg.relative_permitivities], diff --git a/src/ansys/edb/core/definition/package_def.py b/src/ansys/edb/core/definition/package_def.py index 9ca598068c..2a7fac9780 100644 --- a/src/ansys/edb/core/definition/package_def.py +++ b/src/ansys/edb/core/definition/package_def.py @@ -3,7 +3,7 @@ from ansys.api.edb.v1 import package_def_pb2_grpc from ansys.edb.core.edb_defs import DefinitionObjType -from ansys.edb.core.inner import ObjBase, parser +from ansys.edb.core.inner.base import ObjBase from ansys.edb.core.inner.messages import ( edb_obj_message, get_product_property_ids_message, @@ -16,6 +16,7 @@ value_message, value_property_message, ) +from ansys.edb.core.inner.parser import to_polygon_data from ansys.edb.core.session import StubAccessor, StubType from ansys.edb.core.utility import Value from ansys.edb.core.utility.heat_sink import HeatSink, HeatSinkFinOrientation @@ -78,7 +79,7 @@ def name(self, value): self.__stub.SetName(string_property_message(self, value)) @property - @parser.to_polygon_data + @to_polygon_data def exterior_boundary(self): """:class:`PolygonData `: Exterior boundary for package definition.""" return self.__stub.GetExteriorBoundary(edb_obj_message(self)) diff --git a/src/ansys/edb/core/definition/padstack_def.py b/src/ansys/edb/core/definition/padstack_def.py index c63b15422e..2510feb7dc 100644 --- a/src/ansys/edb/core/definition/padstack_def.py +++ b/src/ansys/edb/core/definition/padstack_def.py @@ -5,7 +5,7 @@ from ansys.edb.core.definition.padstack_def_data import PadstackDefData from ansys.edb.core.edb_defs import DefinitionObjType -from ansys.edb.core.inner import ObjBase +from ansys.edb.core.inner.base import ObjBase from ansys.edb.core.session import StubAccessor, StubType diff --git a/src/ansys/edb/core/definition/padstack_def_data.py b/src/ansys/edb/core/definition/padstack_def_data.py index 52c2df23bd..3cc8b4b261 100644 --- a/src/ansys/edb/core/definition/padstack_def_data.py +++ b/src/ansys/edb/core/definition/padstack_def_data.py @@ -9,13 +9,15 @@ from ansys.api.edb.v1.padstack_def_data_pb2_grpc import PadstackDefDataServiceStub import google.protobuf.empty_pb2 as empty_pb2 -from ansys.edb.core.inner import ObjBase, messages, parser +from ansys.edb.core.inner.base import ObjBase +from ansys.edb.core.inner.messages import polygon_data_message, value_message +from ansys.edb.core.inner.parser import to_polygon_data from ansys.edb.core.session import StubAccessor, StubType from ansys.edb.core.utility import Value class _PadstackDefDataQueryBuilder: - """Class for creating padstack def data grpc messages.""" + """Class for creating padstack def data grpc.""" if TYPE_CHECKING: from padstack_def_data import PadstackDefData @@ -56,10 +58,10 @@ def padstack_def_data_get_pad_parameters_parameters_message( ): return pb.PadstackDefDataGetPadParametersParametersMessage( geometry_type=geometry_type.value, - sizes=[messages.value_message(val) for val in sizes], - offset_x=messages.value_message(offset_x), - offset_y=messages.value_message(offset_y), - rotation=messages.value_message(rotation), + sizes=[value_message(val) for val in sizes], + offset_x=value_message(offset_x), + offset_y=value_message(offset_y), + rotation=value_message(rotation), ) @staticmethod @@ -87,10 +89,10 @@ def padstack_def_data_set_pad_parameters_message( return pb.PadstackDefDataPadParametersSetMessage( polygon=pb.PadstackDefDataSetPolygonalPadParametersMessage( params1=p1, - fp=messages.polygon_data_message(fp), - offset_x=messages.value_message(offset_x), - offset_y=messages.value_message(offset_y), - rotation=messages.value_message(rotation), + fp=polygon_data_message(fp), + offset_x=value_message(offset_x), + offset_y=value_message(offset_y), + rotation=value_message(rotation), ) ) @@ -105,7 +107,7 @@ def padstack_def_data_set_hole_range_message(target, hole_range): @staticmethod def padstack_def_data_set_plating_percentage(target, plating_percentage): return pb.PadstackDefDataSetPlatingPercentage( - target=target.msg, plating_percentage=messages.value_message(plating_percentage) + target=target.msg, plating_percentage=value_message(plating_percentage) ) @staticmethod @@ -133,13 +135,13 @@ def padstack_def_data_set_solderball_placement_message(target, solderball_placem @staticmethod def padstack_def_data_get_solder_ball_param_message(d1, d2): return pb.PadstackDefDataGetSolderBallParamMessage( - d1=messages.value_message(d1), d2=messages.value_message(d2) + d1=value_message(d1), d2=value_message(d2) ) @staticmethod def padstack_def_data_set_solder_ball_param_message(target, d1, d2): return pb.PadstackDefDataSetSolderBallParamMessage( - target=target.msg, d1=messages.value_message(d1), d2=messages.value_message(d2) + target=target.msg, d1=value_message(d1), d2=value_message(d2) ) @staticmethod @@ -390,7 +392,7 @@ def get_pad_parameters(self, layer, pad_type): ) else: return ( - parser.to_polygon_data(message.polygon.fp), + to_polygon_data(message.polygon.fp), Value(message.polygon.offset_x), Value(message.polygon.offset_y), Value(message.polygon.rotation), diff --git a/src/ansys/edb/core/definition/port_property.py b/src/ansys/edb/core/definition/port_property.py index f94a234bbc..8b5899b01f 100644 --- a/src/ansys/edb/core/definition/port_property.py +++ b/src/ansys/edb/core/definition/port_property.py @@ -3,7 +3,14 @@ from ansys.api.edb.v1.port_property_pb2_grpc import PortPropertyServiceStub import google.protobuf.empty_pb2 as empty_pb2 -from ansys.edb.core.inner import ObjBase, messages +from ansys.edb.core.inner.base import ObjBase +from ansys.edb.core.inner.messages import ( + bool_property_message, + edb_obj_message, + value_message, + value_pair_property_message, + value_property_message, +) from ansys.edb.core.session import StubAccessor, StubType from ansys.edb.core.utility import Value @@ -34,7 +41,7 @@ def clone(self): PortProperty The cloned port property created. """ - return PortProperty(self.__stub.Clone(messages.edb_obj_message(self))) + return PortProperty(self.__stub.Clone(edb_obj_message(self))) @property def reference_height(self): @@ -42,22 +49,20 @@ def reference_height(self): Property can be set with :term:`ValueLike` """ - return Value(self.__stub.GetReferenceHeight(messages.edb_obj_message(self))) + return Value(self.__stub.GetReferenceHeight(edb_obj_message(self))) @reference_height.setter def reference_height(self, height): - self.__stub.SetReferenceHeight( - messages.value_property_message(self, messages.value_message(height)) - ) + self.__stub.SetReferenceHeight(value_property_message(self, value_message(height))) @property def reference_size_auto(self): """:obj:`bool`: If the reference size is automatic.""" - return self.__stub.GetReferenceSizeAuto(messages.edb_obj_message(self)).value + return self.__stub.GetReferenceSizeAuto(edb_obj_message(self)).value @reference_size_auto.setter def reference_size_auto(self, auto): - self.__stub.SetReferenceSizeAuto(messages.bool_property_message(self, auto)) + self.__stub.SetReferenceSizeAuto(bool_property_message(self, auto)) def get_reference_size(self): r"""Get the X and Y reference size for the port property. @@ -70,7 +75,7 @@ def get_reference_size(self): ] X and Y reference sizes. """ - value_pair_message = self.__stub.GetReferenceSize(messages.edb_obj_message(self)) + value_pair_message = self.__stub.GetReferenceSize(edb_obj_message(self)) return Value(value_pair_message.val1), Value(value_pair_message.val2) def set_reference_size(self, ref_x, ref_y): @@ -83,4 +88,4 @@ def set_reference_size(self, ref_x, ref_y): ref_y : :term:`ValueLike` Y reference size. """ - self.__stub.SetReferenceSize(messages.value_pair_property_message(self, ref_x, ref_y)) + self.__stub.SetReferenceSize(value_pair_property_message(self, ref_x, ref_y)) diff --git a/src/ansys/edb/core/definition/rlc_component_property.py b/src/ansys/edb/core/definition/rlc_component_property.py index b315ee0e73..3482db77c4 100644 --- a/src/ansys/edb/core/definition/rlc_component_property.py +++ b/src/ansys/edb/core/definition/rlc_component_property.py @@ -4,7 +4,7 @@ import google.protobuf.empty_pb2 as empty_pb2 from ansys.edb.core.definition.component_property import ComponentProperty -from ansys.edb.core.inner import messages +from ansys.edb.core.inner.messages import bool_property_message, edb_obj_message from ansys.edb.core.session import StubAccessor, StubType @@ -28,8 +28,8 @@ def create(cls): @property def enabled(self): """:obj:`bool`: True if enabled, false otherwise.""" - return self.__stub.GetEnabled(messages.edb_obj_message(self)).value + return self.__stub.GetEnabled(edb_obj_message(self)).value @enabled.setter def enabled(self, value): - self.__stub.SetEnabled(messages.bool_property_message(self, value)) + self.__stub.SetEnabled(bool_property_message(self, value)) diff --git a/src/ansys/edb/core/definition/solder_ball_property.py b/src/ansys/edb/core/definition/solder_ball_property.py index d3ecefb7e0..760eb09f22 100644 --- a/src/ansys/edb/core/definition/solder_ball_property.py +++ b/src/ansys/edb/core/definition/solder_ball_property.py @@ -10,7 +10,7 @@ SolderballShape, _PadstackDefDataQueryBuilder, ) -from ansys.edb.core.inner import ObjBase +from ansys.edb.core.inner.base import ObjBase from ansys.edb.core.inner.messages import ( edb_obj_message, string_property_message, diff --git a/src/ansys/edb/core/geometry/arc_data.py b/src/ansys/edb/core/geometry/arc_data.py index 61a5be5ef8..b0f956374f 100644 --- a/src/ansys/edb/core/geometry/arc_data.py +++ b/src/ansys/edb/core/geometry/arc_data.py @@ -5,7 +5,8 @@ from ansys.api.edb.v1 import arc_data_pb2_grpc from ansys.edb.core import geometry, session -from ansys.edb.core.inner import messages, parser +from ansys.edb.core.inner.messages import arc_data_two_points, arc_message +from ansys.edb.core.inner.parser import to_box, to_point_data, to_polygon_data from ansys.edb.core.utility import conversions @@ -88,7 +89,7 @@ def height(self): float """ if self._height is None: - self._height = self.__stub.GetHeight(messages.arc_message(self)).value + self._height = self.__stub.GetHeight(arc_message(self)).value return self._height @@ -119,7 +120,7 @@ def is_segment(self, tolerance=0.0): return math.fabs(self.height) <= tolerance @property - @parser.to_point_data + @to_point_data def center(self): """Get the center point of arc. @@ -127,10 +128,10 @@ def center(self): ------- geometry.PointData """ - return self.__stub.GetCenter(messages.arc_message(self)) + return self.__stub.GetCenter(arc_message(self)) @property - @parser.to_point_data + @to_point_data def midpoint(self): """Get the midpoint of arc. @@ -138,7 +139,7 @@ def midpoint(self): ------- geometry.PointData """ - return self.__stub.GetMidpoint(messages.arc_message(self)) + return self.__stub.GetMidpoint(arc_message(self)) @property def radius(self): @@ -148,10 +149,10 @@ def radius(self): ------- float """ - return self.__stub.GetRadius(messages.arc_message(self)).value + return self.__stub.GetRadius(arc_message(self)).value @property - @parser.to_polygon_data + @to_polygon_data def bbox(self): """Get the rectangular bounding box of arc. @@ -159,7 +160,7 @@ def bbox(self): ------- geometry.PolygonData """ - return self.__stub.GetBoundingBox(messages.arc_message(self)) + return self.__stub.GetBoundingBox(arc_message(self)) def is_big(self): """Get if the arc is big. @@ -226,7 +227,7 @@ def angle(self, arc=None): angle in radian """ if arc is None: - return self.__stub.GetAngle(messages.arc_message(self)).value + return self.__stub.GetAngle(arc_message(self)).value if self.is_segment() and arc.is_segment(): vec1 = self.end - self.start @@ -282,7 +283,7 @@ def tangent_at(self, point): else: return geometry.PointData(vec.y, -vec.x) - @parser.to_box + @to_box def closest_points(self, other): """Get the closest point from one arc to another, and vice versa. @@ -294,4 +295,4 @@ def closest_points(self, other): ------- tuple[geometry.PointData, geometry.PointData] """ - return self.__stub.ClosestPoints(messages.arc_data_two_points(self, other)) + return self.__stub.ClosestPoints(arc_data_two_points(self, other)) diff --git a/src/ansys/edb/core/geometry/point_data.py b/src/ansys/edb/core/geometry/point_data.py index da24b27922..3ea2558cc9 100644 --- a/src/ansys/edb/core/geometry/point_data.py +++ b/src/ansys/edb/core/geometry/point_data.py @@ -7,7 +7,8 @@ from ansys.api.edb.v1 import point_data_pb2_grpc from ansys.edb.core import session, utility -from ansys.edb.core.inner import messages, parser +from ansys.edb.core.inner.messages import point_data_rotate_message, point_data_with_line_message +from ansys.edb.core.inner.parser import to_point_data from ansys.edb.core.utility import conversions @@ -214,7 +215,7 @@ def normalized(self): n = [0] * len(self) if mag == 0 else [v / mag for v in self._matrix_values] return self.__class__(n) - @parser.to_point_data + @to_point_data def closest(self, start, end): """Return the closest point on the line segment [start, end] from the point. @@ -230,7 +231,7 @@ def closest(self, start, end): typing.Optional[PointData] """ if not self.is_arc: - return self.__stub.ClosestPoint(messages.point_data_with_line_message(self, start, end)) + return self.__stub.ClosestPoint(point_data_with_line_message(self, start, end)) def distance(self, start, end=None): """Compute the shortest distance from the point to the line segment [start, end] when end point is given, \ @@ -248,9 +249,7 @@ def distance(self, start, end=None): if end is None: return (self - start).magnitude() else: - return self.__stub.Distance( - messages.point_data_with_line_message(self, start, end) - ).value + return self.__stub.Distance(point_data_with_line_message(self, start, end)).value def cross(self, other): """Compute the cross product of the point vector with another. @@ -286,7 +285,7 @@ def move(self, vector): if not self.is_arc and not vector.is_arc: return self + vector - @parser.to_point_data + @to_point_data def rotate(self, angle, center): """Rotate a point at the specified center by the specified angle. @@ -303,7 +302,7 @@ def rotate(self, angle, center): typing.Optional[PointData] """ if not self.is_arc: - return self.__stub.Rotate(messages.point_data_rotate_message(self, center, angle)) + return self.__stub.Rotate(point_data_rotate_message(self, center, angle)) def dot(self, other): """Perform per-component multiplication (dot product) of two points. diff --git a/src/ansys/edb/core/geometry/polygon_data.py b/src/ansys/edb/core/geometry/polygon_data.py index 420826c113..896176b02b 100644 --- a/src/ansys/edb/core/geometry/polygon_data.py +++ b/src/ansys/edb/core/geometry/polygon_data.py @@ -8,7 +8,28 @@ from ansys.edb.core import session from ansys.edb.core.geometry.arc_data import ArcData -from ansys.edb.core.inner import messages, parser +from ansys.edb.core.inner.messages import ( + polygon_data_expand_message, + polygon_data_get_alpha_shape_message, + polygon_data_list_message, + polygon_data_message, + polygon_data_pair_message, + polygon_data_pair_with_tolerance_message, + polygon_data_remove_arc_message, + polygon_data_transform_message, + polygon_data_with_circle_message, + polygon_data_with_point_message, + polygon_data_with_points_message, + polygon_data_with_tol_message, +) +from ansys.edb.core.inner.parser import ( + to_box, + to_circle, + to_point_data, + to_point_data_list, + to_polygon_data, + to_polygon_data_list, +) from ansys.edb.core.utility import conversions @@ -205,7 +226,7 @@ def is_circle(self): ------- bool """ - return self.__stub.IsCircle(messages.polygon_data_message(self)).value + return self.__stub.IsCircle(polygon_data_message(self)).value def is_box(self): """Return whether the outer contour of a polygon is a box. @@ -214,7 +235,7 @@ def is_box(self): ------- bool """ - return self.__stub.IsBox(messages.polygon_data_message(self)).value + return self.__stub.IsBox(polygon_data_message(self)).value def is_convex(self): """Return whether a polygon is a convex hull. @@ -223,7 +244,7 @@ def is_convex(self): ------- bool """ - return self.__stub.IsConvex(messages.polygon_data_message(self)).value + return self.__stub.IsConvex(polygon_data_message(self)).value def area(self): """Compute the area of polygon. @@ -232,7 +253,7 @@ def area(self): ------- float """ - return self.__stub.GetArea(messages.polygon_data_message(self)).value + return self.__stub.GetArea(polygon_data_message(self)).value def has_self_intersections(self, tol=1e-9): """Return whether this polygon contains self-intersections. @@ -245,11 +266,9 @@ def has_self_intersections(self, tol=1e-9): ------- bool """ - return self.__stub.HasSelfIntersections( - messages.polygon_data_with_tol_message(self, tol) - ).value + return self.__stub.HasSelfIntersections(polygon_data_with_tol_message(self, tol)).value - @parser.to_polygon_data + @to_polygon_data def remove_self_intersections(self, tol=1e-9): """Create new polygon with all self-intersections removed. @@ -261,11 +280,9 @@ def remove_self_intersections(self, tol=1e-9): ------- PolygonData """ - return self.__stub.RemoveSelfIntersections( - messages.polygon_data_with_tol_message(self, tol) - ) + return self.__stub.RemoveSelfIntersections(polygon_data_with_tol_message(self, tol)) - @parser.to_point_data_list + @to_point_data_list def normalized(self): """Return normalized points of a polygon. @@ -273,9 +290,9 @@ def normalized(self): ------- list[ansys.edb.core.geometry.PointData] """ - return self.__stub.GetNormalizedPoints(messages.polygon_data_message(self)) + return self.__stub.GetNormalizedPoints(polygon_data_message(self)) - @parser.to_polygon_data + @to_polygon_data def move(self, vector): """Move a polygon by a (x, y) vector. @@ -287,9 +304,9 @@ def move(self, vector): ------- PolygonData """ - return self.__stub.Transform(messages.polygon_data_transform_message("move", self, vector)) + return self.__stub.Transform(polygon_data_transform_message("move", self, vector)) - @parser.to_polygon_data + @to_polygon_data def rotate(self, angle, center): """Rotate a polygon at a center by an angle. @@ -303,11 +320,9 @@ def rotate(self, angle, center): ------- PolygonData """ - return self.__stub.Transform( - messages.polygon_data_transform_message("rotate", self, angle, center) - ) + return self.__stub.Transform(polygon_data_transform_message("rotate", self, angle, center)) - @parser.to_polygon_data + @to_polygon_data def scale(self, factor, center): """Scale a polygon by a linear factor from a center. @@ -320,11 +335,9 @@ def scale(self, factor, center): ------- PolygonData """ - return self.__stub.Transform( - messages.polygon_data_transform_message("scale", factor, center) - ) + return self.__stub.Transform(polygon_data_transform_message("scale", factor, center)) - @parser.to_polygon_data + @to_polygon_data def mirror_x(self, x): """Mirror a polygon by x line. @@ -336,9 +349,9 @@ def mirror_x(self, x): ------- PolygonData """ - return self.__stub.Transform(messages.polygon_data_transform_message("mirror_x", x)) + return self.__stub.Transform(polygon_data_transform_message("mirror_x", x)) - @parser.to_box + @to_box def bbox(self): """Compute the bounding box. @@ -346,10 +359,10 @@ def bbox(self): ------- tuple[ansys.edb.core.geometry.PointData, ansys.edb.core.geometry.PointData] """ - return self.__stub.GetBBox(messages.polygon_data_list_message([self])) + return self.__stub.GetBBox(polygon_data_list_message([self])) @classmethod - @parser.to_box + @to_box def bbox_of_polygons(cls, polygons): """Compute the bounding box of polygons. @@ -361,9 +374,9 @@ def bbox_of_polygons(cls, polygons): ------- tuple[ansys.edb.core.geometry.PointData, ansys.edb.core.geometry.PointData] """ - return cls.__stub.GetBBox(messages.polygon_data_list_message(polygons)) + return cls.__stub.GetBBox(polygon_data_list_message(polygons)) - @parser.to_circle + @to_circle def bounding_circle(self): """Compute the bounding circle of a polygon. @@ -371,10 +384,10 @@ def bounding_circle(self): ------- tuple[ansys.edb.core.geometry.PointData, ansys.edb.core.utility.Value] """ - return self.__stub.GetBoundingCircle(messages.polygon_data_message(self)) + return self.__stub.GetBoundingCircle(polygon_data_message(self)) @classmethod - @parser.to_polygon_data + @to_polygon_data def convex_hull(cls, polygons): """Compute the convex hull of the union of polygons. @@ -386,9 +399,9 @@ def convex_hull(cls, polygons): ------- PolygonData """ - return cls.__stub.GetConvexHull(messages.polygon_data_list_message(polygons)) + return cls.__stub.GetConvexHull(polygon_data_list_message(polygons)) - @parser.to_polygon_data + @to_polygon_data def without_arcs(self, max_chord_error=0, max_arc_angle=math.pi / 6, max_points=8): """Return a polygon data with all arcs removed. @@ -403,12 +416,10 @@ def without_arcs(self, max_chord_error=0, max_arc_angle=math.pi / 6, max_points= PolygonData """ return self.__stub.RemoveArcs( - messages.polygon_data_remove_arc_message( - self, max_chord_error, max_arc_angle, max_points - ) + polygon_data_remove_arc_message(self, max_chord_error, max_arc_angle, max_points) ) - @parser.to_polygon_data + @to_polygon_data def defeature(self, tol=1e-9): """Defeature a polygon. @@ -420,7 +431,7 @@ def defeature(self, tol=1e-9): ------- PolygonData """ - return self.__stub.Defeature(messages.polygon_data_with_tol_message(self, tol)) + return self.__stub.Defeature(polygon_data_with_tol_message(self, tol)) def is_inside(self, point): """Return whether the point is inside a polygon. @@ -433,7 +444,7 @@ def is_inside(self, point): ------- bool """ - return self.__stub.IsInside(messages.polygon_data_with_point_message(self, point)).value + return self.__stub.IsInside(polygon_data_with_point_message(self, point)).value def intersection_type(self, other, tol=1e-9): """Return the intersection type with another polygon. @@ -448,7 +459,7 @@ def intersection_type(self, other, tol=1e-9): bool """ return self.__stub.GetIntersectionType( - messages.polygon_data_pair_with_tolerance_message(self, other, tol) + polygon_data_pair_with_tolerance_message(self, other, tol) ) def circle_intersect(self, center, radius): @@ -464,10 +475,10 @@ def circle_intersect(self, center, radius): bool """ return self.__stub.CircleIntersectsPolygon( - messages.polygon_data_with_circle_message(self, center, radius) + polygon_data_with_circle_message(self, center, radius) ).value - @parser.to_point_data + @to_point_data def closest_point(self, point): """Compute a point on a polygon that is closest to another point. @@ -480,10 +491,10 @@ def closest_point(self, point): ansys.edb.core.geometry.PointData """ return self.__stub.GetClosestPoints( - messages.polygon_data_with_points_message(self, point=point) + polygon_data_with_points_message(self, point=point) ).points[0] - @parser.to_point_data_list + @to_point_data_list def closest_points(self, polygon): """Compute points on this and another polygon that are closest to the other polygon. @@ -496,11 +507,11 @@ def closest_points(self, polygon): tuple[ansys.edb.core.geometry.PointData, ansys.edb.core.geometry.PointData] """ return self.__stub.GetClosestPoints( - messages.polygon_data_with_points_message(self, polygon=polygon) + polygon_data_with_points_message(self, polygon=polygon) ).points @classmethod - @parser.to_polygon_data_list + @to_polygon_data_list def unite(cls, polygons): """Compute union of polygons. @@ -512,10 +523,10 @@ def unite(cls, polygons): ------- list[PolygonData] """ - return cls.__stub.GetUnion(messages.polygon_data_list_message(polygons)) + return cls.__stub.GetUnion(polygon_data_list_message(polygons)) @classmethod - @parser.to_polygon_data_list + @to_polygon_data_list def intersect(cls, polygons1, polygons2): """Compute intersection of polygons. @@ -528,10 +539,10 @@ def intersect(cls, polygons1, polygons2): ------- list[PolygonData] """ - return cls.__stub.GetIntersection(messages.polygon_data_pair_message(polygons1, polygons2)) + return cls.__stub.GetIntersection(polygon_data_pair_message(polygons1, polygons2)) @classmethod - @parser.to_polygon_data_list + @to_polygon_data_list def subtract(cls, polygons1, polygons2): """Compute geometric subtraction of polygons. @@ -548,10 +559,10 @@ def subtract(cls, polygons1, polygons2): ------- list[PolygonData] """ - return cls.__stub.Subtract(messages.polygon_data_pair_message(polygons1, polygons2)) + return cls.__stub.Subtract(polygon_data_pair_message(polygons1, polygons2)) @classmethod - @parser.to_polygon_data_list + @to_polygon_data_list def xor(cls, polygons1, polygons2): """Compute an exclusive OR of polygons. @@ -566,9 +577,9 @@ def xor(cls, polygons1, polygons2): ------- list[PolygonData] """ - return cls.__stub.Xor(messages.polygon_data_pair_message(polygons1, polygons2)) + return cls.__stub.Xor(polygon_data_pair_message(polygons1, polygons2)) - @parser.to_polygon_data_list + @to_polygon_data_list def expand(self, offset, round_corner, max_corner_ext, tol=1e-9): """Expand a polygon by an offset. @@ -587,11 +598,11 @@ def expand(self, offset, round_corner, max_corner_ext, tol=1e-9): list[PolygonData] """ return self.__stub.Expand( - messages.polygon_data_expand_message(self, offset, tol, round_corner, max_corner_ext) + polygon_data_expand_message(self, offset, tol, round_corner, max_corner_ext) ) @classmethod - @parser.to_polygon_data_list + @to_polygon_data_list def alpha_shape(cls, points, alpha): """Compute the outline of a 2D point cloud using alpha shapes. @@ -604,6 +615,4 @@ def alpha_shape(cls, points, alpha): ------- list[PolygonData] """ - return cls.__stub.Get2DAlphaShape( - messages.polygon_data_get_alpha_shape_message(points, alpha) - ) + return cls.__stub.Get2DAlphaShape(polygon_data_get_alpha_shape_message(points, alpha)) diff --git a/src/ansys/edb/core/geometry/r_tree.py b/src/ansys/edb/core/geometry/r_tree.py index f638184bb4..af097bacd2 100644 --- a/src/ansys/edb/core/geometry/r_tree.py +++ b/src/ansys/edb/core/geometry/r_tree.py @@ -3,7 +3,14 @@ from ansys.api.edb.v1 import r_tree_pb2_grpc import ansys.api.edb.v1.r_tree_pb2 as pb -from ansys.edb.core.inner import ObjBase, messages, parser +from ansys.edb.core.inner.base import ObjBase +from ansys.edb.core.inner.messages import ( + box_message, + double_message, + edb_obj_message, + polygon_data_message, +) +from ansys.edb.core.inner.parser import to_box from ansys.edb.core.session import StubAccessor, StubType @@ -12,8 +19,8 @@ class _QueryBuilder: def r_tree_obj_message(rtree, polygon, prop_id): """Create an RTreeObjMessage.""" return pb.RTreeObjMessage( - target=messages.edb_obj_message(rtree), - polygon=messages.polygon_data_message(polygon), + target=edb_obj_message(rtree), + polygon=polygon_data_message(polygon), prop=prop_id, ) @@ -21,8 +28,8 @@ def r_tree_obj_message(rtree, polygon, prop_id): def r_tree_search_message(rtree, box, bb_search): """Create a RTreeSearchMessage.""" return pb.RTreeSearchMessage( - target=messages.edb_obj_message(rtree), - box=messages.box_message(box[0], box[1]), + target=edb_obj_message(rtree), + box=box_message(box[0], box[1]), bb_search=bb_search, ) @@ -30,8 +37,8 @@ def r_tree_search_message(rtree, box, bb_search): def r_tree_geometry_request_message(rtree, polygon, prop_id, increment_visit): """Create an RTreeGeometryRequestMessage.""" return pb.RTreeGeometryRequestMessage( - target=messages.edb_obj_message(rtree), - polygon=messages.polygon_data_message(polygon), + target=edb_obj_message(rtree), + polygon=polygon_data_message(polygon), prop=prop_id, increment_visit=increment_visit, ) @@ -84,7 +91,7 @@ def create(cls, tolerance=1e-9): RTree The new RTree created. """ - rtree_created = RTree(cls.__stub.Create(messages.double_message(tolerance))) + rtree_created = RTree(cls.__stub.Create(double_message(tolerance))) return rtree_created def _handle_rtree_obj(self, rtree_obj): @@ -98,7 +105,7 @@ def _handle_rtree_obj(self, rtree_obj): return True @property - @parser.to_box + @to_box def extent(self): """Tuple[geometry.PointData, geometry.PointData]: Get the bounding-box for the contents of the RTree.""" return self.__stub.GetExtent(self.msg) @@ -184,7 +191,7 @@ def nearest_neighbor(self, rtree_obj): msg = self.__stub.NearestNeighbor( _QueryBuilder.r_tree_obj_message(self, rtree_obj.polygon, rtree_obj._unique_id) ) - return self._id_to_obj[int(msg.id)], parser.to_box(msg.coordinates) + return self._id_to_obj[int(msg.id)], to_box(msg.coordinates) def touching_geometry(self, rtree_obj, increment_visit): """Find all geometry touching the provided RTree object (polygon, id pair). Note that the provided RTree \ @@ -237,7 +244,7 @@ def connected_geometry(self, rtree_obj, increment_visit): def connected_geometry_sets(self): """:obj:`list` of :obj:`list` of RTreeObj: Connected geometry sets of an RTree \ (ids, sizes).""" - msg = self.__stub.GetConnectedGeometrySets(messages.edb_obj_message(self)) + msg = self.__stub.GetConnectedGeometrySets(edb_obj_message(self)) set_start = 0 rtree_obj_sets = [] for set_size in range(0, len(msg.sizes) - 1): @@ -250,7 +257,7 @@ def connected_geometry_sets(self): def increment_visit(self): """Increment the visit count, effectively marking all items in the tree unvisited.""" - self.__stub.IncrementVisit(messages.edb_obj_message(self)) + self.__stub.IncrementVisit(edb_obj_message(self)) def is_visited(self, rtree_obj): """Check whether a given object has been visited. @@ -285,4 +292,4 @@ def visit(self, rtree_obj): @property def get_visit(self): """Int: Visit count for the tree.""" - return self.__stub.GetVisit(messages.edb_obj_message(self)).value + return self.__stub.GetVisit(edb_obj_message(self)).value diff --git a/src/ansys/edb/core/hierarchy/cell_instance.py b/src/ansys/edb/core/hierarchy/cell_instance.py index 1ed5147b24..2a532a36b6 100644 --- a/src/ansys/edb/core/hierarchy/cell_instance.py +++ b/src/ansys/edb/core/hierarchy/cell_instance.py @@ -5,7 +5,14 @@ from ansys.edb.core import layout from ansys.edb.core.edb_defs import LayoutObjType from ansys.edb.core.hierarchy import hierarchy_obj -from ansys.edb.core.inner import messages +from ansys.edb.core.inner.messages import ( + bool_property_message, + cell_instance_creation_message, + cell_instance_parameter_override_message, + object_name_in_layout_message, + pointer_property_message, + string_property_message, +) from ansys.edb.core.session import StubAccessor, StubType from ansys.edb.core.utility import Transform3D, Value @@ -34,9 +41,7 @@ def create(cls, layout, name, ref): CellInstance Newly created cell instance. """ - return CellInstance( - cls.__stub.Create(messages.cell_instance_creation_message(layout, name, ref)) - ) + return CellInstance(cls.__stub.Create(cell_instance_creation_message(layout, name, ref))) @classmethod def create_with_component(cls, layout, name, ref): @@ -57,9 +62,7 @@ def create_with_component(cls, layout, name, ref): Newly created cell instance. """ return CellInstance( - cls.__stub.CreateWithComponent( - messages.cell_instance_creation_message(layout, name, ref) - ) + cls.__stub.CreateWithComponent(cell_instance_creation_message(layout, name, ref)) ) @classmethod @@ -78,9 +81,7 @@ def find(cls, layout, name): CellInstance Cell instance that is found, None otherwise. """ - return CellInstance( - cls.__stub.FindByName(messages.object_name_in_layout_message(layout, name)) - ) + return CellInstance(cls.__stub.FindByName(object_name_in_layout_message(layout, name))) @property def reference_layout(self): @@ -113,7 +114,7 @@ def placement_3d(self): @placement_3d.setter def placement_3d(self, value): """Set the cell instance as 3D placed in the owning layout.""" - self.__stub.Set3DPlacement(messages.bool_property_message(self, value)) + self.__stub.Set3DPlacement(bool_property_message(self, value)) @property def transform3d(self): @@ -127,7 +128,7 @@ def transform3d(self): @transform3d.setter def transform3d(self, value): """Set the 3D transformation for this cell instance. The cell instance must be 3D placed.""" - self.__stub.Set3DTransform(messages.pointer_property_message(self, value)) + self.__stub.Set3DTransform(pointer_property_message(self, value)) def get_parameter_override(self, param_name): """Get the override of the cell instance parameter by name. @@ -142,9 +143,7 @@ def get_parameter_override(self, param_name): :class:`Value ` Override value for the parameter. """ - return Value( - self.__stub.GetParameterOverride(messages.string_property_message(self, param_name)) - ) + return Value(self.__stub.GetParameterOverride(string_property_message(self, param_name))) def set_parameter_override(self, param_name, param_value): """Set override value for the given cell instance parameter. @@ -157,5 +156,5 @@ def set_parameter_override(self, param_name, param_value): Value to override with. """ self.__stub.SetParameterOverride( - messages.cell_instance_parameter_override_message(self, param_name, param_value) + cell_instance_parameter_override_message(self, param_name, param_value) ) diff --git a/src/ansys/edb/core/hierarchy/component_group.py b/src/ansys/edb/core/hierarchy/component_group.py index 3674f58c8d..da0be9f5df 100644 --- a/src/ansys/edb/core/hierarchy/component_group.py +++ b/src/ansys/edb/core/hierarchy/component_group.py @@ -7,7 +7,12 @@ from ansys.edb.core.definition import component_property from ansys.edb.core.hierarchy.group import Group -from ansys.edb.core.inner import messages +from ansys.edb.core.inner.messages import ( + component_group_create_message, + object_name_in_layout_message, + pointer_property_message, + set_component_group_type_message, +) from ansys.edb.core.session import StubAccessor, StubType @@ -57,7 +62,7 @@ def create_with_component(cls, layout, name, comp_name): Newly created component group. """ return ComponentGroup( - cls.__stub.Create(messages.component_group_create_message(layout, name, comp_name)) + cls.__stub.Create(component_group_create_message(layout, name, comp_name)) ) @property @@ -98,7 +103,7 @@ def component_property(self): @component_property.setter def component_property(self, value): """Set the component property on the component group.""" - self.__stub.SetComponentProperty(messages.pointer_property_message(self, value)) + self.__stub.SetComponentProperty(pointer_property_message(self, value)) @property def component_type(self): @@ -108,7 +113,7 @@ def component_type(self): @component_type.setter def component_type(self, value): """Set the component type on the component group.""" - self.__stub.SetComponentType(messages.set_component_group_type_message(self, value)) + self.__stub.SetComponentType(set_component_group_type_message(self, value)) @classmethod def find_by_def(cls, layout, comp_def_name): @@ -126,7 +131,5 @@ def find_by_def(cls, layout, comp_def_name): list[ComponentGroup] List of component group(s) that are found. """ - objs = cls.__stub.FindByDef( - messages.object_name_in_layout_message(layout, comp_def_name) - ).items + objs = cls.__stub.FindByDef(object_name_in_layout_message(layout, comp_def_name)).items return [ComponentGroup(cg) for cg in objs] diff --git a/src/ansys/edb/core/hierarchy/group.py b/src/ansys/edb/core/hierarchy/group.py index e842375a4f..1973b3c57d 100644 --- a/src/ansys/edb/core/hierarchy/group.py +++ b/src/ansys/edb/core/hierarchy/group.py @@ -5,7 +5,11 @@ from ansys.edb.core.edb_defs import LayoutObjType from ansys.edb.core.hierarchy.hierarchy_obj import HierarchyObj -from ansys.edb.core.inner import messages +from ansys.edb.core.inner.messages import ( + bool_property_message, + group_modify_member_message, + object_name_in_layout_message, +) from ansys.edb.core.session import StubAccessor, StubType @@ -53,7 +57,7 @@ def create(cls, layout, name): Group Newly created group. """ - return Group(cls.__stub.Create(messages.object_name_in_layout_message(layout, name))) + return Group(cls.__stub.Create(object_name_in_layout_message(layout, name))) @classmethod def find(cls, layout, name): @@ -71,9 +75,7 @@ def find(cls, layout, name): Group Group that is found, None otherwise. """ - return Group( - cls.__stub.FindByName(messages.object_name_in_layout_message(layout, name)) - ).cast() + return Group(cls.__stub.FindByName(object_name_in_layout_message(layout, name))).cast() def add_member(self, member): """Add an object to the group. @@ -83,7 +85,7 @@ def add_member(self, member): member : :term:`Connectable` Object to be added to the group. """ - self.__stub.AddMember(messages.group_modify_member_message(self, member)) + self.__stub.AddMember(group_modify_member_message(self, member)) def remove_member(self, member): """Remove an object from the group. @@ -93,7 +95,7 @@ def remove_member(self, member): member : :term:`Connectable` Object to be removed from the group. """ - self.__stub.RemoveMember(messages.group_modify_member_message(self, member)) + self.__stub.RemoveMember(group_modify_member_message(self, member)) def ungroup(self, recursive): """Dissolves the group. @@ -103,7 +105,7 @@ def ungroup(self, recursive): recursive : bool True if all containing groups should also be dissolved, False otherwise. """ - self.__stub.Ungroup(messages.bool_property_message(self, recursive)) + self.__stub.Ungroup(bool_property_message(self, recursive)) @property def members(self): @@ -111,7 +113,7 @@ def members(self): Read-Only. """ - from ansys.edb.core.inner import factory + from ansys.edb.core.inner.factory import create_conn_obj objs = self.__stub.GetMembers(self.msg).items - return [factory.create_conn_obj(co) for co in objs] + return [create_conn_obj(co) for co in objs] diff --git a/src/ansys/edb/core/hierarchy/hierarchy_obj.py b/src/ansys/edb/core/hierarchy/hierarchy_obj.py index 6555543f3a..9e3162993a 100644 --- a/src/ansys/edb/core/hierarchy/hierarchy_obj.py +++ b/src/ansys/edb/core/hierarchy/hierarchy_obj.py @@ -1,13 +1,20 @@ """Hierarchy Obj.""" from ansys.edb.core.definition import component_def -from ansys.edb.core.inner import conn_obj, messages +from ansys.edb.core.inner.conn_obj import ConnObj +from ansys.edb.core.inner.messages import ( + bool_property_message, + edb_obj_name_message, + point_property_message, + pointer_property_message, + transform_property_message, +) from ansys.edb.core.layer import Layer from ansys.edb.core.session import StubAccessor, StubType from ansys.edb.core.utility import Transform, Value -class HierarchyObj(conn_obj.ConnObj): +class HierarchyObj(ConnObj): """Base class representing hierarchy object.""" __stub = StubAccessor(StubType.hierarchy_obj) @@ -27,7 +34,7 @@ def transform(self): @transform.setter def transform(self, value): """Set transform.""" - self.__stub.SetTransform(messages.transform_property_message(self, value)) + self.__stub.SetTransform(transform_property_message(self, value)) @property def name(self): @@ -37,7 +44,7 @@ def name(self): @name.setter def name(self, value): """Set name of the object.""" - self.__stub.SetName(messages.edb_obj_name_message(self, value)) + self.__stub.SetName(edb_obj_name_message(self, value)) @property def component_def(self): @@ -56,7 +63,7 @@ def placement_layer(self): @placement_layer.setter def placement_layer(self, value): """Set placement layer.""" - self.__stub.SetPlacementLayer(messages.pointer_property_message(self, value)) + self.__stub.SetPlacementLayer(pointer_property_message(self, value)) @property def location(self): @@ -69,7 +76,7 @@ def location(self): @location.setter def location(self, value): """Set the location on placement layer.""" - self.__stub.SetLocation(messages.point_property_message(self, value)) + self.__stub.SetLocation(point_property_message(self, value)) @property def solve_independent_preference(self): @@ -89,4 +96,4 @@ def solve_independent_preference(self): @solve_independent_preference.setter def solve_independent_preference(self, value): """Set solve independent preference.""" - self.__stub.SetSolveIndependentPreference(messages.bool_property_message(self, value)) + self.__stub.SetSolveIndependentPreference(bool_property_message(self, value)) diff --git a/src/ansys/edb/core/hierarchy/inst_array.py b/src/ansys/edb/core/hierarchy/inst_array.py index e19872c8de..a772cc27df 100644 --- a/src/ansys/edb/core/hierarchy/inst_array.py +++ b/src/ansys/edb/core/hierarchy/inst_array.py @@ -4,7 +4,13 @@ from ansys.edb.core.edb_defs import LayoutObjType from ansys.edb.core.hierarchy import cell_instance -from ansys.edb.core.inner import messages, parser +from ansys.edb.core.inner.messages import ( + inst_array_creation_message, + point_property_message, + string_property_message, + value_property_message, +) +from ansys.edb.core.inner.parser import to_point_data from ansys.edb.core.session import StubAccessor, StubType from ansys.edb.core.utility import Value @@ -45,9 +51,7 @@ def create(cls, layout, name, ref, orig, xaxis, yaxis, xcount, ycount): """ return InstArray( cls.__stub.Create( - messages.inst_array_creation_message( - layout, name, ref, orig, xaxis, yaxis, xcount, ycount - ) + inst_array_creation_message(layout, name, ref, orig, xaxis, yaxis, xcount, ycount) ) ) @@ -67,33 +71,33 @@ def find(cls, layout, name): InstArray instance array that is found, None otherwise. """ - return InstArray(cls.__stub.FindByName(messages.string_property_message(layout, name))) + return InstArray(cls.__stub.FindByName(string_property_message(layout, name))) @property - @parser.to_point_data + @to_point_data def orig(self): """:class:`PointData `: origin of the instance array.""" return self.__stub.GetOrig(self.msg) @property - @parser.to_point_data + @to_point_data def x_axis(self): """:class:`PointData `: x axis of the instance array.""" return self.__stub.GetXAxis(self.msg) @x_axis.setter def x_axis(self, value): - self.__stub.SetXAxis(messages.point_property_message(self, value)) + self.__stub.SetXAxis(point_property_message(self, value)) @property - @parser.to_point_data + @to_point_data def y_axis(self): """:class:`PointData `: y axis of the instance array.""" return self.__stub.GetYAxis(self.msg) @y_axis.setter def y_axis(self, value): - self.__stub.SetYAxis(messages.point_property_message(self, value)) + self.__stub.SetYAxis(point_property_message(self, value)) @property def x_count(self): @@ -102,7 +106,7 @@ def x_count(self): @x_count.setter def x_count(self, value): - self.__stub.SetXCount(messages.value_property_message(self, value)) + self.__stub.SetXCount(value_property_message(self, value)) @property def y_count(self): @@ -111,7 +115,7 @@ def y_count(self): @y_count.setter def y_count(self, value): - self.__stub.SetYCount(messages.value_property_message(self, value)) + self.__stub.SetYCount(value_property_message(self, value)) def decompose(self): """Decompose the instance array.""" diff --git a/src/ansys/edb/core/hierarchy/model.py b/src/ansys/edb/core/hierarchy/model.py index 2f4c7b1d1f..e6c0f1a754 100644 --- a/src/ansys/edb/core/hierarchy/model.py +++ b/src/ansys/edb/core/hierarchy/model.py @@ -1,5 +1,6 @@ """Base Hierarchy Model.""" -from ansys.edb.core.inner import ObjBase, messages +from ansys.edb.core.inner.base import ObjBase +from ansys.edb.core.inner.messages import edb_obj_message from ansys.edb.core.session import ModelServiceStub, StubAccessor, StubType @@ -15,4 +16,4 @@ def clone(self): ------- Model """ - return self.__class__(self.__stub.Clone(messages.edb_obj_message(self))) + return self.__class__(self.__stub.Clone(edb_obj_message(self))) diff --git a/src/ansys/edb/core/hierarchy/netlist_model.py b/src/ansys/edb/core/hierarchy/netlist_model.py index aea495c0ff..81315b8075 100644 --- a/src/ansys/edb/core/hierarchy/netlist_model.py +++ b/src/ansys/edb/core/hierarchy/netlist_model.py @@ -1,6 +1,6 @@ """Netlist Model.""" from ansys.edb.core.hierarchy.model import Model -from ansys.edb.core.inner import messages +from ansys.edb.core.inner.messages import edb_obj_message, str_message, string_property_message from ansys.edb.core.session import NetlistModelServiceStub, StubAccessor, StubType @@ -21,13 +21,13 @@ def create(cls, name): ------- NetlistModel """ - return cls(cls.__stub.Create(messages.str_message(name))) + return cls(cls.__stub.Create(str_message(name))) @property def netlist(self): """:obj:`str`: Netlist name.""" - return self.__stub.GetNetlist(messages.edb_obj_message(self)).value + return self.__stub.GetNetlist(edb_obj_message(self)).value @netlist.setter def netlist(self, name): - self.__stub.SetNetlist(messages.string_property_message(self, name)) + self.__stub.SetNetlist(string_property_message(self, name)) diff --git a/src/ansys/edb/core/hierarchy/pin_group.py b/src/ansys/edb/core/hierarchy/pin_group.py index f67501c607..eeb083c0b4 100644 --- a/src/ansys/edb/core/hierarchy/pin_group.py +++ b/src/ansys/edb/core/hierarchy/pin_group.py @@ -1,7 +1,13 @@ """Pin Group.""" from ansys.edb.core.edb_defs import LayoutObjType -from ansys.edb.core.inner import ObjBase, messages +from ansys.edb.core.inner.base import ObjBase +from ansys.edb.core.inner.messages import ( + pin_group_creation_message, + pin_group_get_unique_name_message, + pin_group_lookup_message, + pin_group_pins_modify_message, +) from ansys.edb.core.primitive import PadstackInstance from ansys.edb.core.session import StubAccessor, StubType @@ -30,7 +36,7 @@ def create(cls, layout, name, padstack_instances): Newly created pin group. """ return PinGroup( - cls.__stub.Create(messages.pin_group_creation_message(layout, name, padstack_instances)) + cls.__stub.Create(pin_group_creation_message(layout, name, padstack_instances)) ) @classmethod @@ -49,7 +55,7 @@ def find(cls, layout, name): PinGroup Pin group that is found, None otherwise. """ - return PinGroup(cls.__stub.FindByName(messages.pin_group_lookup_message(layout, name))) + return PinGroup(cls.__stub.FindByName(pin_group_lookup_message(layout, name))) @classmethod def unique_name(cls, layout, prefix): @@ -66,9 +72,7 @@ def unique_name(cls, layout, prefix): ------- str """ - return cls.__stub.GetUniqueName( - messages.pin_group_get_unique_name_message(layout, prefix) - ).value + return cls.__stub.GetUniqueName(pin_group_get_unique_name_message(layout, prefix)).value @property def name(self): @@ -95,7 +99,7 @@ def add_pins(self, pins): ---------- pins : list[:class:`PadstackInstance `] """ - self.__stub.AddPins(messages.pin_group_pins_modify_message(self, pins)) + self.__stub.AddPins(pin_group_pins_modify_message(self, pins)) def remove_pins(self, pins): """Remove the list of padstack instances from the group. @@ -104,4 +108,4 @@ def remove_pins(self, pins): ---------- pins : list[:class:`PadstackInstance `] """ - self.__stub.RemovePins(messages.pin_group_pins_modify_message(self, pins)) + self.__stub.RemovePins(pin_group_pins_modify_message(self, pins)) diff --git a/src/ansys/edb/core/hierarchy/pin_pair_model.py b/src/ansys/edb/core/hierarchy/pin_pair_model.py index 9038ea2b84..f26f39eef5 100644 --- a/src/ansys/edb/core/hierarchy/pin_pair_model.py +++ b/src/ansys/edb/core/hierarchy/pin_pair_model.py @@ -3,7 +3,12 @@ import google.protobuf.empty_pb2 as empty_pb2 from ansys.edb.core.hierarchy.model import Model -from ansys.edb.core.inner import messages, parser +from ansys.edb.core.inner.messages import ( + edb_obj_message, + pin_pair_model_rlc_message, + string_pair_property_message, +) +from ansys.edb.core.inner.parser import to_rlc from ansys.edb.core.session import PinPairModelServiceStub, StubAccessor, StubType @@ -33,9 +38,9 @@ def rlc(self, pin_pair): ------- :class:`Rlc` """ - res = self.__stub.GetRlc(messages.string_pair_property_message(self, pin_pair)) + res = self.__stub.GetRlc(string_pair_property_message(self, pin_pair)) if res.found: - return parser.to_rlc(res.rlc) + return to_rlc(res.rlc) else: return None @@ -47,7 +52,7 @@ def set_rlc(self, pin_pair, rlc): pin_pair : tuple[str, str] rlc : :class:`Rlc` """ - self.__stub.SetRlc(messages.pin_pair_model_rlc_message(self, pin_pair, rlc)) + self.__stub.SetRlc(pin_pair_model_rlc_message(self, pin_pair, rlc)) def delete_rlc(self, pin_pair): """Delete RLC value for a pin pair. @@ -56,7 +61,7 @@ def delete_rlc(self, pin_pair): ---------- pin_pair : tuple[str, str] """ - self.__stub.DeleteRlc(messages.string_pair_property_message(self, pin_pair)) + self.__stub.DeleteRlc(string_pair_property_message(self, pin_pair)) def pin_pairs(self): """Get all pin pairs. @@ -65,5 +70,5 @@ def pin_pairs(self): ------- list[tuple[str, str]] """ - res = self.__stub.GetPinPairs(messages.edb_obj_message(self)) + res = self.__stub.GetPinPairs(edb_obj_message(self)) return [(pair.first, pair.second) for pair in res.pairs] diff --git a/src/ansys/edb/core/hierarchy/sparameter_model.py b/src/ansys/edb/core/hierarchy/sparameter_model.py index 8a9c8d9869..f73233fe2b 100644 --- a/src/ansys/edb/core/hierarchy/sparameter_model.py +++ b/src/ansys/edb/core/hierarchy/sparameter_model.py @@ -1,6 +1,10 @@ """S-Parameter Model.""" from ansys.edb.core.hierarchy.model import Model -from ansys.edb.core.inner import messages +from ansys.edb.core.inner.messages import ( + edb_obj_message, + sparameter_model_message, + string_property_message, +) from ansys.edb.core.session import SParameterModelServiceStub, StubAccessor, StubType @@ -20,11 +24,11 @@ def create(cls, name, ref_net): ref_net : str Name of reference net. """ - return cls(cls.__stub.Create(messages.sparameter_model_message(name, ref_net))) + return cls(cls.__stub.Create(sparameter_model_message(name, ref_net))) @property def _properties(self): - return self.__stub.GetProperties(messages.edb_obj_message(self)) + return self.__stub.GetProperties(edb_obj_message(self)) @property def component_model(self): @@ -33,7 +37,7 @@ def component_model(self): @component_model.setter def component_model(self, name): - self.__stub.SetComponentModelName(messages.string_property_message(self, name)) + self.__stub.SetComponentModelName(string_property_message(self, name)) @property def reference_net(self): @@ -42,4 +46,4 @@ def reference_net(self): @reference_net.setter def reference_net(self, name): - self.__stub.SetReferenceNet(messages.string_property_message(self, name)) + self.__stub.SetReferenceNet(string_property_message(self, name)) diff --git a/src/ansys/edb/core/hierarchy/spice_model.py b/src/ansys/edb/core/hierarchy/spice_model.py index 3822d57aab..9c64764352 100644 --- a/src/ansys/edb/core/hierarchy/spice_model.py +++ b/src/ansys/edb/core/hierarchy/spice_model.py @@ -1,6 +1,11 @@ """SPICE Model.""" from ansys.edb.core.hierarchy.model import Model -from ansys.edb.core.inner import messages +from ansys.edb.core.inner.messages import ( + edb_obj_message, + spice_model_message, + spice_model_net_terminal_pin_message, + string_property_message, +) from ansys.edb.core.session import SpiceModelServiceStub, StubAccessor, StubType @@ -22,11 +27,11 @@ def create(cls, name, path, sub_circuit): sub_circuit : str Sub circuit name of SPICE model. """ - return cls(cls.__stub.Create(messages.spice_model_message(name, path, sub_circuit))) + return cls(cls.__stub.Create(spice_model_message(name, path, sub_circuit))) @property def _properties(self): - return self.__stub.GetProperties(messages.edb_obj_message(self)) + return self.__stub.GetProperties(edb_obj_message(self)) @property def model_name(self): @@ -35,7 +40,7 @@ def model_name(self): @model_name.setter def model_name(self, name): - self.__stub.SetModelName(messages.string_property_message(self, name)) + self.__stub.SetModelName(string_property_message(self, name)) @property def model_path(self): @@ -44,7 +49,7 @@ def model_path(self): @model_path.setter def model_path(self, path): - self.__stub.SetModelPath(messages.string_property_message(self, path)) + self.__stub.SetModelPath(string_property_message(self, path)) @property def sub_circuit(self): @@ -53,7 +58,7 @@ def sub_circuit(self): @sub_circuit.setter def sub_circuit(self, name): - self.__stub.SetSubCkt(messages.string_property_message(self, name)) + self.__stub.SetSubCkt(string_property_message(self, name)) def add_terminal(self, terminal, pin): """Add a terminal with pin number. @@ -65,9 +70,7 @@ def add_terminal(self, terminal, pin): pin : str The pin number. """ - self.__stub.AddTerminalPinPair( - messages.spice_model_net_terminal_pin_message(self, terminal, pin) - ) + self.__stub.AddTerminalPinPair(spice_model_net_terminal_pin_message(self, terminal, pin)) def remove_terminal(self, terminal): """Remove a terminal with pin number. @@ -77,4 +80,4 @@ def remove_terminal(self, terminal): terminal : str The terminal name. """ - self.__stub.RemoveTerminalPinPair(messages.string_property_message(self, terminal)) + self.__stub.RemoveTerminalPinPair(string_property_message(self, terminal)) diff --git a/src/ansys/edb/core/hierarchy/structure3d.py b/src/ansys/edb/core/hierarchy/structure3d.py index 60eb3146b5..d769879e5e 100644 --- a/src/ansys/edb/core/hierarchy/structure3d.py +++ b/src/ansys/edb/core/hierarchy/structure3d.py @@ -6,7 +6,14 @@ from ansys.api.edb.v1.structure3d_pb2_grpc import Structure3DServiceStub from ansys.edb.core.hierarchy.group import Group -from ansys.edb.core.inner import messages +from ansys.edb.core.inner.messages import ( + bool_property_message, + object_name_in_layout_message, + set_closure_message, + string_property_message, + value_message, + value_property_message, +) from ansys.edb.core.session import StubAccessor, StubType from ansys.edb.core.utility import Value @@ -47,7 +54,7 @@ def create(cls, layout, name): Structure3D Newly created structure3d. """ - return Structure3D(cls.__stub.Create(messages.object_name_in_layout_message(layout, name))) + return Structure3D(cls.__stub.Create(object_name_in_layout_message(layout, name))) def get_material(self, evaluate): """Get material for the structure3d. @@ -61,7 +68,7 @@ def get_material(self, evaluate): ------- str """ - return self.__stub.GetMaterial(messages.bool_property_message(self, evaluate)).value + return self.__stub.GetMaterial(bool_property_message(self, evaluate)).value def set_material(self, mat_name): """Set material for the structure3d. @@ -70,7 +77,7 @@ def set_material(self, mat_name): ---------- mat_name : str """ - self.__stub.SetMaterial(messages.string_property_message(self, mat_name)) + self.__stub.SetMaterial(string_property_message(self, mat_name)) @property def thickness(self): @@ -80,9 +87,7 @@ def thickness(self): @thickness.setter def thickness(self, value): """Set thickness for the structure3d.""" - self.__stub.SetThickness( - messages.value_property_message(self, messages.value_message(value)) - ) + self.__stub.SetThickness(value_property_message(self, value_message(value))) @property def mesh_closure(self): @@ -92,4 +97,4 @@ def mesh_closure(self): @mesh_closure.setter def mesh_closure(self, value): """Set mesh closure property for the structure3d.""" - self.__stub.SetMeshClosureProp(messages.set_closure_message(self, value)) + self.__stub.SetMeshClosureProp(set_closure_message(self, value)) diff --git a/src/ansys/edb/core/hierarchy/via_group.py b/src/ansys/edb/core/hierarchy/via_group.py index cc7df6aed2..6779a95226 100644 --- a/src/ansys/edb/core/hierarchy/via_group.py +++ b/src/ansys/edb/core/hierarchy/via_group.py @@ -3,7 +3,12 @@ from ansys.api.edb.v1.via_group_pb2_grpc import ViaGroupServiceStub from ansys.edb.core.hierarchy.group import Group -from ansys.edb.core.inner import messages, parser +from ansys.edb.core.inner.messages import ( + object_name_in_layout_message, + via_group_create_with_outline_message, + via_group_create_with_primitives_message, +) +from ansys.edb.core.inner.parser import to_polygon_data from ansys.edb.core.session import StubAccessor, StubType @@ -31,7 +36,7 @@ def create_with_primitives(cls, layout, primitives, is_persistent): List of newly created via group(s). """ via_groups = cls.__stub.CreateWithPrimitives( - messages.via_group_create_with_primitives_message(layout, primitives, is_persistent) + via_group_create_with_primitives_message(layout, primitives, is_persistent) ).items return [ViaGroup(vg) for vg in via_groups] @@ -59,7 +64,7 @@ def create_with_outline(cls, layout, outline, conductivity_ratio, layer, net=Non """ return ViaGroup( cls.__stub.CreateWithOutline( - messages.via_group_create_with_outline_message( + via_group_create_with_outline_message( layout, outline, conductivity_ratio, layer, net ) ) @@ -81,10 +86,10 @@ def find(cls, layout, name): ViaGroup ViaGroup that is found, None otherwise. """ - return ViaGroup(cls.__stub.FindByName(messages.object_name_in_layout_message(layout, name))) + return ViaGroup(cls.__stub.FindByName(object_name_in_layout_message(layout, name))) @property - @parser.to_polygon_data + @to_polygon_data def outline(self): """:class:`PolygonData `: Via group outline. diff --git a/src/ansys/edb/core/inner/__init__.py b/src/ansys/edb/core/inner/__init__.py index 8d7813dc48..b38c6b4d88 100644 --- a/src/ansys/edb/core/inner/__init__.py +++ b/src/ansys/edb/core/inner/__init__.py @@ -2,7 +2,6 @@ import logging -from ansys.edb.core.inner.base import ObjBase, TypeField from ansys.edb.core.inner.edb_logging import EDBLogger LOGGER = EDBLogger(level=logging.DEBUG, to_file=False, to_stdout=True) diff --git a/src/ansys/edb/core/inner/conn_obj.py b/src/ansys/edb/core/inner/conn_obj.py index 87aafe1930..29300870b1 100644 --- a/src/ansys/edb/core/inner/conn_obj.py +++ b/src/ansys/edb/core/inner/conn_obj.py @@ -2,8 +2,13 @@ from ansys.api.edb.v1 import connectable_pb2 from ansys.edb.core.edb_defs import LayoutObjType -from ansys.edb.core.inner import layout_obj, messages -from ansys.edb.core.layout import mcad_model as mm +from ansys.edb.core.inner.layout_obj import LayoutObj +from ansys.edb.core.inner.messages import ( + edb_internal_id_message, + net_ref_message, + pointer_property_message, +) +from ansys.edb.core.layout.mcad_model import McadModel from ansys.edb.core.session import ConnectableServiceStub, StubAccessor, StubType @@ -11,18 +16,18 @@ class _QueryBuilder: @staticmethod def find_id_layout_obj_message(layout, type, id): return connectable_pb2.FindByIdLayoutObjMessage( - layout=layout.msg, type=type.value, id_msg=messages.edb_internal_id_message(id) + layout=layout.msg, type=type.value, id_msg=edb_internal_id_message(id) ) @staticmethod def set_net_message(target, net): return connectable_pb2.SetNetMessage( target=target.msg, - net=messages.net_ref_message(net), + net=net_ref_message(net), ) -class ConnObj(layout_obj.LayoutObj): +class ConnObj(LayoutObj): """Base class representing ConnObj.""" __stub: ConnectableServiceStub = StubAccessor(StubType.connectable) @@ -115,7 +120,7 @@ def group(self): @group.setter def group(self, group): """Set the group of the connectable object.""" - self.__stub.SetGroup(messages.pointer_property_message(target=self, value=group)) + self.__stub.SetGroup(pointer_property_message(target=self, value=group)) @property def net(self): @@ -139,7 +144,7 @@ def create_stride(self): ------- :class:`McadModel ` """ - return mm.McadModel.create_stride(connectable=self) + return McadModel.create_stride(connectable=self) def create_hfss(self): """Create a HFSS model. @@ -148,7 +153,7 @@ def create_hfss(self): ------- :class:`McadModel ` """ - return mm.McadModel.create_hfss(connectable=self) + return McadModel.create_hfss(connectable=self) def create_3d_comp(self): """Create a 3dComp model. @@ -157,7 +162,7 @@ def create_3d_comp(self): ------- :class:`McadModel ` """ - return mm.McadModel.create_3d_comp(connectable=self) + return McadModel.create_3d_comp(connectable=self) @property def is_mcad(self): @@ -165,7 +170,7 @@ def is_mcad(self): Read-Only. """ - return mm.McadModel.is_mcad(self) + return McadModel.is_mcad(self) @property def is_mcad_stride(self): @@ -173,7 +178,7 @@ def is_mcad_stride(self): Read-Only. """ - return mm.McadModel.is_mcad_stride(self) + return McadModel.is_mcad_stride(self) @property def is_mcad_hfss(self): @@ -181,7 +186,7 @@ def is_mcad_hfss(self): Read-Only. """ - return mm.McadModel.is_mcad_hfss(self) + return McadModel.is_mcad_hfss(self) @property def is_mcad_3d_comp(self): @@ -189,4 +194,4 @@ def is_mcad_3d_comp(self): Read-Only. """ - return mm.McadModel.is_mcad_3d_comp(self) + return McadModel.is_mcad_3d_comp(self) diff --git a/src/ansys/edb/core/inner/factory.py b/src/ansys/edb/core/inner/factory.py index 3fbe560447..d6446ed6f0 100644 --- a/src/ansys/edb/core/inner/factory.py +++ b/src/ansys/edb/core/inner/factory.py @@ -1,11 +1,13 @@ """This module allows for the creating of objects while avoid circular imports.""" from ansys.edb.core.edb_defs import LayoutObjType -from ansys.edb.core.hierarchy import CellInstance, Group, PinGroup -import ansys.edb.core.layout as layout -from ansys.edb.core.primitive import PadstackInstance, Primitive +from ansys.edb.core.hierarchy.cell_instance import CellInstance +from ansys.edb.core.hierarchy.group import Group +from ansys.edb.core.hierarchy.pin_group import PinGroup +from ansys.edb.core.layout.voltage_regulator import VoltageRegulator +from ansys.edb.core.primitive.primitive import PadstackInstance, Primitive from ansys.edb.core.session import StubAccessor, StubType -from ansys.edb.core.terminal import Terminal, TerminalInstance +from ansys.edb.core.terminal.terminals import Terminal, TerminalInstance def create_conn_obj(msg): @@ -35,5 +37,5 @@ def create_conn_obj(msg): elif type == LayoutObjType.PIN_GROUP: return PinGroup(msg) elif type == LayoutObjType.VOLTAGE_REGULATOR: - return layout.VoltageRegulator(msg) + return VoltageRegulator(msg) raise TypeError("Encountered an unknown layout obj type") diff --git a/src/ansys/edb/core/inner/layout_obj.py b/src/ansys/edb/core/inner/layout_obj.py index dfe0fb3968..6f7a9ae9b5 100644 --- a/src/ansys/edb/core/inner/layout_obj.py +++ b/src/ansys/edb/core/inner/layout_obj.py @@ -3,9 +3,12 @@ import ansys.api.edb.v1.layout_obj_pb2 as layout_obj_pb2 from ansys.edb.core.edb_defs import LayoutObjType -from ansys.edb.core.inner import ObjBase -import ansys.edb.core.inner.messages as messages -from ansys.edb.core.layout import layout +from ansys.edb.core.inner.base import ObjBase +from ansys.edb.core.inner.messages import ( + get_product_property_ids_message, + get_product_property_message, + set_product_property_message, +) from ansys.edb.core.session import LayoutObjServiceStub, StubAccessor, StubType @@ -17,21 +20,21 @@ def layout_obj_target_msg(layout_obj, layout_type): @staticmethod def get_product_property_type_msg(obj, prod_id, attr_it, layout_type): return layout_obj_pb2.GetProductPropertyTypeMessage( - target=messages.get_product_property_message(obj, prod_id, attr_it), + target=get_product_property_message(obj, prod_id, attr_it), type=layout_type.value, ) @staticmethod def set_product_property_type_msg(obj, prod_id, att_id, value, layout_type): return layout_obj_pb2.SetProductPropertyTypeMessage( - target=messages.set_product_property_message(obj, prod_id, att_id, value), + target=set_product_property_message(obj, prod_id, att_id, value), type=layout_type.value, ) @staticmethod def get_product_property_ids_type_msg(obj, prod_id, layout_type): return layout_obj_pb2.GetProductPropertyIdsTypeMessage( - target=messages.get_product_property_ids_message(obj, prod_id), + target=get_product_property_ids_message(obj, prod_id), type=layout_type.value, ) @@ -56,7 +59,9 @@ def layout(self): Read-Only. """ - return layout.Layout( + from ansys.edb.core.layout.layout import Layout + + return Layout( self.__stub.GetLayout(_QueryBuilder.layout_obj_target_msg(self, self.layout_obj_type)) ) diff --git a/src/ansys/edb/core/inner/parser.py b/src/ansys/edb/core/inner/parser.py index 7552f18bdd..5daf9c3204 100644 --- a/src/ansys/edb/core/inner/parser.py +++ b/src/ansys/edb/core/inner/parser.py @@ -2,7 +2,17 @@ import functools -from ansys.edb.core import geometry, simulation_setup, utility +from ansys.edb.geometry.point3d_data import Point3DData +from ansys.edb.simulation_setup.adaptive_solutions import ( + AdaptiveFrequency, + BroadbandAdaptiveSolution, + MatrixConvergenceData, + MultiFrequencyAdaptiveSolution, + SingleFrequencyAdaptiveSolution, +) +from ansys.edb.simulation_setup.mesh_operation import LengthMeshOperation, SkinDepthMeshOperation +from ansys.edb.utility.rlc import Rlc +from ansys.edb.utility.value import Value def to_point_data(fn): @@ -108,7 +118,9 @@ def _to_point_data(message): ------- geometry.PointData """ - return geometry.PointData([utility.Value(message.x), utility.Value(message.y)]) + from ansys.edb.geometry.point_data import PointData + + return PointData([Value(message.x), Value(message.y)]) def _to_point_data_pair(message): @@ -164,9 +176,7 @@ def _to_point3d_data(message): ------- geometry.Point3DData """ - return geometry.Point3DData( - utility.Value(message.x), utility.Value(message.y), utility.Value(message.z) - ) + return Point3DData(Value(message.x), Value(message.y), Value(message.z)) def _to_polygon_data(message): @@ -182,11 +192,13 @@ def _to_polygon_data(message): """ from ansys.api.edb.v1.point_data_pb2 import BoxMessage + from ansys.edb.core.geometry.polygon_data import PolygonData + if isinstance(message, BoxMessage): b = _to_box(message) - return geometry.PolygonData(lower_left=b[0], upper_right=b[1]) + return PolygonData(lower_left=b[0], upper_right=b[1]) else: - return geometry.PolygonData( + return PolygonData( points=_to_point_data_list(message.points), holes=_to_polygon_data_list(message.holes), sense=message.sense, @@ -236,7 +248,7 @@ def _to_circle(message): tuple[geometry.PointData, utility.Value] """ if hasattr(message, "center") and hasattr(message, "radius"): - return _to_point_data(message.center), utility.Value(message.radius) + return _to_point_data(message.center), Value(message.radius) def _to_rlc(message): @@ -250,12 +262,12 @@ def _to_rlc(message): ------- Rlc """ - return utility.Rlc( - utility.Value(message.r), + return Rlc( + Value(message.r), message.r_enabled.value, - utility.Value(message.l), + Value(message.l), message.l_enabled.value, - utility.Value(message.c), + Value(message.c), message.c_enabled.value, message.is_parallel.value, ) @@ -276,7 +288,7 @@ def _to_mx_convergence_data(message): if len(mx_entry_msgs) == 0: return - mx_conv_data = simulation_setup.MatrixConvergenceData() + mx_conv_data = MatrixConvergenceData() if ( message.all_are_constant or message.all_diag_are_constant @@ -353,7 +365,7 @@ def _to_single_frequency_adaptive_solution(message): SingleFrequencyAdaptiveSolution """ adaptive_freq_data = _to_base_adaptive_frequency_solution(message.adaptive_frequency) - return simulation_setup.SingleFrequencyAdaptiveSolution( + return SingleFrequencyAdaptiveSolution( adaptive_freq_data[0], adaptive_freq_data[1], message.max_passes, @@ -374,7 +386,7 @@ def _to_multi_adaptive_freq(message): AdaptiveFrequency """ adaptive_freq_data = _to_base_adaptive_frequency_solution(message.adaptive_frequency) - return simulation_setup.AdaptiveFrequency( + return AdaptiveFrequency( adaptive_freq_data[0], adaptive_freq_data[1], {key: value for (key, value) in message.output_variables}, @@ -392,7 +404,7 @@ def _to_multi_frequency_adaptive_solution(message): ------- MultiFrequencyAdaptiveSolution """ - return simulation_setup.MultiFrequencyAdaptiveSolution( + return MultiFrequencyAdaptiveSolution( message.max_passes, [_to_multi_adaptive_freq(freq_msg) for freq_msg in message.adaptive_frequencies], ) @@ -409,7 +421,7 @@ def _to_broadband_adaptive_solution(message): ------- BroadbandAdaptiveSolution """ - return simulation_setup.BroadbandAdaptiveSolution( + return BroadbandAdaptiveSolution( message.low_frequency, message.high_frequency, message.max_passes, message.max_delta ) @@ -425,7 +437,7 @@ def _length_mesh_op(message): ------- LengthMeshOperation """ - return simulation_setup.LengthMeshOperation( + return LengthMeshOperation( max_length=message.max_length, restrict_max_length=message.restrict_length, max_elements=message.max_elements, @@ -444,7 +456,7 @@ def _to_skin_depth_mesh_op(message): ------- SkinDepthMeshOperation """ - return simulation_setup.SkinDepthMeshOperation( + return SkinDepthMeshOperation( skin_depth=message.skin_depth, surface_triangle_length=message.surface_triangle_length, num_layers=message.num_layers, diff --git a/src/ansys/edb/core/inner/variable_server.py b/src/ansys/edb/core/inner/variable_server.py index c7994c98a7..ea7ce28229 100644 --- a/src/ansys/edb/core/inner/variable_server.py +++ b/src/ansys/edb/core/inner/variable_server.py @@ -5,7 +5,7 @@ from ansys.edb.core.inner.messages import value_message from ansys.edb.core.session import get_variable_server_stub -from ansys.edb.core.utility import Value +from ansys.edb.core.utility.value import Value class VariableServer: diff --git a/src/ansys/edb/core/layer/layer.py b/src/ansys/edb/core/layer/layer.py index b7d279c490..61a0a54819 100644 --- a/src/ansys/edb/core/layer/layer.py +++ b/src/ansys/edb/core/layer/layer.py @@ -6,7 +6,7 @@ from ansys.api.edb.v1.layer_pb2_grpc import LayerServiceStub from ansys.edb.core.edb_defs import LayoutObjType -from ansys.edb.core.inner import ObjBase +from ansys.edb.core.inner.base import ObjBase from ansys.edb.core.inner.messages import ( get_product_property_ids_message, get_product_property_message, diff --git a/src/ansys/edb/core/layer/layer_collection.py b/src/ansys/edb/core/layer/layer_collection.py index 8f9600c3dc..1fde53016a 100644 --- a/src/ansys/edb/core/layer/layer_collection.py +++ b/src/ansys/edb/core/layer/layer_collection.py @@ -4,7 +4,7 @@ import ansys.api.edb.v1.layer_collection_pb2 as layer_collection_pb2 -from ansys.edb.core.inner import ObjBase +from ansys.edb.core.inner.base import ObjBase from ansys.edb.core.inner.messages import ( get_product_property_ids_message, get_product_property_message, diff --git a/src/ansys/edb/core/layer/stackup_layer.py b/src/ansys/edb/core/layer/stackup_layer.py index cdabb858b7..42902537c3 100644 --- a/src/ansys/edb/core/layer/stackup_layer.py +++ b/src/ansys/edb/core/layer/stackup_layer.py @@ -4,7 +4,7 @@ import ansys.api.edb.v1.stackup_layer_pb2 as stackup_layer_pb2 -from ansys.edb.core.inner import messages +from ansys.edb.core.inner.messages import value_message from ansys.edb.core.layer import Layer from ansys.edb.core.session import get_stackup_layer_stub from ansys.edb.core.utility import Value @@ -48,9 +48,7 @@ def _get_layer_material_name_message(layer, evaluated): def _stackup_layer_value_message(layer, value): """Convert to StackupLayerValueMessage.""" - return stackup_layer_pb2.StackupLayerValueMessage( - layer=layer.msg, value=messages.value_message(value) - ) + return stackup_layer_pb2.StackupLayerValueMessage(layer=layer.msg, value=value_message(value)) def _layer_roughness_region_message(layer, region): @@ -82,8 +80,8 @@ def create(name, layer_type, thickness, elevation, material): params = { "name": name, "type": layer_type.value, - "thickness": messages.value_message(thickness), - "elevation": messages.value_message(elevation), + "thickness": value_message(thickness), + "elevation": value_message(elevation), "material": material, } @@ -234,10 +232,10 @@ def set_roughness_model(self, roughness_model, region): roughness_model_msg = stackup_layer_pb2.RoughnessModelMessage() is_groisse_roughness = isinstance(roughness_model, Value) roughness_model_msg.roughness.CopyFrom( - messages.value_message(roughness_model if is_groisse_roughness else roughness_model[0]) + value_message(roughness_model if is_groisse_roughness else roughness_model[0]) ) if not is_groisse_roughness: - roughness_model_msg.surface_ratio.CopyFrom(messages.value_message(roughness_model[1])) + roughness_model_msg.surface_ratio.CopyFrom(value_message(roughness_model[1])) request = stackup_layer_pb2.SetRoughnessModelMessage( layer_rough_region=_layer_roughness_region_message(self, region), roughness_model=roughness_model_msg, @@ -294,7 +292,7 @@ def hfss_solver_properties(self): def hfss_solver_properties(self, hfss_solver_props): hfss_solver_props_msg = stackup_layer_pb2.HFSSSolverPropertiesMessage( dc_thickness_type=hfss_solver_props[0].value, - dc_thickness=messages.value_message(hfss_solver_props[1]), + dc_thickness=value_message(hfss_solver_props[1]), solve_inside=hfss_solver_props[2], ) request = stackup_layer_pb2.SetHFSSSolverPropertiesMessage( diff --git a/src/ansys/edb/core/layout/cell.py b/src/ansys/edb/core/layout/cell.py index 41973f47c1..b0667fc706 100644 --- a/src/ansys/edb/core/layout/cell.py +++ b/src/ansys/edb/core/layout/cell.py @@ -7,7 +7,24 @@ import ansys.api.edb.v1.edb_defs_pb2 as edb_defs_pb2 from ansys.edb.core.edb_defs import LayoutObjType -from ansys.edb.core.inner import ObjBase, messages, variable_server +from ansys.edb.core.inner.base import ObjBase +from ansys.edb.core.inner.messages import ( + bool_property_message, + cell_cutout_message, + cell_find_message, + cell_set_temperature_settings_message, + design_mode_property_message, + edb_obj_message, + get_product_property_ids_message, + get_product_property_message, + hfss_extent_info_message, + hfss_extent_message, + int_property_message, + set_product_property_message, + string_property_message, + value_message, +) +from ansys.edb.core.inner.variable_server import VariableServer from ansys.edb.core.layout import layout from ansys.edb.core.primitive import Primitive from ansys.edb.core.session import StubAccessor, StubType @@ -83,7 +100,7 @@ def primitive_helper(msg): # dictionary describing message type and functions to translate them _HFSS_EXTENT_MESSAGE_HELPER = { "HfssExtentMessage": { - "msg": messages.hfss_extent_message, + "msg": hfss_extent_message, "val": _translate_hfss_extent, }, "bool": { @@ -91,11 +108,11 @@ def primitive_helper(msg): "val": bool, }, "ValueMessage": { - "msg": messages.value_message, + "msg": value_message, "val": Value, }, "EDBObjMessage": { - "msg": messages.edb_obj_message, + "msg": edb_obj_message, "val": primitive_helper, }, "HfssExtentsType": { @@ -112,7 +129,7 @@ def primitive_helper(msg): # takes user-provided arbitrary args and a list of allowed keywords # return a copy including only the valid args def sanitize_args(args): - """Extract valid extent options and convert them into messages.""" + """Extract valid extent options and convert them into.""" return { k: _HFSS_EXTENT_MESSAGE_HELPER[HFSS_EXTENT_ARGS[k]]["msg"](args[k]) for k in filter(lambda k: k in args, HFSS_EXTENT_ARGS.keys()) @@ -137,11 +154,11 @@ def create(db, cell_type, name): @staticmethod def set_hfss_extents(cell, extents): return cell_pb2.CellSetHfssExtentsMessage( - cell=cell.msg, info=messages.hfss_extent_info_message(extents) + cell=cell.msg, info=hfss_extent_info_message(extents) ) -class Cell(ObjBase, variable_server.VariableServer): +class Cell(ObjBase, VariableServer): """Cell.""" __stub: CellServiceStub = StubAccessor(StubType.cell) @@ -155,7 +172,7 @@ def __init__(self, msg): msg : EDBObjMessage """ ObjBase.__init__(self, msg) - variable_server.VariableServer.__init__(self, msg) + VariableServer.__init__(self, msg) @classmethod def create(cls, db, cell_type, cell_name): @@ -213,7 +230,7 @@ def find(cls, database, cell_type, name=None, cell_id=None): Cell Cell that was found, None otherwise. """ - cell = Cell(cls.__stub.Find(messages.cell_find_message(database, cell_type, name, cell_id))) + cell = Cell(cls.__stub.Find(cell_find_message(database, cell_type, name, cell_id))) return None if cell.is_null else cell def delete(self): @@ -245,7 +262,7 @@ def is_blackbox(self): @is_blackbox.setter def is_blackbox(self, value): - self.__stub.SetBlackBox(messages.bool_property_message(self, value)) + self.__stub.SetBlackBox(bool_property_message(self, value)) @property def anti_pads_always_on(self): @@ -258,7 +275,7 @@ def anti_pads_always_on(self): @anti_pads_always_on.setter def anti_pads_always_on(self, value): - self.__stub.SetAntiPadsAlwaysOn(messages.bool_property_message(self, value)) + self.__stub.SetAntiPadsAlwaysOn(bool_property_message(self, value)) @property def anti_pads_option(self): @@ -272,7 +289,7 @@ def anti_pads_option(self): @anti_pads_option.setter def anti_pads_option(self, value): - self.__stub.SetAntiPadsOption(messages.int_property_message(self, value)) + self.__stub.SetAntiPadsOption(int_property_message(self, value)) @property def is_symbolic_footprint(self): @@ -289,7 +306,7 @@ def name(self): @name.setter def name(self, value): - self.__stub.SetName(messages.string_property_message(self, value)) + self.__stub.SetName(string_property_message(self, value)) @property def design_mode(self): @@ -298,7 +315,7 @@ def design_mode(self): @design_mode.setter def design_mode(self, value): - self.__stub.SetDesignMode(messages.design_mode_property_message(self, value)) + self.__stub.SetDesignMode(design_mode_property_message(self, value)) @property def hfss_extent_info(self): @@ -325,9 +342,7 @@ def temperature_settings(self): @temperature_settings.setter def temperature_settings(self, value): - self.__stub.SetTemperatureSettings( - messages.cell_set_temperature_settings_message(self, value) - ) + self.__stub.SetTemperatureSettings(cell_set_temperature_settings_message(self, value)) def cutout(self, included_nets, clipped_nets, clipping_polygon, clean_clipping=True): """Cutout an existing cell into a new cell. @@ -350,7 +365,7 @@ def cutout(self, included_nets, clipped_nets, clipping_polygon, clean_clipping=T """ return Cell( self.__stub.CutOut( - messages.cell_cutout_message( + cell_cutout_message( self, included_nets, clipped_nets, clipping_polygon, clean_clipping ) ) @@ -369,9 +384,7 @@ def get_product_property_ids(self, prod_id): list[int] List of the user-defined attribute IDs for properties stored in this object """ - ids = self.__stub.GetProductPropertyIds( - messages.get_product_property_ids_message(self, prod_id) - ).ids + ids = self.__stub.GetProductPropertyIds(get_product_property_ids_message(self, prod_id)).ids return [prop_id for prop_id in ids] def get_product_property(self, prod_id, attr_id): @@ -389,9 +402,7 @@ def get_product_property(self, prod_id, attr_id): str The string stored in this property. """ - return self.__stub.GetProductProperty( - messages.get_product_property_message(self, prod_id, attr_id) - ) + return self.__stub.GetProductProperty(get_product_property_message(self, prod_id, attr_id)) def set_product_property(self, prod_id, attr_id, prop_value): """Set the product property of the cell associated with the given product and attribute ids. @@ -406,7 +417,7 @@ def set_product_property(self, prod_id, attr_id, prop_value): The string stored in this property. """ self.__stub.SetProductProperty( - messages.set_product_property_message(self, prod_id, attr_id, prop_value) + set_product_property_message(self, prod_id, attr_id, prop_value) ) def delete_simulation_setup(self, name): @@ -417,7 +428,7 @@ def delete_simulation_setup(self, name): name : str Name of the setup to delete. """ - self.__stub.DeleteSimulationSetup(messages.string_property_message(self, name)) + self.__stub.DeleteSimulationSetup(string_property_message(self, name)) @property def simulation_setups(self): @@ -455,4 +466,4 @@ def generate_via_smart_box(self, net_name): list[:class:`PolygonData `] A list of boxes; one around each via discovered. """ - self.__stub.GenerateViaSmartBox(messages.string_property_message(self, net_name)) + self.__stub.GenerateViaSmartBox(string_property_message(self, net_name)) diff --git a/src/ansys/edb/core/layout/layout.py b/src/ansys/edb/core/layout/layout.py index 795fc9e5f9..3816d18749 100644 --- a/src/ansys/edb/core/layout/layout.py +++ b/src/ansys/edb/core/layout/layout.py @@ -5,7 +5,16 @@ from ansys.edb.core.edb_defs import LayoutObjType from ansys.edb.core.hierarchy import CellInstance, Group, PinGroup -from ansys.edb.core.inner import ObjBase, messages, parser, utils, variable_server +from ansys.edb.core.inner.base import ObjBase +from ansys.edb.core.inner.messages import ( + layout_convert_p2v_message, + layout_expanded_extent_message, + layout_get_items_message, + pointer_property_message, +) +from ansys.edb.core.inner.parser import to_polygon_data +from ansys.edb.core.inner.utils import map_list +from ansys.edb.core.inner.variable_server import VariableServer from ansys.edb.core.layer import LayerCollection import ansys.edb.core.layout as layout from ansys.edb.core.layout.mcad_model import McadModel @@ -16,7 +25,7 @@ from ansys.edb.core.terminal import Terminal -class Layout(ObjBase, variable_server.VariableServer): +class Layout(ObjBase, VariableServer): """Layout.""" __stub: LayoutServiceStub = StubAccessor(StubType.layout) @@ -29,7 +38,7 @@ def __init__(self, msg): msg : EDBObjMessage """ ObjBase.__init__(self, msg) - variable_server.VariableServer.__init__(self, msg) + VariableServer.__init__(self, msg) @property def cell(self): @@ -57,8 +66,8 @@ def layer_collection(self, layer_collection): def _get_items(self, obj_type, lyt_obj_type_enum, do_cast=False): """Get list of layout objects.""" - items = utils.map_list( - self.__stub.GetItems(messages.layout_get_items_message(self, lyt_obj_type_enum)).items, + items = map_list( + self.__stub.GetItems(layout_get_items_message(self, lyt_obj_type_enum)).items, obj_type, ) return items if not do_cast else [item.cast() for item in items] @@ -159,7 +168,7 @@ def extended_nets(self): """ return self._get_items(ExtendedNet, LayoutObjType.EXTENDED_NET) - @parser.to_polygon_data + @to_polygon_data def expanded_extent( self, nets, extent, expansion_factor, expansion_unitless, use_round_corner, num_increments ): @@ -192,7 +201,7 @@ def expanded_extent( Method returns the expansion of the contour, so any voids within expanded objects are ignored. """ return self.__stub.GetExpandedExtentFromNets( - messages.layout_expanded_extent_message( + layout_expanded_extent_message( self, nets, extent, @@ -213,9 +222,7 @@ def convert_primitives_to_vias(self, primitives, is_pins=False): is_pins : bool, optional True for pins, false for vias (default). """ - self.__stub.ConvertPrimitivesToVias( - messages.layout_convert_p2v_message(self, primitives, is_pins) - ) + self.__stub.ConvertPrimitivesToVias(layout_convert_p2v_message(self, primitives, is_pins)) @property def port_reference_terminals_connected(self): @@ -243,7 +250,7 @@ def fixed_zone_primitive(self): @fixed_zone_primitive.setter def fixed_zone_primitive(self, value): - self.__stub.SetFixedZonePrimitives(messages.pointer_property_message(self, value)) + self.__stub.SetFixedZonePrimitives(pointer_property_message(self, value)) @property def board_bend_defs(self): diff --git a/src/ansys/edb/core/layout/mcad_model.py b/src/ansys/edb/core/layout/mcad_model.py index 3940072040..5b242007aa 100644 --- a/src/ansys/edb/core/layout/mcad_model.py +++ b/src/ansys/edb/core/layout/mcad_model.py @@ -1,7 +1,20 @@ """Mcad Model.""" from ansys.edb.core import hierarchy -from ansys.edb.core.inner import ObjBase, messages, parser +from ansys.edb.core.inner.base import ObjBase +from ansys.edb.core.inner.messages import ( + double_property_message, + edb_obj_message, + int_property_message, + mcad_model_bool_message, + mcad_model_creation_message, + mcad_model_hfss_creation_message, + mcad_model_set_rotation_message, + mcad_model_string_message, + point_3d_property_message, + string_property_message, +) +from ansys.edb.core.inner.parser import to_point3d_data from ansys.edb.core.session import McadModelServiceStub, StubAccessor, StubType @@ -17,9 +30,7 @@ def create_stride(cls, connectable=None, layout=None, filename=None): call directly on :term:`Connectable` or :func:`Layout`. """ return cls( - cls.__stub.CreateStride( - messages.mcad_model_creation_message(connectable, layout, filename) - ) + cls.__stub.CreateStride(mcad_model_creation_message(connectable, layout, filename)) ) @classmethod @@ -30,7 +41,7 @@ def create_hfss(cls, connectable=None, layout=None, filename=None, design=None): """ return cls( cls.__stub.CreateHfss( - messages.mcad_model_hfss_creation_message(connectable, layout, filename, design) + mcad_model_hfss_creation_message(connectable, layout, filename, design) ) ) @@ -41,9 +52,7 @@ def create_3d_comp(cls, connectable=None, layout=None, filename=None): call directly on :term:`Connectable` or :func:`Layout`. """ return cls( - cls.__stub.Create3dComp( - messages.mcad_model_creation_message(connectable, layout, filename) - ) + cls.__stub.Create3dComp(mcad_model_creation_message(connectable, layout, filename)) ) @classmethod @@ -52,7 +61,7 @@ def is_mcad(cls, connectable): call directly on :term:`Connectable`. """ - return cls.__stub.IsMcad(messages.edb_obj_message(connectable)) + return cls.__stub.IsMcad(edb_obj_message(connectable)) @classmethod def is_mcad_stride(cls, connectable): @@ -60,7 +69,7 @@ def is_mcad_stride(cls, connectable): call directly on :term:`Connectable`. """ - return cls.__stub.IsMcadStride(messages.edb_obj_message(connectable)) + return cls.__stub.IsMcadStride(edb_obj_message(connectable)) @classmethod def is_mcad_hfss(cls, connectable): @@ -68,7 +77,7 @@ def is_mcad_hfss(cls, connectable): call directly on :term:`Connectable`. """ - return cls.__stub.IsMcadHfss(messages.edb_obj_message(connectable)) + return cls.__stub.IsMcadHfss(edb_obj_message(connectable)) @classmethod def is_mcad_3d_comp(cls, connectable): @@ -76,7 +85,7 @@ def is_mcad_3d_comp(cls, connectable): call directly on :term:`Connectable`. """ - return cls.__stub.IsMcad3dComp(messages.edb_obj_message(connectable)) + return cls.__stub.IsMcad3dComp(edb_obj_message(connectable)) @property def cell_instance(self): @@ -84,7 +93,7 @@ def cell_instance(self): Read-Only. """ - return hierarchy.CellInstance(self.__stub.GetCellInst(messages.edb_obj_message(self))) + return hierarchy.CellInstance(self.__stub.GetCellInst(edb_obj_message(self))) @property def model_name(self): @@ -92,7 +101,7 @@ def model_name(self): Read-Only. """ - return self.__stub.GetModelName(messages.edb_obj_message(self)).value + return self.__stub.GetModelName(edb_obj_message(self)).value @property def design_name(self): @@ -100,24 +109,24 @@ def design_name(self): Read-Only. """ - return self.__stub.GetDesignName(messages.edb_obj_message(self)).value + return self.__stub.GetDesignName(edb_obj_message(self)).value @property def origin(self): """:class:`Point3DData ` Origin 3D point of a Mcad model.""" - return self.__stub.GetOrigin(messages.edb_obj_message(self)) + return self.__stub.GetOrigin(edb_obj_message(self)) @origin.setter def origin(self, pnt): - self.__stub.SetOrigin(messages.point_3d_property_message(self, pnt)) + self.__stub.SetOrigin(point_3d_property_message(self, pnt)) @property def rotation(self): r""":obj:`tuple`\[:class:`Point3DData `, :class:`Point3DData `, :obj:`float`\] Rotation from/to axis and angle.""" # noqa - msg = self.__stub.GetRotation(messages.edb_obj_message(self)) + msg = self.__stub.GetRotation(edb_obj_message(self)) return ( - parser.to_point3d_data(msg.axis_from), - parser.to_point3d_data(msg.axis_to), + to_point3d_data(msg.axis_from), + to_point3d_data(msg.axis_to), msg.angle.value, ) @@ -134,18 +143,16 @@ def set_rotation(self, axis_from, axis_to, angle): axis_to : :class:`Point3DData ` angle : float """ - self.__stub.SetRotation( - messages.mcad_model_set_rotation_message(self, axis_from, axis_to, angle) - ) + self.__stub.SetRotation(mcad_model_set_rotation_message(self, axis_from, axis_to, angle)) @property def scale(self): """:obj:`float` The scale of a Mcad model.""" - return self.__stub.GetScale(messages.edb_obj_message(self)).value + return self.__stub.GetScale(edb_obj_message(self)).value @scale.setter def scale(self, scale): - self.__stub.SetScale(messages.double_property_message(self, scale)) + self.__stub.SetScale(double_property_message(self, scale)) def material(self, index): """Get material name of a Mcad model part at index. @@ -158,7 +165,7 @@ def material(self, index): ------- str """ - return self.__stub.GetMaterial(messages.int_property_message(self, index)).value + return self.__stub.GetMaterial(int_property_message(self, index)).value def set_material(self, index, material): """Set material name of a Mcad model part at index. @@ -168,7 +175,7 @@ def set_material(self, index, material): index : int material : str """ - self.__stub.SetMaterial(messages.mcad_model_string_message(self, index, material)) + self.__stub.SetMaterial(mcad_model_string_message(self, index, material)) def visible(self, index): """Get visibility of a Mcad model part at index. @@ -181,7 +188,7 @@ def visible(self, index): ------- bool """ - return self.__stub.GetVisible(messages.int_property_message(self, index)).value + return self.__stub.GetVisible(int_property_message(self, index)).value def set_visible(self, index, visible): """Set visibility of a Mcad model part at index. @@ -191,7 +198,7 @@ def set_visible(self, index, visible): index : int visible : bool """ - self.__stub.SetVisible(messages.mcad_model_bool_message(self, index, visible)) + self.__stub.SetVisible(mcad_model_bool_message(self, index, visible)) def modeled(self, index): """Get if a Mcad model part at index is included in analysis. @@ -204,7 +211,7 @@ def modeled(self, index): ------- bool """ - return self.__stub.GetModeled(messages.int_property_message(self, index)).value + return self.__stub.GetModeled(int_property_message(self, index)).value def set_modeled(self, index, modeled): """Set if a Mcad model part at index is modeled. @@ -214,7 +221,7 @@ def set_modeled(self, index, modeled): index : int modeled : bool """ - self.__stub.SetModeled(messages.mcad_model_bool_message(self, index, modeled)) + self.__stub.SetModeled(mcad_model_bool_message(self, index, modeled)) def part_count(self): """Mcad model part count. @@ -223,7 +230,7 @@ def part_count(self): ------- int """ - return self.__stub.GetPartCount(messages.edb_obj_message(self)).value + return self.__stub.GetPartCount(edb_obj_message(self)).value def part_index(self, name): """Index of a Mcad model part with the specified name. @@ -236,7 +243,7 @@ def part_index(self, name): ------- int """ - return self.__stub.GetPartIndex(messages.string_property_message(self, name)).value + return self.__stub.GetPartIndex(string_property_message(self, name)).value def part_name(self, index): """Name of a Mcad model part at the specified index. @@ -249,4 +256,4 @@ def part_name(self, index): ------- str """ - return self.__stub.GetPartName(messages.int_property_message(self, index)).value + return self.__stub.GetPartName(int_property_message(self, index)).value diff --git a/src/ansys/edb/core/layout/voltage_regulator.py b/src/ansys/edb/core/layout/voltage_regulator.py index 1ca7c8bbb3..5976a1d49a 100644 --- a/src/ansys/edb/core/layout/voltage_regulator.py +++ b/src/ansys/edb/core/layout/voltage_regulator.py @@ -2,7 +2,17 @@ import ansys.api.edb.v1.voltage_regulator_pb2 as vr_pb2 from ansys.edb.core.edb_defs import LayoutObjType -from ansys.edb.core.inner import conn_obj, messages +from ansys.edb.core.inner.conn_obj import ConnObj +from ansys.edb.core.inner.messages import ( + bool_property_message, + edb_obj_collection_message, + edb_obj_name_message, + power_module_message, + string_property_message, + strings_property_message, + value_message, + value_property_message, +) from ansys.edb.core.primitive import PadstackInstance from ansys.edb.core.session import StubAccessor, StubType from ansys.edb.core.utility import Value @@ -116,7 +126,7 @@ def create_power_module(msg): ) -class VoltageRegulator(conn_obj.ConnObj): +class VoltageRegulator(ConnObj): """Voltage regulator.""" __stub = StubAccessor(StubType.voltage_regulator) @@ -153,9 +163,9 @@ def create(cls, layout, name, active, voltage, lrc, lrp): layout, name, active, - messages.value_message(voltage), - messages.value_message(lrc), - messages.value_message(lrp), + value_message(voltage), + value_message(lrc), + value_message(lrp), ) ) ) @@ -167,7 +177,7 @@ def name(self): @name.setter def name(self, newname): - self.__stub.SetName(messages.edb_obj_name_message(self.msg, newname)) + self.__stub.SetName(edb_obj_name_message(self.msg, newname)) @property def active(self): @@ -176,7 +186,7 @@ def active(self): @active.setter def active(self, newactive): - self.__stub.SetIsActive(messages.bool_property_message(self, newactive)) + self.__stub.SetIsActive(bool_property_message(self, newactive)) @property def voltage(self): @@ -188,9 +198,7 @@ def voltage(self): @voltage.setter def voltage(self, newvoltage): - self.__stub.SetVoltage( - messages.value_property_message(self.msg, messages.value_message(newvoltage)) - ) + self.__stub.SetVoltage(value_property_message(self.msg, value_message(newvoltage))) @property def lrc(self): @@ -203,7 +211,7 @@ def lrc(self): @lrc.setter def lrc(self, newlrc): self.__stub.SetLoadRegulationCurrent( - messages.value_property_message(self.msg, messages.value_message(newlrc)) + value_property_message(self.msg, value_message(newlrc)) ) @property @@ -217,7 +225,7 @@ def lrp(self): @lrp.setter def lrp(self, newlrp): self.__stub.SetLoadRegulationPercent( - messages.value_property_message(self.msg, messages.value_message(newlrp)) + value_property_message(self.msg, value_message(newlrp)) ) @property @@ -231,7 +239,7 @@ def pos_remote_sense_pin(self): @pos_remote_sense_pin.setter def pos_remote_sense_pin(self, newpin): - self.__stub.SetPosRemoteSensePin(messages.edb_obj_collection_message([self, newpin])) + self.__stub.SetPosRemoteSensePin(edb_obj_collection_message([self, newpin])) @property def neg_remote_sense_pin(self): @@ -244,7 +252,7 @@ def neg_remote_sense_pin(self): @neg_remote_sense_pin.setter def neg_remote_sense_pin(self, newpin): - self.__stub.SetNegRemoteSensePin(messages.edb_obj_collection_message([self, newpin])) + self.__stub.SetNegRemoteSensePin(edb_obj_collection_message([self, newpin])) @property def num_power_modules(self): @@ -275,7 +283,7 @@ def get_power_module(self, comp_group_name): PowerModule """ return _QueryBuilder.create_power_module( - msg=self.__stub.GetPowerModule(messages.string_property_message(self, comp_group_name)) + msg=self.__stub.GetPowerModule(string_property_message(self, comp_group_name)) ) def get_all_power_modules(self): @@ -299,7 +307,7 @@ def add_power_module(self, power_module): """ self.__stub.AddPowerModule( vr_pb2.PowerModulePropertyMessage( - vrm=self.msg, module=messages.power_module_message(power_module) + vrm=self.msg, module=power_module_message(power_module) ) ) @@ -311,7 +319,7 @@ def remove_power_module(self, name): name : str Component Group Name of the Power Module to be removed. """ - self.__stub.RemovePowerModule(messages.string_property_message(target=self, value=name)) + self.__stub.RemovePowerModule(string_property_message(target=self, value=name)) def add_power_modules(self, power_modules): """Add multiple Power Modules to this Voltage Regulator. @@ -321,7 +329,7 @@ def add_power_modules(self, power_modules): power_modules : list[PowerModule] Power Modules to be added """ - self.__stub.AddPowerModules([messages.power_module_message(pm) for pm in power_modules]) + self.__stub.AddPowerModules([power_module_message(pm) for pm in power_modules]) def remove_power_modules(self, names): """Remove multiple Power Modules. @@ -332,7 +340,7 @@ def remove_power_modules(self, names): Component Group Names of each Power Module to remove. """ - self.__stub.RemovePowerModules(messages.strings_property_message(target=self, value=names)) + self.__stub.RemovePowerModules(strings_property_message(target=self, value=names)) def remove_all_power_modules(self): """Remove all Power Modules in this Voltage Regulator.""" diff --git a/src/ansys/edb/core/layout_instance/layout_instance.py b/src/ansys/edb/core/layout_instance/layout_instance.py index 8de05cfb16..0222c1bd75 100644 --- a/src/ansys/edb/core/layout_instance/layout_instance.py +++ b/src/ansys/edb/core/layout_instance/layout_instance.py @@ -2,7 +2,7 @@ import ansys.api.edb.v1.layout_instance_pb2 as layout_instance_pb2 from ansys.edb.core.geometry import PointData -from ansys.edb.core.inner import ObjBase, utils +from ansys.edb.core.inner.base import ObjBase from ansys.edb.core.inner.messages import ( layer_ref_message, net_ref_message, @@ -10,6 +10,7 @@ polygon_data_message, strings_message, ) +from ansys.edb.core.inner.utils import map_list from ansys.edb.core.layout_instance.layout_obj_instance import LayoutObjInstance from ansys.edb.core.session import LayoutInstanceServiceStub, StubAccessor, StubType @@ -46,9 +47,7 @@ def query_layout_obj_instances(self, layer_filter=None, net_filter=None, spatial """ def to_msg_filter_list(client_filter, ref_msg_type): - return ( - utils.map_list(client_filter, ref_msg_type) if client_filter is not None else None - ) + return map_list(client_filter, ref_msg_type) if client_filter is not None else None msg_params = { "layout_inst": self.msg, @@ -71,11 +70,11 @@ def to_msg_filter_list(client_filter, ref_msg_type): if hits.HasField("full_partial_hits"): full_partial_hits = hits.full_partial_hits - return utils.map_list(full_partial_hits.full.items, LayoutObjInstance), utils.map_list( + return map_list(full_partial_hits.full.items, LayoutObjInstance), utils.map_list( full_partial_hits.partial.items, LayoutObjInstance ) else: - return utils.map_list(hits.hits.items, LayoutObjInstance) + return map_list(hits.hits.items, LayoutObjInstance) def get_layout_obj_instance_in_context(self, layout_obj, context): """Get the :class:`layout object instance ` of the given :term:`Connectable ` \ @@ -131,4 +130,4 @@ def get_connected_objects(self, origin_layout_obj_inst, touching_only): touching_only=touching_only, ) ) - return utils.map_list(hits.items, LayoutObjInstance) + return map_list(hits.items, LayoutObjInstance) diff --git a/src/ansys/edb/core/layout_instance/layout_instance_context.py b/src/ansys/edb/core/layout_instance/layout_instance_context.py index 8560c51819..a8bd2c89ec 100644 --- a/src/ansys/edb/core/layout_instance/layout_instance_context.py +++ b/src/ansys/edb/core/layout_instance/layout_instance_context.py @@ -1,7 +1,8 @@ """Layout Instance Context.""" -from ansys.edb.core.inner import ObjBase, parser +from ansys.edb.core.inner.base import ObjBase from ansys.edb.core.inner.messages import bool_property_message +from ansys.edb.core.inner.parser import to_polygon_data import ansys.edb.core.layout as layout from ansys.edb.core.session import LayoutInstanceContextServiceStub, StubAccessor, StubType @@ -19,7 +20,7 @@ def layout(self): """ return layout.Layout(self.__stub.GetLayout(self.msg)) - @parser.to_polygon_data + @to_polygon_data def get_bbox(self, local): """Get the bounding box of the context. diff --git a/src/ansys/edb/core/layout_instance/layout_obj_instance.py b/src/ansys/edb/core/layout_instance/layout_obj_instance.py index aae0941ea9..c3f12cf551 100644 --- a/src/ansys/edb/core/layout_instance/layout_obj_instance.py +++ b/src/ansys/edb/core/layout_instance/layout_obj_instance.py @@ -1,8 +1,10 @@ """Layout Obj Instance.""" -from ansys.edb.core.inner import ObjBase, parser, utils +from ansys.edb.core.inner.base import ObjBase from ansys.edb.core.inner.factory import create_conn_obj from ansys.edb.core.inner.messages import bool_property_message, layer_ref_property_message +from ansys.edb.core.inner.parser import to_polygon_data +from ansys.edb.core.inner.utils import map_list from ansys.edb.core.layer import Layer from ansys.edb.core.layout_instance.layout_instance_context import LayoutInstanceContext from ansys.edb.core.layout_instance.layout_obj_instance_2d_geometry import ( @@ -56,7 +58,7 @@ def get_geometries(self, layer): list[LayoutObjInstance2DGeometry or LayoutObjInstance3DGeometry] """ geoms = self.__stub.GetGeometries(layer_ref_property_message(self, layer)) - return utils.map_list(geoms.geometries, _parse_layout_obj_instance_geometry_message) + return map_list(geoms.geometries, _parse_layout_obj_instance_geometry_message) @property def context(self): @@ -69,7 +71,7 @@ def context(self): Read-Only """ - return utils.map_list(self.__stub.GetContext(self.msg).strings) + return map_list(self.__stub.GetContext(self.msg).strings) @property def layout_instance_context(self): @@ -88,7 +90,7 @@ def layout_obj(self): """ return create_conn_obj(self.__stub.GetLayoutObj(self.msg)) - @parser.to_polygon_data + @to_polygon_data def get_bbox(self, local=False): """Get the bounding box of the layout object instance. diff --git a/src/ansys/edb/core/layout_instance/layout_obj_instance_3d_geometry.py b/src/ansys/edb/core/layout_instance/layout_obj_instance_3d_geometry.py index 1082a658f1..c748f7524a 100644 --- a/src/ansys/edb/core/layout_instance/layout_obj_instance_3d_geometry.py +++ b/src/ansys/edb/core/layout_instance/layout_obj_instance_3d_geometry.py @@ -1,8 +1,8 @@ """Layout Obj Instance 3D Geometry.""" from ansys.edb.core.geometry import Triangle3DData -from ansys.edb.core.inner import utils from ansys.edb.core.inner.parser import to_point3d_data +from ansys.edb.core.inner.utils import map_list from ansys.edb.core.layout_instance.layout_obj_instance_geometry import LayoutObjInstanceGeometry from ansys.edb.core.session import LayoutObjInstance3DGeometryServiceStub, StubAccessor, StubType @@ -34,4 +34,4 @@ def to_3d_triangle(triangle_msg): to_point3d_data(triangle_msg.point_3), ) - return utils.map_list(tesselation_data.tesselation_data, to_3d_triangle) + return map_list(tesselation_data.tesselation_data, to_3d_triangle) diff --git a/src/ansys/edb/core/layout_instance/layout_obj_instance_geometry.py b/src/ansys/edb/core/layout_instance/layout_obj_instance_geometry.py index 3d9d86b970..70542ea0b2 100644 --- a/src/ansys/edb/core/layout_instance/layout_obj_instance_geometry.py +++ b/src/ansys/edb/core/layout_instance/layout_obj_instance_geometry.py @@ -2,7 +2,7 @@ from ansys.api.edb.v1.layout_obj_instance_geometry_pb2 import LayoutObjInstanceGeometryMessage -from ansys.edb.core.inner import ObjBase +from ansys.edb.core.inner.base import ObjBase from ansys.edb.core.inner.messages import edb_obj_message from ansys.edb.core.session import LayoutObjInstanceGeometryServiceStub, StubAccessor, StubType diff --git a/src/ansys/edb/core/net/differential_pair.py b/src/ansys/edb/core/net/differential_pair.py index 0d882c3cd9..7731d96a6b 100644 --- a/src/ansys/edb/core/net/differential_pair.py +++ b/src/ansys/edb/core/net/differential_pair.py @@ -1,7 +1,11 @@ """Differential pair.""" -from ansys.edb.core.inner import messages from ansys.edb.core.inner.layout_obj import LayoutObjType +from ansys.edb.core.inner.messages import ( + differential_pair_creation_message, + differential_pair_net_refs_message, + string_property_message, +) from ansys.edb.core.net.net import Net from ansys.edb.core.net.net_class import NetClass from ansys.edb.core.session import DifferentialPairServiceStub, StubAccessor, StubType @@ -36,9 +40,7 @@ def create(cls, layout, name, pos_net=None, neg_net=None): Newly created differential pair. """ return cls( - cls.__stub.Create( - messages.differential_pair_creation_message(layout, name, pos_net, neg_net) - ) + cls.__stub.Create(differential_pair_creation_message(layout, name, pos_net, neg_net)) ) @classmethod @@ -58,7 +60,7 @@ def find_by_name(cls, layout, name): The differential pair that was found. Check the returned differential pair's \ :obj:`is_null ` property to see if it exists. """ - return cls(cls.__stub.FindByName(messages.string_property_message(layout, name))) + return cls(cls.__stub.FindByName(string_property_message(layout, name))) @property def differential_pair(self): @@ -69,7 +71,7 @@ def differential_pair(self): @differential_pair.setter def differential_pair(self, value): self.__stub.SetDifferentialPair( - messages.differential_pair_net_refs_message(self, value[0], value[1]) + differential_pair_net_refs_message(self, value[0], value[1]) ) @property @@ -80,7 +82,7 @@ def positive_net(self): @positive_net.setter def positive_net(self, value): self.__stub.SetDifferentialPair( - messages.differential_pair_net_refs_message(self, value, self.differential_pair[1]) + differential_pair_net_refs_message(self, value, self.differential_pair[1]) ) @property @@ -91,7 +93,7 @@ def negative_net(self): @negative_net.setter def negative_net(self, value): self.__stub.SetDifferentialPair( - messages.differential_pair_net_refs_message(self, self.differential_pair[0], value) + differential_pair_net_refs_message(self, self.differential_pair[0], value) ) @property diff --git a/src/ansys/edb/core/net/net.py b/src/ansys/edb/core/net/net.py index e1d68d646f..72b2a76ff5 100644 --- a/src/ansys/edb/core/net/net.py +++ b/src/ansys/edb/core/net/net.py @@ -1,7 +1,12 @@ """Net.""" from ansys.edb.core.edb_defs import LayoutObjType -from ansys.edb.core.inner import layout_obj, messages +from ansys.edb.core.inner.layout_obj import LayoutObj +from ansys.edb.core.inner.messages import ( + bool_property_message, + net_get_layout_obj_message, + string_property_message, +) from ansys.edb.core.net.extended_net import ExtendedNet from ansys.edb.core.net.net_class import NetClass from ansys.edb.core.primitive import PadstackInstance, Primitive @@ -9,7 +14,7 @@ from ansys.edb.core.terminal import Terminal, TerminalInstance -class Net(layout_obj.LayoutObj): +class Net(LayoutObj): """Class representing net.""" layout_obj_type = LayoutObjType.NET @@ -18,9 +23,7 @@ class Net(layout_obj.LayoutObj): def _layout_objs(self, obj_type): """Get layout objects on a net.""" - return self.__stub.GetLayoutObjects( - messages.net_get_layout_obj_message(self, obj_type) - ).items + return self.__stub.GetLayoutObjects(net_get_layout_obj_message(self, obj_type)).items @classmethod def create(cls, layout, name): @@ -38,7 +41,7 @@ def create(cls, layout, name): Net Newly created net. """ - return Net(cls.__stub.Create(messages.string_property_message(layout, name))) + return Net(cls.__stub.Create(string_property_message(layout, name))) @classmethod def find_by_name(cls, layout, name): @@ -57,7 +60,7 @@ def find_by_name(cls, layout, name): Net matching the requested name. Check the returned net's \ :obj:`is_null ` property to see if it exists. """ - return Net(cls.__stub.FindByName(messages.string_property_message(layout, name))) + return Net(cls.__stub.FindByName(string_property_message(layout, name))) @property def name(self): @@ -66,7 +69,7 @@ def name(self): @name.setter def name(self, value): - self.__stub.SetName(messages.string_property_message(self, value)) + self.__stub.SetName(string_property_message(self, value)) @property def is_power_ground(self): @@ -78,7 +81,7 @@ def is_power_ground(self): @is_power_ground.setter def is_power_ground(self, value): - self.__stub.SetIsPowerGround(messages.bool_property_message(self, value)) + self.__stub.SetIsPowerGround(bool_property_message(self, value)) @property def primitives(self): diff --git a/src/ansys/edb/core/net/net_class.py b/src/ansys/edb/core/net/net_class.py index 0553d7dd55..b566aee25b 100644 --- a/src/ansys/edb/core/net/net_class.py +++ b/src/ansys/edb/core/net/net_class.py @@ -3,7 +3,12 @@ import ansys.api.edb.v1.netclass_pb2 as nc_pb2 from ansys.edb.core.edb_defs import LayoutObjType -from ansys.edb.core.inner import layout_obj, messages +from ansys.edb.core.inner.layout_obj import LayoutObj +from ansys.edb.core.inner.messages import ( + edb_obj_message, + edb_obj_name_message, + string_property_message, +) from ansys.edb.core.session import StubAccessor, StubType @@ -13,7 +18,7 @@ def create(layout, name): return nc_pb2.NetClassCreationMessage(layout=layout.msg, name=name) -class NetClass(layout_obj.LayoutObj): +class NetClass(LayoutObj): """Net class.""" __stub = StubAccessor(StubType.netclass) @@ -56,7 +61,7 @@ def find_by_name(cls, layout, name): Net class matching the requested name. Check the returned net class's \ :obj:`is_null ` property to see if it exists. """ - return NetClass(cls.__stub.FindByName(messages.edb_obj_name_message(layout, name))) + return NetClass(cls.__stub.FindByName(edb_obj_name_message(layout, name))) @property def name(self): @@ -65,7 +70,7 @@ def name(self): @name.setter def name(self, newname): - self.__stub.SetName(messages.edb_obj_name_message(self.msg, newname)) + self.__stub.SetName(edb_obj_name_message(self.msg, newname)) @property def description(self): @@ -74,7 +79,7 @@ def description(self): @description.setter def description(self, newdesc): - self.__stub.SetDescription(messages.string_property_message(self, newdesc)) + self.__stub.SetDescription(string_property_message(self, newdesc)) @property def is_power_ground(self): @@ -82,7 +87,7 @@ def is_power_ground(self): Read-Only. """ - return self.__stub.IsPowerGround(messages.edb_obj_message(self.msg)).value + return self.__stub.IsPowerGround(edb_obj_message(self.msg)).value @property def nets(self): diff --git a/src/ansys/edb/core/primitive/primitive.py b/src/ansys/edb/core/primitive/primitive.py index becf7b31b9..059b7b2a01 100644 --- a/src/ansys/edb/core/primitive/primitive.py +++ b/src/ansys/edb/core/primitive/primitive.py @@ -26,7 +26,23 @@ from ansys.edb.core import hierarchy, terminal from ansys.edb.core.definition.padstack_def import PadstackDef from ansys.edb.core.edb_defs import LayoutObjType -from ansys.edb.core.inner import conn_obj, messages, parser +from ansys.edb.core.inner.conn_obj import ConnObj +from ansys.edb.core.inner.messages import ( + bool_message, + edb_obj_message, + edb_obj_name_message, + int_property_message, + layer_ref_message, + net_ref_message, + point_message, + point_pair_message, + point_pair_property_message, + pointer_property_message, + polygon_data_message, + value_message, + value_property_message, +) +from ansys.edb.core.inner.parser import to_point_data_pair, to_polygon_data, to_polygon_data_list from ansys.edb.core.layer import Layer from ansys.edb.core.session import StubAccessor, StubType from ansys.edb.core.utility import Value @@ -54,7 +70,7 @@ def set_is_negative(p, is_negative): @staticmethod def set_layer(p, layer): - return primitive_pb2.SetLayerMessage(target=p.msg, layer=messages.layer_ref_message(layer)) + return primitive_pb2.SetLayerMessage(target=p.msg, layer=layer_ref_message(layer)) class PrimitiveType(Enum): @@ -173,7 +189,7 @@ class BackDrillType(Enum): DEPTH_DRILL = padstack_instance_pb2.DEPTH_DRILL -class Primitive(conn_obj.ConnObj): +class Primitive(ConnObj): """Base class representing primitive objects.""" __stub: primitive_pb2_grpc.PrimitiveServiceStub = StubAccessor(StubType.primitive) @@ -335,7 +351,7 @@ def make_zone_primitive(self, zone_id): Id of zone primitive will use. """ - self.__stub.MakeZonePrimitive(messages.int_property_message(self, zone_id)) + self.__stub.MakeZonePrimitive(int_property_message(self, zone_id)) class Rectangle(Primitive): @@ -381,15 +397,15 @@ def create( cls.__stub.Create( rectangle_pb2.RectangleCreationMessage( layout=layout.msg, - layer=messages.layer_ref_message(layer), - net=messages.net_ref_message(net), + layer=layer_ref_message(layer), + net=net_ref_message(net), representation_type=rep_type.value, - parameter1=messages.value_message(param1), - parameter2=messages.value_message(param2), - parameter3=messages.value_message(param3), - parameter4=messages.value_message(param4), - corner_radius=messages.value_message(corner_rad), - rotation=messages.value_message(rotation), + parameter1=value_message(param1), + parameter2=value_message(param2), + parameter3=value_message(param3), + parameter4=value_message(param4), + corner_radius=value_message(corner_rad), + rotation=value_message(rotation), ) ) ) @@ -463,12 +479,12 @@ def set_parameters(self, rep_type, param1, param2, param3, param4, corner_rad, r target=self.msg, parameters=rectangle_pb2.RectangleParametersMessage( representation_type=rep_type.value, - parameter1=messages.value_message(param1), - parameter2=messages.value_message(param2), - parameter3=messages.value_message(param3), - parameter4=messages.value_message(param4), - corner_radius=messages.value_message(corner_rad), - rotation=messages.value_message(rotation), + parameter1=value_message(param1), + parameter2=value_message(param2), + parameter3=value_message(param3), + parameter4=value_message(param4), + corner_radius=value_message(corner_rad), + rotation=value_message(rotation), ), ) ) @@ -490,7 +506,7 @@ def polygon_data(self): return Rectangle.render(*self.get_parameters()) @classmethod - @parser.to_polygon_data + @to_polygon_data def render( cls, rep_type, @@ -535,24 +551,24 @@ def render( center_y = y_lower_left_or_center_y + height / 2.0 polygon_data = cls.__stub.Render( rectangle_pb2.RectanglePolygonDataMessage( - center_x=messages.value_message(center_x), - center_y=messages.value_message(center_y), - width=messages.value_message(width), - height=messages.value_message(height), - corner_radius=messages.value_message(corner_radius), - rotation=messages.value_message(rotation), + center_x=value_message(center_x), + center_y=value_message(center_y), + width=value_message(width), + height=value_message(height), + corner_radius=value_message(corner_radius), + rotation=value_message(rotation), ishole=is_hole, ) ) elif rep_type == RectangleRepresentationType.CENTER_WIDTH_HEIGHT: polygon_data = cls.__stub.Render( rectangle_pb2.RectanglePolygonDataMessage( - center_x=messages.value_message(x_lower_left_or_center_x), - center_y=messages.value_message(y_lower_left_or_center_y), - width=messages.value_message(x_upper_right_or_width), - height=messages.value_message(y_upper_right_or_height), - corner_radius=messages.value_message(corner_radius), - rotation=messages.value_message(rotation), + center_x=value_message(x_lower_left_or_center_x), + center_y=value_message(y_lower_left_or_center_y), + width=value_message(x_upper_right_or_width), + height=value_message(y_upper_right_or_height), + corner_radius=value_message(corner_radius), + rotation=value_message(rotation), ishole=is_hole, ) ) @@ -594,17 +610,17 @@ def create(cls, layout, layer, net, center_x, center_y, radius): cls.__stub.Create( circle_pb2.CircleCreationMessage( layout=layout.msg, - layer=messages.layer_ref_message(layer), - net=messages.net_ref_message(net), - center_x=messages.value_message(center_x), - center_y=messages.value_message(center_y), - radius=messages.value_message(radius), + layer=layer_ref_message(layer), + net=net_ref_message(net), + center_x=value_message(center_x), + center_y=value_message(center_y), + radius=value_message(radius), ) ) ) @classmethod - @parser.to_polygon_data + @to_polygon_data def render(cls, center_x, center_y, radius, is_hole): """Render a circle. @@ -626,9 +642,9 @@ def render(cls, center_x, center_y, radius, is_hole): """ return cls.__stub.Render( circle_pb2.CircleRenderMessage( - center_x=messages.value_message(center_x), - center_y=messages.value_message(center_y), - radius=messages.value_message(radius), + center_x=value_message(center_x), + center_y=value_message(center_y), + radius=value_message(radius), is_hole=is_hole, ) ) @@ -677,9 +693,9 @@ def set_parameters(self, center_x, center_y, radius): circle_pb2.SetCircleParametersMessage( target=self.msg, parameters=circle_pb2.CircleParametersMessage( - center_x=messages.value_message(center_x), - center_y=messages.value_message(center_y), - radius=messages.value_message(radius), + center_x=value_message(center_x), + center_y=value_message(center_y), + radius=value_message(radius), ), ) ) @@ -724,9 +740,9 @@ def create(cls, layout, layer, center_x, center_y, text): cls.__stub.Create( text_pb2.TextCreationMessage( layout=layout.msg, - layer=messages.layer_ref_message(layer), - center_x=messages.value_message(center_x), - center_y=messages.value_message(center_y), + layer=layer_ref_message(layer), + center_x=value_message(center_x), + center_y=value_message(center_y), text=text, ) ) @@ -775,8 +791,8 @@ def set_text_data(self, center_x, center_y, text): text_pb2.SetTextDataMessage( target=self.msg, data=text_pb2.TextDataMessage( - center_x=messages.value_message(center_x), - center_y=messages.value_message(center_y), + center_x=value_message(center_x), + center_y=value_message(center_y), text=text, ), ) @@ -788,9 +804,9 @@ class _PolygonQueryBuilder: def create(layout, layer, net, points): return polygon_pb2.PolygonCreationMessage( layout=layout.msg, - layer=messages.layer_ref_message(layer), - net=messages.net_ref_message(net), - points=messages.polygon_data_message(points), + layer=layer_ref_message(layer), + net=net_ref_message(net), + points=polygon_data_message(points), ) @@ -824,7 +840,7 @@ def create(cls, layout, layer, net, polygon_data): ) @property - @parser.to_polygon_data + @to_polygon_data def polygon_data(self): """:class:`PolygonData `: Outer contour of the Polygon object.""" return self.__stub.GetPolygonData(self.msg) @@ -832,9 +848,7 @@ def polygon_data(self): @polygon_data.setter def polygon_data(self, poly): self.__stub.SetPolygonData( - polygon_pb2.SetPolygonDataMessage( - target=self.msg, poly=messages.polygon_data_message(poly) - ) + polygon_pb2.SetPolygonDataMessage(target=self.msg, poly=polygon_data_message(poly)) ) @property @@ -851,13 +865,13 @@ class _PathQueryBuilder: def create(layout, layer, net, width, end_cap1, end_cap2, corner, points): return path_pb2.PathCreationMessage( layout=layout.msg, - layer=messages.layer_ref_message(layer), - net=messages.net_ref_message(net), - width=messages.value_message(width), + layer=layer_ref_message(layer), + net=net_ref_message(net), + width=value_message(width), end_cap1=end_cap1.value, end_cap2=end_cap2.value, corner=corner.value, - points=messages.polygon_data_message(points), + points=polygon_data_message(points), ) @@ -903,7 +917,7 @@ def create(cls, layout, layer, net, width, end_cap1, end_cap2, corner_style, poi ) @classmethod - @parser.to_polygon_data + @to_polygon_data def render(cls, width, end_cap1, end_cap2, corner_style, path): """Render a Path object. @@ -927,16 +941,16 @@ def render(cls, width, end_cap1, end_cap2, corner_style, path): """ return cls.__stub.Render( path_pb2.PathRenderMessage( - width=messages.value_message(width), + width=value_message(width), end_cap1=end_cap1.value, end_cap2=end_cap2.value, corner_style=corner_style.value, - path=messages.polygon_data_message(path), + path=polygon_data_message(path), ) ) @property - @parser.to_polygon_data + @to_polygon_data def center_line(self): """:class:`PolygonData `: Center line for this Path.""" return self.__stub.GetCenterLine(self.msg) @@ -944,7 +958,7 @@ def center_line(self): @center_line.setter def center_line(self, center_line): path_pb2.SetCenterLineMessage( - target=self.msg, center_line=messages.polygon_data_message(center_line) + target=self.msg, center_line=polygon_data_message(center_line) ) def get_end_cap_style(self): @@ -1004,7 +1018,7 @@ def get_clip_info(self): """ clip_info_msg = self.__stub.GetClipInfo(self.msg) return ( - parser.to_polygon_data(clip_info_msg.clipping_poly), + to_polygon_data(clip_info_msg.clipping_poly), clip_info_msg.keep_inside, ) @@ -1021,7 +1035,7 @@ def set_clip_info(self, clipping_poly, keep_inside=True): self.__stub.SetClipInfo( path_pb2.SetClipInfoMessage( target=self.msg, - clipping_poly=messages.polygon_data_message(clipping_poly), + clipping_poly=polygon_data_message(clipping_poly), keep_inside=keep_inside, ) ) @@ -1050,7 +1064,7 @@ def width(self, width): self.__stub.SetWidth( path_pb2.SetWidthMessage( target=self.msg, - width=path_pb2.WidthMessage(width=messages.value_message(width)), + width=path_pb2.WidthMessage(width=value_message(width)), ) ) @@ -1064,9 +1078,7 @@ def miter_ratio(self, miter_ratio): self.__stub.SetMiterRatio( path_pb2.SetMiterRatioMessage( target=self.msg, - miter_ratio=path_pb2.MiterRatioMessage( - miter_ratio=messages.value_message(miter_ratio) - ), + miter_ratio=path_pb2.MiterRatioMessage(miter_ratio=value_message(miter_ratio)), ) ) @@ -1100,20 +1112,20 @@ def create( ): return bondwire_pb2.BondwireCreateMessage( layout=layout.msg, - net=messages.net_ref_message(net), + net=net_ref_message(net), bondwire_type=bondwire_type.value, definition_name=definition_name, placement_layer=placement_layer, - width=messages.value_message(width), + width=value_message(width), material=material, - start_context=messages.edb_obj_message(start_context), + start_context=edb_obj_message(start_context), start_layer_name=start_layer_name, - start_x=messages.value_message(start_x), - start_y=messages.value_message(start_y), - end_context=messages.edb_obj_message(end_context), + start_x=value_message(start_x), + start_y=value_message(start_y), + end_context=edb_obj_message(end_context), end_layer_name=end_layer_name, - end_x=messages.value_message(end_x), - end_y=messages.value_message(end_y), + end_x=value_message(end_x), + end_y=value_message(end_y), ) @staticmethod @@ -1140,9 +1152,7 @@ def set_cross_section_type_message(b, bondwire_cross_section_type): @staticmethod def set_cross_section_height_message(b, height): - return bondwire_pb2.SetCrossSectionHeightMessage( - target=b.msg, height=messages.value_message(height) - ) + return bondwire_pb2.SetCrossSectionHeightMessage(target=b.msg, height=value_message(height)) @staticmethod def set_definition_name_message(b, definition_name): @@ -1151,7 +1161,7 @@ def set_definition_name_message(b, definition_name): @staticmethod def get_elevation_message(b, cell_instance): return bondwire_pb2.GetElevationMessage( - bw=b.msg, cell_instance=messages.edb_obj_message(cell_instance) + bw=b.msg, cell_instance=edb_obj_message(cell_instance) ) @staticmethod @@ -1162,15 +1172,15 @@ def set_elevation_message(b, cell_instance, lyrname): @staticmethod def bondwire_value_message(b, value): - return bondwire_pb2.BondwireValueMessage(target=b.msg, value=messages.value_message(value)) + return bondwire_pb2.BondwireValueMessage(target=b.msg, value=value_message(value)) @staticmethod def bondwire_traj_message(x1, y1, y2, x2): return bondwire_pb2.BondwireTrajMessage( - x1=messages.value_message(x1), - y1=messages.value_message(y1), - x2=messages.value_message(x2), - y2=messages.value_message(y2), + x1=value_message(x1), + y1=value_message(y1), + x2=value_message(x2), + y2=value_message(y2), ) @staticmethod @@ -1495,22 +1505,22 @@ def create_message( net=net.msg, name=name, padstack_def=padstack_def.msg, - rotation=messages.value_message(rotation), + rotation=value_message(rotation), top_layer=top_layer.msg, bottom_layer=bottom_layer.msg, - solder_ball_layer=messages.edb_obj_message(solder_ball_layer), - layer_map=messages.edb_obj_message(layer_map), + solder_ball_layer=edb_obj_message(solder_ball_layer), + layer_map=edb_obj_message(layer_map), ) @staticmethod def set_name_message(padstack_inst, name): - return messages.edb_obj_name_message(padstack_inst, name) + return edb_obj_name_message(padstack_inst, name) @staticmethod def position_and_rotation_message(x, y, rotation): return padstack_instance_pb2.PadstackInstPositionAndRotationMessage( - position=messages.point_message((x, y)), - rotation=messages.value_message(rotation), + position=point_message((x, y)), + rotation=value_message(rotation), ) @staticmethod @@ -1545,22 +1555,22 @@ def set_solderball_layer_message(padstack_inst, solderball_layer): def back_drill_message(padstack_inst, from_bottom): return padstack_instance_pb2.PadstackInstBackDrillByLayerMessage( target=padstack_inst.msg, - from_bottom=messages.bool_message(from_bottom), + from_bottom=bool_message(from_bottom), ) @staticmethod def back_drill_by_layer_message(drill_to_layer, diameter, offset): return padstack_instance_pb2.PadstackInstBackDrillByLayerMessage( drill_to_layer=drill_to_layer.msg, - diameter=messages.value_message(diameter), - offset=messages.value_message(offset), + diameter=value_message(diameter), + offset=value_message(offset), ) @staticmethod def back_drill_by_depth_message(drill_depth, diameter): return padstack_instance_pb2.PadstackInstBackDrillByDepthMessage( - drill_depth=messages.value_message(drill_depth), - diameter=messages.value_message(diameter), + drill_depth=value_message(drill_depth), + diameter=value_message(diameter), ) @staticmethod @@ -1570,8 +1580,8 @@ def set_back_drill_by_layer_message( return padstack_instance_pb2.PadstackInstSetBackDrillByLayerMessage( target=padstack_inst.msg, drill_to_layer=drill_to_layer.msg, - offset=messages.value_message(offset), - diameter=messages.value_message(diameter), + offset=value_message(offset), + diameter=value_message(diameter), from_bottom=from_bottom, ) @@ -1579,8 +1589,8 @@ def set_back_drill_by_layer_message( def set_back_drill_by_depth_message(padstack_inst, drill_depth, diameter, from_bottom): return padstack_instance_pb2.PadstackInstSetBackDrillByDepthMessage( target=padstack_inst.msg, - drill_depth=messages.value_message(drill_depth), - diameter=messages.value_message(diameter), + drill_depth=value_message(drill_depth), + diameter=value_message(diameter), from_bottom=from_bottom, ) @@ -1588,7 +1598,7 @@ def set_back_drill_by_depth_message(padstack_inst, drill_depth, diameter, from_b def hole_overrides_message(is_hole_override, hole_override): return padstack_instance_pb2.PadstackInstHoleOverridesMessage( is_hole_override=is_hole_override, - hole_override=messages.value_message(hole_override), + hole_override=value_message(hole_override), ) @staticmethod @@ -1801,7 +1811,7 @@ def layer_map(self): @layer_map.setter def layer_map(self, layer_map): - self.__stub.SetLayerMap(messages.pointer_property_message(self, layer_map)) + self.__stub.SetLayerMap(pointer_property_message(self, layer_map)) def get_hole_overrides(self): """Get the hole overrides of Padstack Instance. @@ -2039,9 +2049,9 @@ def create(cls, layout, zone_prim, bend_middle, bend_radius, bend_angle): board_bend_def_pb2.BoardBendDefCreateMessage( layout=layout.msg, zone_prim=zone_prim.msg, - middle=messages.point_pair_message(bend_middle), - radius=messages.value_message(bend_radius), - angle=messages.value_message(bend_angle), + middle=point_pair_message(bend_middle), + radius=value_message(bend_radius), + angle=value_message(bend_angle), ) ) ) @@ -2055,14 +2065,14 @@ def boundary_primitive(self): return Primitive(self.__stub.GetBoundaryPrim(self.msg)).cast() @property - @parser.to_point_data_pair + @to_point_data_pair def bend_middle(self): """:term:`PointDataTuple`: Tuple of the bend middle starting and ending points.""" return self.__stub.GetBendMiddle(self.msg) @bend_middle.setter def bend_middle(self, bend_middle): - self.__stub.SetBendMiddle(messages.point_pair_property_message(self, bend_middle)) + self.__stub.SetBendMiddle(point_pair_property_message(self, bend_middle)) @property def radius(self): @@ -2071,7 +2081,7 @@ def radius(self): @radius.setter def radius(self, val): - self.__stub.SetRadius(messages.value_property_message(self, val)) + self.__stub.SetRadius(value_property_message(self, val)) @property def angle(self): @@ -2080,10 +2090,10 @@ def angle(self): @angle.setter def angle(self, val): - self.__stub.SetAngle(messages.value_property_message(self, val)) + self.__stub.SetAngle(value_property_message(self, val)) @property - @parser.to_polygon_data_list + @to_polygon_data_list def bent_regions(self): """:obj:`list` of :class:`PolygonData `: Bent region polygons. diff --git a/src/ansys/edb/core/simulation_setup/hfss_simulation_settings.py b/src/ansys/edb/core/simulation_setup/hfss_simulation_settings.py index 5d2fcf65cc..68ba71ce53 100644 --- a/src/ansys/edb/core/simulation_setup/hfss_simulation_settings.py +++ b/src/ansys/edb/core/simulation_setup/hfss_simulation_settings.py @@ -4,7 +4,20 @@ import ansys.api.edb.v1.hfss_simulation_settings_pb2 as pb -from ansys.edb.core.inner import messages, parser +from ansys.edb.core.inner.messages import ( + bool_property_message, + broadband_solution_msg, + double_property_message, + int_property_message, + multi_frequency_adaptive_solution_msg, + single_frequency_adaptive_solution_msg, + string_property_message, +) +from ansys.edb.core.inner.parser import ( + to_broadband_adaptive_solution, + to_multi_frequency_adaptive_solution, + to_single_frequency_adaptive_solution, +) from ansys.edb.core.session import ( DCRSettingsServiceStub, HFSSAdvancedMeshingSettingsServiceStub, @@ -113,7 +126,7 @@ class HFSSGeneralSettings(SimulationSettingsBase): @property def single_frequency_adaptive_solution(self): """:class:`SingleFrequencyAdaptiveSolution`: Single frequency adaptive solution settings.""" - return parser.to_single_frequency_adaptive_solution( + return to_single_frequency_adaptive_solution( self.__stub.GetSingleFrequencyAdaptiveSolution(self.msg) ) @@ -122,7 +135,7 @@ def single_frequency_adaptive_solution(self, single_frequency_adaptive_solution) self.__stub.SetSingleFrequencyAdaptiveSolution( pb.SingleFrequencyAdaptiveSolutionPropertyMessage( target=self.msg, - adaptive_frequency=messages.single_frequency_adaptive_solution_msg( + adaptive_frequency=single_frequency_adaptive_solution_msg( single_frequency_adaptive_solution ), ) @@ -131,7 +144,7 @@ def single_frequency_adaptive_solution(self, single_frequency_adaptive_solution) @property def multi_frequency_adaptive_solution(self): """:class:`MultiFrequencyAdaptiveSolution`: Multi-frequency adaptive solution settings.""" - return parser.to_multi_frequency_adaptive_solution( + return to_multi_frequency_adaptive_solution( self.__stub.GetMultiFrequencyAdaptiveSolution(self.msg) ) @@ -140,7 +153,7 @@ def multi_frequency_adaptive_solution(self, multi_frequency_adaptive_solution): self.__stub.SetMultiFrequencyAdaptiveSolution( pb.MultiFrequencyAdaptiveSolutionPropertyMessage( target=self.msg, - adaptive_frequency=messages.multi_frequency_adaptive_solution_msg( + adaptive_frequency=multi_frequency_adaptive_solution_msg( multi_frequency_adaptive_solution ), ) @@ -149,7 +162,7 @@ def multi_frequency_adaptive_solution(self, multi_frequency_adaptive_solution): @property def broadband_adaptive_solution(self): """:class:`BroadbandAdaptiveSolution`: Broadband adaptive solution settings.""" - return parser.to_broadband_adaptive_solution( + return to_broadband_adaptive_solution( self.__stub.GetBroadbandFrequencyAdaptiveSolution(self.msg) ) @@ -158,7 +171,7 @@ def broadband_adaptive_solution(self, broadband_adaptive_solution): self.__stub.SetBroadbandFrequencyAdaptiveSolution( pb.BroadbandFrequencyAdaptiveSolutionPropertyMessage( target=self.msg, - adaptive_frequency=messages.broadband_solution_msg(broadband_adaptive_solution), + adaptive_frequency=broadband_solution_msg(broadband_adaptive_solution), ) ) @@ -180,7 +193,7 @@ def save_fields(self): @save_fields.setter def save_fields(self, save_fields): - self.__stub.SetSaveFieldsFlag(messages.bool_property_message(self, save_fields)) + self.__stub.SetSaveFieldsFlag(bool_property_message(self, save_fields)) @property def save_rad_fields_only(self): @@ -189,9 +202,7 @@ def save_rad_fields_only(self): @save_rad_fields_only.setter def save_rad_fields_only(self, save_rad_fields_only): - self.__stub.SetSaveRadFieldsOnlyFlag( - messages.bool_property_message(self, save_rad_fields_only) - ) + self.__stub.SetSaveRadFieldsOnlyFlag(bool_property_message(self, save_rad_fields_only)) @property def use_mesh_region(self): @@ -200,7 +211,7 @@ def use_mesh_region(self): @use_mesh_region.setter def use_mesh_region(self, use_mesh_region): - self.__stub.SetUseMeshRegion(messages.bool_property_message(self, use_mesh_region)) + self.__stub.SetUseMeshRegion(bool_property_message(self, use_mesh_region)) @property def mesh_region_name(self): @@ -209,7 +220,7 @@ def mesh_region_name(self): @mesh_region_name.setter def mesh_region_name(self, mesh_region_name): - self.__stub.SetMeshRegionName(messages.string_property_message(self, mesh_region_name)) + self.__stub.SetMeshRegionName(string_property_message(self, mesh_region_name)) @property def use_parallel_refinement(self): @@ -218,9 +229,7 @@ def use_parallel_refinement(self): @use_parallel_refinement.setter def use_parallel_refinement(self, use_parallel_refinement): - self.__stub.SetUseParallelRefinement( - messages.bool_property_message(self, use_parallel_refinement) - ) + self.__stub.SetUseParallelRefinement(bool_property_message(self, use_parallel_refinement)) class HFSSSettingsOptions(SettingsOptions): @@ -235,7 +244,7 @@ def use_max_refinement(self): @use_max_refinement.setter def use_max_refinement(self, use_max_refinement): - self.__stub.SetUseMaxRefinement(messages.bool_property_message(self, use_max_refinement)) + self.__stub.SetUseMaxRefinement(bool_property_message(self, use_max_refinement)) @property def max_refinement_per_pass(self): @@ -244,9 +253,7 @@ def max_refinement_per_pass(self): @max_refinement_per_pass.setter def max_refinement_per_pass(self, max_refinement_per_pass): - self.__stub.SetMaxRefinementPerPass( - messages.int_property_message(self, max_refinement_per_pass) - ) + self.__stub.SetMaxRefinementPerPass(int_property_message(self, max_refinement_per_pass)) @property def min_passes(self): @@ -255,7 +262,7 @@ def min_passes(self): @min_passes.setter def min_passes(self, min_refinement_passes): - self.__stub.SetMinPasses(messages.int_property_message(self, min_refinement_passes)) + self.__stub.SetMinPasses(int_property_message(self, min_refinement_passes)) @property def min_converged_passes(self): @@ -264,9 +271,7 @@ def min_converged_passes(self): @min_converged_passes.setter def min_converged_passes(self, min_refinement_passes): - self.__stub.SetMinConvergedPasses( - messages.int_property_message(self, min_refinement_passes) - ) + self.__stub.SetMinConvergedPasses(int_property_message(self, min_refinement_passes)) @property def order_basis(self): @@ -299,7 +304,7 @@ def relative_residual(self): @relative_residual.setter def relative_residual(self, relative_residual): - self.__stub.SetRelativeResidual(messages.double_property_message(self, relative_residual)) + self.__stub.SetRelativeResidual(double_property_message(self, relative_residual)) @property def enhanced_low_frequency_accuracy(self): @@ -309,7 +314,7 @@ def enhanced_low_frequency_accuracy(self): @enhanced_low_frequency_accuracy.setter def enhanced_low_frequency_accuracy(self, enhanced_low_frequency_accuracy): self.__stub.SetEnhancedLowFrequencyAccuracy( - messages.bool_property_message(self, enhanced_low_frequency_accuracy) + bool_property_message(self, enhanced_low_frequency_accuracy) ) @@ -325,7 +330,7 @@ def max_delta_z0(self): @max_delta_z0.setter def max_delta_z0(self, max_delta_z0): - self.__stub.SetMaxDeltaZ0(messages.double_property_message(self, max_delta_z0)) + self.__stub.SetMaxDeltaZ0(double_property_message(self, max_delta_z0)) @property def set_triangles_for_wave_port(self): @@ -335,7 +340,7 @@ def set_triangles_for_wave_port(self): @set_triangles_for_wave_port.setter def set_triangles_for_wave_port(self, set_triangles_for_wave_port): self.__stub.SetSetTrianglesForWaveport( - messages.bool_property_message(self, set_triangles_for_wave_port) + bool_property_message(self, set_triangles_for_wave_port) ) @property @@ -346,7 +351,7 @@ def min_triangles_for_wave_port(self): @min_triangles_for_wave_port.setter def min_triangles_for_wave_port(self, min_triangles_for_wave_port): self.__stub.SetMinTrianglesForWavePort( - messages.int_property_message(self, min_triangles_for_wave_port) + int_property_message(self, min_triangles_for_wave_port) ) @property @@ -357,7 +362,7 @@ def max_triangles_for_wave_port(self): @max_triangles_for_wave_port.setter def max_triangles_for_wave_port(self, max_triangles_for_wave_port): self.__stub.SetMaxTrianglesForWavePort( - messages.int_property_message(self, max_triangles_for_wave_port) + int_property_message(self, max_triangles_for_wave_port) ) @property @@ -368,7 +373,7 @@ def enable_intra_plane_coupling(self): @enable_intra_plane_coupling.setter def enable_intra_plane_coupling(self, enable_intra_plane_coupling): self.__stub.SetIntraPlaneCouplingEnabled( - messages.bool_property_message(self, enable_intra_plane_coupling) + bool_property_message(self, enable_intra_plane_coupling) ) @@ -384,9 +389,7 @@ def ic_mode_auto_resolution(self): @ic_mode_auto_resolution.setter def ic_mode_auto_resolution(self, ic_mode_auto_resolution): - self.__stub.SetICModeAutoResolution( - messages.bool_property_message(self, ic_mode_auto_resolution) - ) + self.__stub.SetICModeAutoResolution(bool_property_message(self, ic_mode_auto_resolution)) @property def ic_mode_length(self): @@ -395,7 +398,7 @@ def ic_mode_length(self): @ic_mode_length.setter def ic_mode_length(self, ic_mode_length): - self.__stub.SetICModeLength(messages.string_property_message(self, ic_mode_length)) + self.__stub.SetICModeLength(string_property_message(self, ic_mode_length)) class HFSSAdvancedMeshingSettings(AdvancedMeshingSettings): @@ -415,7 +418,7 @@ def layer_snap_tol(self): @layer_snap_tol.setter def layer_snap_tol(self, layer_snap_tol): - self.__stub.SetLayerAlignment(messages.string_property_message(self, layer_snap_tol)) + self.__stub.SetLayerAlignment(string_property_message(self, layer_snap_tol)) class HFSSDCRSettings(SimulationSettingsBase): @@ -430,7 +433,7 @@ def max_passes(self): @max_passes.setter def max_passes(self, max_passes): - self.__stub.SetMaxPasses(messages.int_property_message(self, max_passes)) + self.__stub.SetMaxPasses(int_property_message(self, max_passes)) @property def min_passes(self): @@ -439,7 +442,7 @@ def min_passes(self): @min_passes.setter def min_passes(self, min_passes): - self.__stub.SetMinPasses(messages.int_property_message(self, min_passes)) + self.__stub.SetMinPasses(int_property_message(self, min_passes)) @property def min_converged_passes(self): @@ -448,7 +451,7 @@ def min_converged_passes(self): @min_converged_passes.setter def min_converged_passes(self, min_converged_passes): - self.__stub.SetMinConvergedPasses(messages.int_property_message(self, min_converged_passes)) + self.__stub.SetMinConvergedPasses(int_property_message(self, min_converged_passes)) @property def percent_error(self): @@ -457,7 +460,7 @@ def percent_error(self): @percent_error.setter def percent_error(self, percent_error): - self.__stub.SetPercentError(messages.double_property_message(self, percent_error)) + self.__stub.SetPercentError(double_property_message(self, percent_error)) @property def percent_refinement_per_pass(self): @@ -467,5 +470,5 @@ def percent_refinement_per_pass(self): @percent_refinement_per_pass.setter def percent_refinement_per_pass(self, percent_refinement_per_pass): self.__stub.SetPercentRefinementPerPass( - messages.double_property_message(self, percent_refinement_per_pass) + double_property_message(self, percent_refinement_per_pass) ) diff --git a/src/ansys/edb/core/simulation_setup/hfss_simulation_setup.py b/src/ansys/edb/core/simulation_setup/hfss_simulation_setup.py index f8872aa52d..16e8fd4d3f 100644 --- a/src/ansys/edb/core/simulation_setup/hfss_simulation_setup.py +++ b/src/ansys/edb/core/simulation_setup/hfss_simulation_setup.py @@ -2,7 +2,8 @@ import ansys.api.edb.v1.hfss_simulation_setup_pb2 as pb -from ansys.edb.core.inner import messages, parser +from ansys.edb.core.inner.messages import mesh_operation_message +from ansys.edb.core.inner.parser import to_mesh_op from ansys.edb.core.inner.utils import map_list from ansys.edb.core.session import HfssSimulationSetupServiceStub, StubAccessor, StubType from ansys.edb.core.simulation_setup.hfss_simulation_settings import HFSSSimulationSettings @@ -35,7 +36,7 @@ def create(cls, cell, name): @property def mesh_operations(self): """:obj:`list` of :class:`MeshOperation`: Mesh operations of the hfss simulation setup.""" - return map_list(self.__stub.GetMeshOperations(self.msg).mesh_ops, parser.to_mesh_op) + return map_list(self.__stub.GetMeshOperations(self.msg).mesh_ops, to_mesh_op) @mesh_operations.setter def mesh_operations(self, new_mesh_ops): @@ -43,7 +44,7 @@ def mesh_operations(self, new_mesh_ops): pb.MeshOperationsPropertyMessage( target=self.msg, mesh_ops=pb.MeshOperationsMessage( - mesh_ops=map_list(new_mesh_ops, messages.mesh_operation_message) + mesh_ops=map_list(new_mesh_ops, mesh_operation_message) ), ) ) diff --git a/src/ansys/edb/core/simulation_setup/raptor_x_simulation_settings.py b/src/ansys/edb/core/simulation_setup/raptor_x_simulation_settings.py index 511614bc3b..d3802fe02a 100644 --- a/src/ansys/edb/core/simulation_setup/raptor_x_simulation_settings.py +++ b/src/ansys/edb/core/simulation_setup/raptor_x_simulation_settings.py @@ -2,7 +2,13 @@ import ansys.api.edb.v1.raptor_x_simulation_settings_pb2 as pb -from ansys.edb.core.inner import messages +from ansys.edb.core.inner.messages import ( + bool_property_message, + double_property_message, + int_property_message, + string_property_message, + strings_message, +) from ansys.edb.core.session import ( RaptorXAdvancedSettingsServiceStub, RaptorXGeneralSettingsServiceStub, @@ -16,9 +22,7 @@ def _translate_options_dictionary(dictionary): - return { - key: messages.strings_message([val for val in vals]) for (key, vals) in dictionary.items() - } + return {key: strings_message([val for val in vals]) for (key, vals) in dictionary.items()} def _to_options_dict(msg): @@ -29,10 +33,7 @@ def _to_raptor_x_sim_settings_options_property_msg(obj, options): return pb.RaptorXSimSettingsOptionsPropertyMessage( target=obj.msg, value=pb.RaptorXSimSettingsOptionsMessage( - options={ - key: messages.strings_message([val for val in vals]) - for (key, vals) in options.items() - } + options={key: strings_message([val for val in vals]) for (key, vals) in options.items()} ), ) @@ -63,7 +64,7 @@ def use_gold_em_solver(self): @use_gold_em_solver.setter def use_gold_em_solver(self, use_gold_em_solver): - self.__stub.SetUseGoldEMSolver(messages.bool_property_message(self, use_gold_em_solver)) + self.__stub.SetUseGoldEMSolver(bool_property_message(self, use_gold_em_solver)) @property def max_frequency(self): @@ -72,7 +73,7 @@ def max_frequency(self): @max_frequency.setter def max_frequency(self, max_frequency): - self.__stub.SetMaxFrequency(messages.string_property_message(self, max_frequency)) + self.__stub.SetMaxFrequency(string_property_message(self, max_frequency)) @property def global_temperature(self): @@ -81,7 +82,7 @@ def global_temperature(self): @global_temperature.setter def global_temperature(self, global_temperature): - self.__stub.SetGlobalTemperature(messages.double_property_message(self, global_temperature)) + self.__stub.SetGlobalTemperature(double_property_message(self, global_temperature)) @property def save_netlist(self): @@ -90,7 +91,7 @@ def save_netlist(self): @save_netlist.setter def save_netlist(self, save_netlist): - self.__stub.SetSaveNetlist(messages.bool_property_message(self, save_netlist)) + self.__stub.SetSaveNetlist(bool_property_message(self, save_netlist)) @property def netlist_export_spectre(self): @@ -99,9 +100,7 @@ def netlist_export_spectre(self): @netlist_export_spectre.setter def netlist_export_spectre(self, netlist_export_spectre): - self.__stub.SetNetlistExportSpectre( - messages.bool_property_message(self, netlist_export_spectre) - ) + self.__stub.SetNetlistExportSpectre(bool_property_message(self, netlist_export_spectre)) @property def save_rfm(self): @@ -110,7 +109,7 @@ def save_rfm(self): @save_rfm.setter def save_rfm(self, save_rfm): - self.__stub.SetSaveRFM(messages.bool_property_message(self, save_rfm)) + self.__stub.SetSaveRFM(bool_property_message(self, save_rfm)) class RaptorXAdvancedSettings(SimulationSettingsBase): @@ -125,7 +124,7 @@ def use_mesh_frequency(self): @use_mesh_frequency.setter def use_mesh_frequency(self, use_mesh_frequency): - self.__stub.SetUseMeshFrequency(messages.bool_property_message(self, use_mesh_frequency)) + self.__stub.SetUseMeshFrequency(bool_property_message(self, use_mesh_frequency)) @property def mesh_frequency(self): @@ -134,7 +133,7 @@ def mesh_frequency(self): @mesh_frequency.setter def mesh_frequency(self, mesh_frequency): - self.__stub.SetMeshFrequency(messages.string_property_message(self, mesh_frequency)) + self.__stub.SetMeshFrequency(string_property_message(self, mesh_frequency)) @property def use_edge_mesh(self): @@ -143,7 +142,7 @@ def use_edge_mesh(self): @use_edge_mesh.setter def use_edge_mesh(self, use_edge_mesh): - self.__stub.SetUseEdgeMesh(messages.bool_property_message(self, use_edge_mesh)) + self.__stub.SetUseEdgeMesh(bool_property_message(self, use_edge_mesh)) @property def edge_mesh(self): @@ -152,7 +151,7 @@ def edge_mesh(self): @edge_mesh.setter def edge_mesh(self, edge_mesh): - self.__stub.SetEdgeMesh(messages.string_property_message(self, edge_mesh)) + self.__stub.SetEdgeMesh(string_property_message(self, edge_mesh)) @property def use_cells_per_wavelength(self): @@ -161,9 +160,7 @@ def use_cells_per_wavelength(self): @use_cells_per_wavelength.setter def use_cells_per_wavelength(self, use_cells_per_wavelength): - self.__stub.SetUseCellsPerWavelength( - messages.bool_property_message(self, use_cells_per_wavelength) - ) + self.__stub.SetUseCellsPerWavelength(bool_property_message(self, use_cells_per_wavelength)) @property def cells_per_wavelength(self): @@ -172,7 +169,7 @@ def cells_per_wavelength(self): @cells_per_wavelength.setter def cells_per_wavelength(self, cells_per_wavelength): - self.__stub.SetCellsPerWavelength(messages.int_property_message(self, cells_per_wavelength)) + self.__stub.SetCellsPerWavelength(int_property_message(self, cells_per_wavelength)) @property def use_plane_projection_factor(self): @@ -182,7 +179,7 @@ def use_plane_projection_factor(self): @use_plane_projection_factor.setter def use_plane_projection_factor(self, use_plane_projection_factor): self.__stub.SetUsePlaneProjectionFactor( - messages.bool_property_message(self, use_plane_projection_factor) + bool_property_message(self, use_plane_projection_factor) ) @property @@ -192,9 +189,7 @@ def plane_projection_factor(self): @plane_projection_factor.setter def plane_projection_factor(self, plane_projection_factor): - self.__stub.SetPlaneProjectionFactor( - messages.double_property_message(self, plane_projection_factor) - ) + self.__stub.SetPlaneProjectionFactor(double_property_message(self, plane_projection_factor)) @property def use_relaxed_z_axis(self): @@ -203,7 +198,7 @@ def use_relaxed_z_axis(self): @use_relaxed_z_axis.setter def use_relaxed_z_axis(self, use_relaxed_z_axis): - self.__stub.SetUseRelaxedZAxis(messages.bool_property_message(self, use_relaxed_z_axis)) + self.__stub.SetUseRelaxedZAxis(bool_property_message(self, use_relaxed_z_axis)) @property def use_eliminate_slit_per_holes(self): @@ -213,7 +208,7 @@ def use_eliminate_slit_per_holes(self): @use_eliminate_slit_per_holes.setter def use_eliminate_slit_per_holes(self, use_eliminate_slit_per_holes): self.__stub.SetUseEliminateSlitPerHoles( - messages.bool_property_message(self, use_eliminate_slit_per_holes) + bool_property_message(self, use_eliminate_slit_per_holes) ) @property @@ -224,7 +219,7 @@ def eliminate_slit_per_holes(self): @eliminate_slit_per_holes.setter def eliminate_slit_per_holes(self, eliminate_slit_per_holes): self.__stub.SetEliminateSlitPerHoles( - messages.double_property_message(self, eliminate_slit_per_holes) + double_property_message(self, eliminate_slit_per_holes) ) @property @@ -234,7 +229,7 @@ def use_arc_resolution(self): @use_arc_resolution.setter def use_arc_resolution(self, use_arc_resolution): - self.__stub.SetUseArcResolution(messages.bool_property_message(self, use_arc_resolution)) + self.__stub.SetUseArcResolution(bool_property_message(self, use_arc_resolution)) @property def arc_resolution(self): @@ -243,7 +238,7 @@ def arc_resolution(self): @arc_resolution.setter def arc_resolution(self, arc_resolution): - self.__stub.SetArcResolution(messages.string_property_message(self, arc_resolution)) + self.__stub.SetArcResolution(string_property_message(self, arc_resolution)) @property def use_auto_removal_sliver_poly(self): @@ -253,7 +248,7 @@ def use_auto_removal_sliver_poly(self): @use_auto_removal_sliver_poly.setter def use_auto_removal_sliver_poly(self, use_auto_removal_sliver_poly): self.__stub.SetUseAutoRemovalSliverPoly( - messages.bool_property_message(self, use_auto_removal_sliver_poly) + bool_property_message(self, use_auto_removal_sliver_poly) ) @property @@ -264,7 +259,7 @@ def auto_removal_sliver_poly(self): @auto_removal_sliver_poly.setter def auto_removal_sliver_poly(self, auto_removal_sliver_poly): self.__stub.SetAutoRemovalSliverPoly( - messages.double_property_message(self, auto_removal_sliver_poly) + double_property_message(self, auto_removal_sliver_poly) ) @property @@ -275,7 +270,7 @@ def use_accelerate_via_extraction(self): @use_accelerate_via_extraction.setter def use_accelerate_via_extraction(self, use_accelerate_via_extraction): self.__stub.SetUseAccelerateViaExtraction( - messages.bool_property_message(self, use_accelerate_via_extraction) + bool_property_message(self, use_accelerate_via_extraction) ) @property @@ -286,7 +281,7 @@ def use_enable_substrate_network_extraction(self): @use_enable_substrate_network_extraction.setter def use_enable_substrate_network_extraction(self, use_enable_substrate_network_extraction): self.__stub.SetUseEnableSubstrateNetworkExtraction( - messages.bool_property_message(self, use_enable_substrate_network_extraction) + bool_property_message(self, use_enable_substrate_network_extraction) ) @property @@ -296,7 +291,7 @@ def use_lde(self): @use_lde.setter def use_lde(self, use_lde): - self.__stub.SetUseLDE(messages.bool_property_message(self, use_lde)) + self.__stub.SetUseLDE(bool_property_message(self, use_lde)) @property def use_extract_floating_metals_dummy(self): @@ -306,7 +301,7 @@ def use_extract_floating_metals_dummy(self): @use_extract_floating_metals_dummy.setter def use_extract_floating_metals_dummy(self, use_extract_floating_metals_dummy): self.__stub.SetUseExtractFloatingMetalsDummy( - messages.bool_property_message(self, use_extract_floating_metals_dummy) + bool_property_message(self, use_extract_floating_metals_dummy) ) @property @@ -317,7 +312,7 @@ def use_extract_floating_metals_floating(self): @use_extract_floating_metals_floating.setter def use_extract_floating_metals_floating(self, use_extract_floating_metals_floating): self.__stub.SetUseExtractFloatingMetalsFloating( - messages.bool_property_message(self, use_extract_floating_metals_floating) + bool_property_message(self, use_extract_floating_metals_floating) ) @property @@ -328,7 +323,7 @@ def use_enable_etch_transform(self): @use_enable_etch_transform.setter def use_enable_etch_transform(self, use_enable_etch_transform): self.__stub.SetUseEnableEtchTransform( - messages.bool_property_message(self, use_enable_etch_transform) + bool_property_message(self, use_enable_etch_transform) ) @property @@ -339,7 +334,7 @@ def use_enable_hybrid_extraction(self): @use_enable_hybrid_extraction.setter def use_enable_hybrid_extraction(self, use_enable_hybrid_extraction): self.__stub.SetUseEnableHybridExtraction( - messages.bool_property_message(self, use_enable_hybrid_extraction) + bool_property_message(self, use_enable_hybrid_extraction) ) @property @@ -350,7 +345,7 @@ def use_enable_advanced_cap_effects(self): @use_enable_advanced_cap_effects.setter def use_enable_advanced_cap_effects(self, use_enable_advanced_cap_effects): self.__stub.SetUseEnableAdvancedCapEffects( - messages.bool_property_message(self, use_enable_advanced_cap_effects) + bool_property_message(self, use_enable_advanced_cap_effects) ) @property @@ -360,9 +355,7 @@ def use_override_shrink_factor(self): @use_override_shrink_factor.setter def use_override_shrink_factor(self, use_override_shrink_factor): - self.__stub.SetUseOverrideShrinkFac( - messages.bool_property_message(self, use_override_shrink_factor) - ) + self.__stub.SetUseOverrideShrinkFac(bool_property_message(self, use_override_shrink_factor)) @property def override_shrink_factor(self): @@ -371,9 +364,7 @@ def override_shrink_factor(self): @override_shrink_factor.setter def override_shrink_factor(self, override_shrink_factor): - self.__stub.SetOverrideShrinkFac( - messages.double_property_message(self, override_shrink_factor) - ) + self.__stub.SetOverrideShrinkFac(double_property_message(self, override_shrink_factor)) @property def advanced_options(self): diff --git a/src/ansys/edb/core/simulation_setup/simulation_settings.py b/src/ansys/edb/core/simulation_setup/simulation_settings.py index a33ad28e5f..b171b7b9dd 100644 --- a/src/ansys/edb/core/simulation_setup/simulation_settings.py +++ b/src/ansys/edb/core/simulation_setup/simulation_settings.py @@ -3,7 +3,12 @@ import ansys.api.edb.v1.simulation_settings_pb2 as pb -from ansys.edb.core.inner import messages +from ansys.edb.core.inner.messages import ( + bool_property_message, + double_property_message, + int_property_message, + string_property_message, +) from ansys.edb.core.session import ( AdvancedMeshingSettingsServiceStub, AdvancedSettingsServiceStub, @@ -60,7 +65,7 @@ def enabled(self): @enabled.setter def enabled(self, enabled): - self.__stub.SetEnabled(messages.bool_property_message(self, enabled)) + self.__stub.SetEnabled(bool_property_message(self, enabled)) class SettingsOptions(SimulationSettingsBase): @@ -75,7 +80,7 @@ def do_lamda_refine(self): @do_lamda_refine.setter def do_lamda_refine(self, do_lamda_refine): - self.__stub.SetDoLamdaRefineFlag(messages.bool_property_message(self, do_lamda_refine)) + self.__stub.SetDoLamdaRefineFlag(bool_property_message(self, do_lamda_refine)) @property def lamda_target(self): @@ -84,7 +89,7 @@ def lamda_target(self): @lamda_target.setter def lamda_target(self, lamda_target): - self.__stub.SetLamdaTarget(messages.double_property_message(self, lamda_target)) + self.__stub.SetLamdaTarget(double_property_message(self, lamda_target)) @property def use_default_lamda_value(self): @@ -93,7 +98,7 @@ def use_default_lamda_value(self): @use_default_lamda_value.setter def use_default_lamda_value(self, use_default_value): - self.__stub.SetDoLamdaRefineFlag(messages.bool_property_message(self, use_default_value)) + self.__stub.SetDoLamdaRefineFlag(bool_property_message(self, use_default_value)) class AdvancedSettings(SimulationSettingsBase): @@ -108,7 +113,7 @@ def union_polygons(self): @union_polygons.setter def union_polygons(self, union_polygons): - self.__stub.SetUnionPolygons(messages.bool_property_message(self, union_polygons)) + self.__stub.SetUnionPolygons(bool_property_message(self, union_polygons)) @property def use_defeature(self): @@ -117,7 +122,7 @@ def use_defeature(self): @use_defeature.setter def use_defeature(self, use_defeature): - self.__stub.SetUseDefeature(messages.bool_property_message(self, use_defeature)) + self.__stub.SetUseDefeature(bool_property_message(self, use_defeature)) @property def use_defeature_absolute_length(self): @@ -127,7 +132,7 @@ def use_defeature_absolute_length(self): @use_defeature_absolute_length.setter def use_defeature_absolute_length(self, use_defeature_absolute_length): self.__stub.SetUseDefeatureAbsoluteLength( - messages.bool_property_message(self, use_defeature_absolute_length) + bool_property_message(self, use_defeature_absolute_length) ) @property @@ -137,9 +142,7 @@ def remove_floating_geometry(self): @remove_floating_geometry.setter def remove_floating_geometry(self, remove_floating_geometry): - self.__stub.SetRemoveFloatingGeometry( - messages.bool_property_message(self, remove_floating_geometry) - ) + self.__stub.SetRemoveFloatingGeometry(bool_property_message(self, remove_floating_geometry)) @property def defeature_absolute_length(self): @@ -149,7 +152,7 @@ def defeature_absolute_length(self): @defeature_absolute_length.setter def defeature_absolute_length(self, defeature_absolute_length): self.__stub.SetDefeatureAbsoluteLength( - messages.string_property_message(self, defeature_absolute_length) + string_property_message(self, defeature_absolute_length) ) @property @@ -159,7 +162,7 @@ def defeature_ratio(self): @defeature_ratio.setter def defeature_ratio(self, defeature_ratio): - self.__stub.SetDefeatureRatio(messages.double_property_message(self, defeature_ratio)) + self.__stub.SetDefeatureRatio(double_property_message(self, defeature_ratio)) @property def small_void_area(self): @@ -168,7 +171,7 @@ def small_void_area(self): @small_void_area.setter def small_void_area(self, small_void_area): - self.__stub.SetSmallVoidArea(messages.double_property_message(self, small_void_area)) + self.__stub.SetSmallVoidArea(double_property_message(self, small_void_area)) @property def via_model_type(self): @@ -188,7 +191,7 @@ def num_via_sides(self): @num_via_sides.setter def num_via_sides(self, num_via_sides): - self.__stub.SetNumViaSides(messages.int_property_message(self, num_via_sides)) + self.__stub.SetNumViaSides(int_property_message(self, num_via_sides)) @property def num_via_density(self): @@ -197,7 +200,7 @@ def num_via_density(self): @num_via_density.setter def num_via_density(self, num_via_density): - self.__stub.SetViaDensity(messages.double_property_message(self, num_via_density)) + self.__stub.SetViaDensity(double_property_message(self, num_via_density)) @property def via_material(self): @@ -206,7 +209,7 @@ def via_material(self): @via_material.setter def via_material(self, via_material): - self.__stub.SetViaMaterial(messages.string_property_message(self, via_material)) + self.__stub.SetViaMaterial(string_property_message(self, via_material)) class AdvancedMeshingSettings(SimulationSettingsBase): @@ -221,7 +224,7 @@ def arc_step_size(self): @arc_step_size.setter def arc_step_size(self, arc_step_size): - self.__stub.SetArcStepSize(messages.string_property_message(self, arc_step_size)) + self.__stub.SetArcStepSize(string_property_message(self, arc_step_size)) @property def circle_start_azimuth(self): @@ -230,9 +233,7 @@ def circle_start_azimuth(self): @circle_start_azimuth.setter def circle_start_azimuth(self, circle_start_azimuth): - self.__stub.SetCircleStartAzimuth( - messages.string_property_message(self, circle_start_azimuth) - ) + self.__stub.SetCircleStartAzimuth(string_property_message(self, circle_start_azimuth)) @property def max_num_arc_points(self): @@ -241,7 +242,7 @@ def max_num_arc_points(self): @max_num_arc_points.setter def max_num_arc_points(self, max_num_arc_points): - self.__stub.SetMaxNumArcPoints(messages.int_property_message(self, max_num_arc_points)) + self.__stub.SetMaxNumArcPoints(int_property_message(self, max_num_arc_points)) @property def use_arc_chord_error_approx(self): @@ -251,7 +252,7 @@ def use_arc_chord_error_approx(self): @use_arc_chord_error_approx.setter def use_arc_chord_error_approx(self, use_arc_chord_error_approx): self.__stub.SetUseArcChordErrorApprox( - messages.bool_property_message(self, use_arc_chord_error_approx) + bool_property_message(self, use_arc_chord_error_approx) ) @property @@ -261,9 +262,7 @@ def arc_to_chord_error(self): @arc_to_chord_error.setter def arc_to_chord_error(self, arc_to_chord_error): - self.__stub.SetArcChordErrorApprox( - messages.string_property_message(self, arc_to_chord_error) - ) + self.__stub.SetArcChordErrorApprox(string_property_message(self, arc_to_chord_error)) class SolverSettings(SimulationSettingsBase): @@ -279,7 +278,7 @@ def thin_signal_layer_threshold(self): @thin_signal_layer_threshold.setter def thin_signal_layer_threshold(self, thin_signal_layer_threshold): self.__stub.SetThinSignalLayerThreshold( - messages.string_property_message(self, thin_signal_layer_threshold) + string_property_message(self, thin_signal_layer_threshold) ) @property @@ -290,5 +289,5 @@ def thin_dielectric_layer_threshold(self): @thin_dielectric_layer_threshold.setter def thin_dielectric_layer_threshold(self, thin_dielectric_layer_threshold): self.__stub.SetThinDielectricLayerThreshold( - messages.string_property_message(self, thin_dielectric_layer_threshold) + string_property_message(self, thin_dielectric_layer_threshold) ) diff --git a/src/ansys/edb/core/simulation_setup/simulation_setup.py b/src/ansys/edb/core/simulation_setup/simulation_setup.py index 890900bb7a..9f9b7bb344 100644 --- a/src/ansys/edb/core/simulation_setup/simulation_setup.py +++ b/src/ansys/edb/core/simulation_setup/simulation_setup.py @@ -10,8 +10,8 @@ SweepDataMessage, ) -from ansys.edb.core.inner import messages from ansys.edb.core.inner.base import ObjBase +from ansys.edb.core.inner.messages import int_property_message, string_property_message from ansys.edb.core.session import SimulationSetupServiceStub, StubAccessor, StubType @@ -119,7 +119,7 @@ def name(self): @name.setter def name(self, name): - self.__stub.SetName(messages.string_property_message(self, name)) + self.__stub.SetName(string_property_message(self, name)) @property def position(self): @@ -128,7 +128,7 @@ def position(self): @position.setter def position(self, position): - self.__stub.SetPosition(messages.int_property_message(self, position)) + self.__stub.SetPosition(int_property_message(self, position)) @property def sweep_data(self): diff --git a/src/ansys/edb/core/simulation_setup/siwave_dcir_simulation_settings.py b/src/ansys/edb/core/simulation_setup/siwave_dcir_simulation_settings.py index 1560e2d6de..a0d52b9e25 100644 --- a/src/ansys/edb/core/simulation_setup/siwave_dcir_simulation_settings.py +++ b/src/ansys/edb/core/simulation_setup/siwave_dcir_simulation_settings.py @@ -2,7 +2,7 @@ import ansys.api.edb.v1.siwave_dcir_simulation_settings_pb2 as pb -from ansys.edb.core.inner import messages +from ansys.edb.core.inner.messages import bool_property_message, string_property_message from ansys.edb.core.session import SIWaveDCIRSimulationSettingsServiceStub, StubAccessor, StubType from ansys.edb.core.simulation_setup.siwave_simulation_settings import SIWaveSimulationSettings @@ -21,7 +21,7 @@ def icepak_temp_file(self): @icepak_temp_file.setter def icepak_temp_file(self, icepak_temp_file): - self.__stub.SetIcepakTempFile(messages.string_property_message(self, icepak_temp_file)) + self.__stub.SetIcepakTempFile(string_property_message(self, icepak_temp_file)) @property def source_terms_to_ground(self): @@ -52,9 +52,7 @@ def export_dc_thermal_data(self): @export_dc_thermal_data.setter def export_dc_thermal_data(self, export_dc_thermal_data): - self.__stub.SetExportDCThermalData( - messages.bool_property_message(self, export_dc_thermal_data) - ) + self.__stub.SetExportDCThermalData(bool_property_message(self, export_dc_thermal_data)) @property def import_thermal_data(self): @@ -63,7 +61,7 @@ def import_thermal_data(self): @import_thermal_data.setter def import_thermal_data(self, import_thermal_data): - self.__stub.SetImportThermalData(messages.bool_property_message(self, import_thermal_data)) + self.__stub.SetImportThermalData(bool_property_message(self, import_thermal_data)) @property def full_dc_report_path(self): @@ -72,7 +70,7 @@ def full_dc_report_path(self): @full_dc_report_path.setter def full_dc_report_path(self, full_dc_report_path): - self.__stub.SetFullDCReportPath(messages.string_property_message(self, full_dc_report_path)) + self.__stub.SetFullDCReportPath(string_property_message(self, full_dc_report_path)) @property def via_report_path(self): @@ -81,7 +79,7 @@ def via_report_path(self): @via_report_path.setter def via_report_path(self, via_report_path): - self.__stub.SetViaReportPath(messages.string_property_message(self, via_report_path)) + self.__stub.SetViaReportPath(string_property_message(self, via_report_path)) @property def per_pin_res_path(self): @@ -90,7 +88,7 @@ def per_pin_res_path(self): @per_pin_res_path.setter def per_pin_res_path(self, per_pin_res_path): - self.__stub.SetPerPinResPath(messages.string_property_message(self, per_pin_res_path)) + self.__stub.SetPerPinResPath(string_property_message(self, per_pin_res_path)) @property def dc_report_config_file(self): @@ -99,9 +97,7 @@ def dc_report_config_file(self): @dc_report_config_file.setter def dc_report_config_file(self, dc_report_config_file): - self.__stub.SetDCReportConfigFile( - messages.string_property_message(self, dc_report_config_file) - ) + self.__stub.SetDCReportConfigFile(string_property_message(self, dc_report_config_file)) @property def dc_report_show_active_devices(self): @@ -111,7 +107,7 @@ def dc_report_show_active_devices(self): @dc_report_show_active_devices.setter def dc_report_show_active_devices(self, dc_report_show_active_devices): self.__stub.SetDCReportShowActiveDevices( - messages.bool_property_message(self, dc_report_show_active_devices) + bool_property_message(self, dc_report_show_active_devices) ) @property @@ -121,9 +117,7 @@ def per_pin_use_pin_format(self): @per_pin_use_pin_format.setter def per_pin_use_pin_format(self, per_pin_use_pin_format): - self.__stub.SetPerPinUsePinFormat( - messages.bool_property_message(self, per_pin_use_pin_format) - ) + self.__stub.SetPerPinUsePinFormat(bool_property_message(self, per_pin_use_pin_format)) @property def use_loop_res_for_per_pin(self): @@ -132,6 +126,4 @@ def use_loop_res_for_per_pin(self): @use_loop_res_for_per_pin.setter def use_loop_res_for_per_pin(self, use_loop_res_for_per_pin): - self.__stub.SetUseLoopResForPerPin( - messages.bool_property_message(self, use_loop_res_for_per_pin) - ) + self.__stub.SetUseLoopResForPerPin(bool_property_message(self, use_loop_res_for_per_pin)) diff --git a/src/ansys/edb/core/simulation_setup/siwave_simulation_settings.py b/src/ansys/edb/core/simulation_setup/siwave_simulation_settings.py index fda5c4ab6c..252a57f56c 100644 --- a/src/ansys/edb/core/simulation_setup/siwave_simulation_settings.py +++ b/src/ansys/edb/core/simulation_setup/siwave_simulation_settings.py @@ -4,7 +4,12 @@ import ansys.api.edb.v1.siwave_simulation_settings_pb2 as pb -from ansys.edb.core.inner import messages +from ansys.edb.core.inner.messages import ( + bool_property_message, + double_property_message, + int_property_message, + string_property_message, +) from ansys.edb.core.session import ( SIWaveAdvancedSettingsServiceStub, SIWaveDCAdvancedSettingsServiceStub, @@ -108,7 +113,7 @@ def use_si_settings(self): @use_si_settings.setter def use_si_settings(self, use_si_settings): - self.__stub.SetUseSISettings(messages.bool_property_message(self, use_si_settings)) + self.__stub.SetUseSISettings(bool_property_message(self, use_si_settings)) @property def use_custom_settings(self): @@ -117,7 +122,7 @@ def use_custom_settings(self): @use_custom_settings.setter def use_custom_settings(self, use_si_settings): - self.__stub.SetUseCustomSettings(messages.bool_property_message(self, use_si_settings)) + self.__stub.SetUseCustomSettings(bool_property_message(self, use_si_settings)) @property def si_slider_pos(self): @@ -126,7 +131,7 @@ def si_slider_pos(self): @si_slider_pos.setter def si_slider_pos(self, si_slider_pos): - self.__stub.SetSISliderPos(messages.int_property_message(self, si_slider_pos)) + self.__stub.SetSISliderPos(int_property_message(self, si_slider_pos)) @property def pi_slider_pos(self): @@ -135,7 +140,7 @@ def pi_slider_pos(self): @pi_slider_pos.setter def pi_slider_pos(self, pi_slider_pos): - self.__stub.SetPISliderPos(messages.int_property_message(self, pi_slider_pos)) + self.__stub.SetPISliderPos(int_property_message(self, pi_slider_pos)) class SIWaveAdvancedSettings(SimulationSettingsBase): @@ -151,7 +156,7 @@ def include_co_plane_coupling(self): @include_co_plane_coupling.setter def include_co_plane_coupling(self, include_co_plane_coupling): self.__stub.SetIncludeCoPlaneCoupling( - messages.bool_property_message(self, include_co_plane_coupling) + bool_property_message(self, include_co_plane_coupling) ) @property @@ -162,7 +167,7 @@ def include_inter_plane_coupling(self): @include_inter_plane_coupling.setter def include_inter_plane_coupling(self, include_inter_plane_coupling): self.__stub.SetIncludeInterPlaneCoupling( - messages.bool_property_message(self, include_inter_plane_coupling) + bool_property_message(self, include_inter_plane_coupling) ) @property @@ -173,7 +178,7 @@ def include_split_plane_coupling(self): @include_split_plane_coupling.setter def include_split_plane_coupling(self, include_split_plane_coupling): self.__stub.SetIncludeSplitPlaneCoupling( - messages.bool_property_message(self, include_split_plane_coupling) + bool_property_message(self, include_split_plane_coupling) ) @property @@ -184,7 +189,7 @@ def include_fringe_plane_coupling(self): @include_fringe_plane_coupling.setter def include_fringe_plane_coupling(self, include_fringe_plane_coupling): self.__stub.SetIncludeFringePlaneCoupling( - messages.bool_property_message(self, include_fringe_plane_coupling) + bool_property_message(self, include_fringe_plane_coupling) ) @property @@ -195,7 +200,7 @@ def include_trace_plane_coupling(self): @include_trace_plane_coupling.setter def include_trace_plane_coupling(self, include_trace_plane_coupling): self.__stub.SetIncludeTracePlaneCoupling( - messages.bool_property_message(self, include_trace_plane_coupling) + bool_property_message(self, include_trace_plane_coupling) ) @property @@ -205,9 +210,7 @@ def cross_talk_threshold(self): @cross_talk_threshold.setter def cross_talk_threshold(self, cross_talk_threshold): - self.__stub.SetCrossTalkThreshold( - messages.string_property_message(self, cross_talk_threshold) - ) + self.__stub.SetCrossTalkThreshold(string_property_message(self, cross_talk_threshold)) @property def max_coupled_lines(self): @@ -216,7 +219,7 @@ def max_coupled_lines(self): @max_coupled_lines.setter def max_coupled_lines(self, max_coupled_lines): - self.__stub.SetMaxCoupledLines(messages.int_property_message(self, max_coupled_lines)) + self.__stub.SetMaxCoupledLines(int_property_message(self, max_coupled_lines)) @property def min_void_area(self): @@ -225,7 +228,7 @@ def min_void_area(self): @min_void_area.setter def min_void_area(self, min_void_area): - self.__stub.SetMinVoidArea(messages.string_property_message(self, min_void_area)) + self.__stub.SetMinVoidArea(string_property_message(self, min_void_area)) @property def min_pad_area_to_mesh(self): @@ -234,9 +237,7 @@ def min_pad_area_to_mesh(self): @min_pad_area_to_mesh.setter def min_pad_area_to_mesh(self, min_pad_area_to_mesh): - self.__stub.SetMinPadAreaToMesh( - messages.string_property_message(self, min_pad_area_to_mesh) - ) + self.__stub.SetMinPadAreaToMesh(string_property_message(self, min_pad_area_to_mesh)) @property def min_plane_area_to_mesh(self): @@ -245,9 +246,7 @@ def min_plane_area_to_mesh(self): @min_plane_area_to_mesh.setter def min_plane_area_to_mesh(self, min_plane_area_to_mesh): - self.__stub.SetMinPlaneAreaToMesh( - messages.string_property_message(self, min_plane_area_to_mesh) - ) + self.__stub.SetMinPlaneAreaToMesh(string_property_message(self, min_plane_area_to_mesh)) @property def snap_length_threshold(self): @@ -256,9 +255,7 @@ def snap_length_threshold(self): @snap_length_threshold.setter def snap_length_threshold(self, snap_length_threshold): - self.__stub.SetSnapLengthThreshold( - messages.string_property_message(self, snap_length_threshold) - ) + self.__stub.SetSnapLengthThreshold(string_property_message(self, snap_length_threshold)) @property def mesh_automatic(self): @@ -267,7 +264,7 @@ def mesh_automatic(self): @mesh_automatic.setter def mesh_automatic(self, mesh_automatic): - self.__stub.SetMeshAutomatic(messages.bool_property_message(self, mesh_automatic)) + self.__stub.SetMeshAutomatic(bool_property_message(self, mesh_automatic)) @property def mesh_frequency(self): @@ -276,7 +273,7 @@ def mesh_frequency(self): @mesh_frequency.setter def mesh_frequency(self, mesh_frequency): - self.__stub.SetMeshFrequency(messages.string_property_message(self, mesh_frequency)) + self.__stub.SetMeshFrequency(string_property_message(self, mesh_frequency)) @property def return_current_distribution(self): @@ -286,7 +283,7 @@ def return_current_distribution(self): @return_current_distribution.setter def return_current_distribution(self, return_current_distribution): self.__stub.Set3DReturnCurrentDistribution( - messages.bool_property_message(self, return_current_distribution) + bool_property_message(self, return_current_distribution) ) @property @@ -296,7 +293,7 @@ def include_vi_sources(self): @include_vi_sources.setter def include_vi_sources(self, include_vi_sources): - self.__stub.SetIncludeVISources(messages.bool_property_message(self, include_vi_sources)) + self.__stub.SetIncludeVISources(bool_property_message(self, include_vi_sources)) @property def include_inf_gnd(self): @@ -305,7 +302,7 @@ def include_inf_gnd(self): @include_inf_gnd.setter def include_inf_gnd(self, include_inf_gnd): - self.__stub.SetIncludeInfGnd(messages.bool_property_message(self, include_inf_gnd)) + self.__stub.SetIncludeInfGnd(bool_property_message(self, include_inf_gnd)) @property def inf_gnd_location(self): @@ -314,7 +311,7 @@ def inf_gnd_location(self): @inf_gnd_location.setter def inf_gnd_location(self, inf_gnd_location): - self.__stub.SetInfGndLocation(messages.string_property_message(self, inf_gnd_location)) + self.__stub.SetInfGndLocation(string_property_message(self, inf_gnd_location)) @property def perform_erc(self): @@ -323,7 +320,7 @@ def perform_erc(self): @perform_erc.setter def perform_erc(self, perform_erc): - self.__stub.SetPerformERC(messages.bool_property_message(self, perform_erc)) + self.__stub.SetPerformERC(bool_property_message(self, perform_erc)) @property def ignore_non_functional_pads(self): @@ -333,7 +330,7 @@ def ignore_non_functional_pads(self): @ignore_non_functional_pads.setter def ignore_non_functional_pads(self, ignore_non_functional_pads): self.__stub.SetIgnoreNonFunctionalPads( - messages.bool_property_message(self, ignore_non_functional_pads) + bool_property_message(self, ignore_non_functional_pads) ) @@ -349,9 +346,7 @@ def use_dc_custom_settings(self): @use_dc_custom_settings.setter def use_dc_custom_settings(self, use_dc_custom_settings): - self.__stub.SetUseDCCustomSettings( - messages.bool_property_message(self, use_dc_custom_settings) - ) + self.__stub.SetUseDCCustomSettings(bool_property_message(self, use_dc_custom_settings)) @property def compute_inductance(self): @@ -360,7 +355,7 @@ def compute_inductance(self): @compute_inductance.setter def compute_inductance(self, compute_inductance): - self.__stub.SetComputeInductance(messages.bool_property_message(self, compute_inductance)) + self.__stub.SetComputeInductance(bool_property_message(self, compute_inductance)) @property def plot_jv(self): @@ -369,7 +364,7 @@ def plot_jv(self): @plot_jv.setter def plot_jv(self, plot_jv): - self.__stub.SetPlotJV(messages.bool_property_message(self, plot_jv)) + self.__stub.SetPlotJV(bool_property_message(self, plot_jv)) @property def contact_radius(self): @@ -378,7 +373,7 @@ def contact_radius(self): @contact_radius.setter def contact_radius(self, contact_radius): - self.__stub.SetContactRadius(messages.string_property_message(self, contact_radius)) + self.__stub.SetContactRadius(string_property_message(self, contact_radius)) @property def dc_slider_pos(self): @@ -387,7 +382,7 @@ def dc_slider_pos(self): @dc_slider_pos.setter def dc_slider_pos(self, dc_slider_pos): - self.__stub.SetDCSliderPos(messages.int_property_message(self, dc_slider_pos)) + self.__stub.SetDCSliderPos(int_property_message(self, dc_slider_pos)) class SIWaveDCAdvancedSettings(SimulationSettingsBase): @@ -405,7 +400,7 @@ def dc_min_plane_area_to_mesh(self): @dc_min_plane_area_to_mesh.setter def dc_min_plane_area_to_mesh(self, dc_min_plane_area_to_mesh): self.__stub.SetDCMinPlaneAreaToMesh( - messages.string_property_message(self, dc_min_plane_area_to_mesh) + string_property_message(self, dc_min_plane_area_to_mesh) ) @property @@ -415,9 +410,7 @@ def dc_min_void_area_to_mesh(self): @dc_min_void_area_to_mesh.setter def dc_min_void_area_to_mesh(self, dc_min_void_area_to_mesh): - self.__stub.SetDCMinVoidAreaToMesh( - messages.string_property_message(self, dc_min_void_area_to_mesh) - ) + self.__stub.SetDCMinVoidAreaToMesh(string_property_message(self, dc_min_void_area_to_mesh)) @property def max_init_mesh_edge_length(self): @@ -427,7 +420,7 @@ def max_init_mesh_edge_length(self): @max_init_mesh_edge_length.setter def max_init_mesh_edge_length(self, max_init_mesh_edge_length): self.__stub.SetMaxInitMeshEdgeLength( - messages.string_property_message(self, max_init_mesh_edge_length) + string_property_message(self, max_init_mesh_edge_length) ) @property @@ -438,7 +431,7 @@ def perform_adaptive_refinement(self): @perform_adaptive_refinement.setter def perform_adaptive_refinement(self, perform_adaptive_refinement): self.__stub.SetPerformAdaptiveRefinement( - messages.bool_property_message(self, perform_adaptive_refinement) + bool_property_message(self, perform_adaptive_refinement) ) @property @@ -448,7 +441,7 @@ def max_num_passes(self): @max_num_passes.setter def max_num_passes(self, max_num_passes): - self.__stub.SetMaxNumPasses(messages.int_property_message(self, max_num_passes)) + self.__stub.SetMaxNumPasses(int_property_message(self, max_num_passes)) @property def min_num_passes(self): @@ -457,7 +450,7 @@ def min_num_passes(self): @min_num_passes.setter def min_num_passes(self, min_num_passes): - self.__stub.SetMinNumPasses(messages.int_property_message(self, min_num_passes)) + self.__stub.SetMinNumPasses(int_property_message(self, min_num_passes)) @property def percent_local_refinement(self): @@ -466,9 +459,7 @@ def percent_local_refinement(self): @percent_local_refinement.setter def percent_local_refinement(self, percent_local_refinement): - self.__stub.SetPercentLocalRefinement( - messages.int_property_message(self, percent_local_refinement) - ) + self.__stub.SetPercentLocalRefinement(int_property_message(self, percent_local_refinement)) @property def energy_error(self): @@ -477,7 +468,7 @@ def energy_error(self): @energy_error.setter def energy_error(self, energy_error): - self.__stub.SetEnergyError(messages.double_property_message(self, energy_error)) + self.__stub.SetEnergyError(double_property_message(self, energy_error)) @property def mesh_bws(self): @@ -486,7 +477,7 @@ def mesh_bws(self): @mesh_bws.setter def mesh_bws(self, mesh_bws): - self.__stub.SetMeshBws(messages.bool_property_message(self, mesh_bws)) + self.__stub.SetMeshBws(bool_property_message(self, mesh_bws)) @property def refine_bws(self): @@ -495,7 +486,7 @@ def refine_bws(self): @refine_bws.setter def refine_bws(self, refine_bws): - self.__stub.SetRefineBws(messages.bool_property_message(self, refine_bws)) + self.__stub.SetRefineBws(bool_property_message(self, refine_bws)) @property def mesh_vias(self): @@ -504,7 +495,7 @@ def mesh_vias(self): @mesh_vias.setter def mesh_vias(self, mesh_vias): - self.__stub.SetMeshVias(messages.bool_property_message(self, mesh_vias)) + self.__stub.SetMeshVias(bool_property_message(self, mesh_vias)) @property def refine_vias(self): @@ -513,7 +504,7 @@ def refine_vias(self): @refine_vias.setter def refine_vias(self, refine_vias): - self.__stub.SetRefineVias(messages.bool_property_message(self, refine_vias)) + self.__stub.SetRefineVias(bool_property_message(self, refine_vias)) @property def num_bw_sides(self): @@ -522,7 +513,7 @@ def num_bw_sides(self): @num_bw_sides.setter def num_bw_sides(self, num_bw_sides): - self.__stub.SetNumBwSides(messages.int_property_message(self, num_bw_sides)) + self.__stub.SetNumBwSides(int_property_message(self, num_bw_sides)) @property def num_via_sides(self): @@ -531,7 +522,7 @@ def num_via_sides(self): @num_via_sides.setter def num_via_sides(self, num_via_sides): - self.__stub.SetNumViaSides(messages.int_property_message(self, num_via_sides)) + self.__stub.SetNumViaSides(int_property_message(self, num_via_sides)) class SIWaveSParameterSettings(SimulationSettingsBase): @@ -546,7 +537,7 @@ def use_state_space(self): @use_state_space.setter def use_state_space(self, use_state_space): - self.__stub.SetUseStateSpace(messages.bool_property_message(self, use_state_space)) + self.__stub.SetUseStateSpace(bool_property_message(self, use_state_space)) @property def interpolation(self): diff --git a/src/ansys/edb/core/terminal/terminals.py b/src/ansys/edb/core/terminal/terminals.py index 562fdf796c..1de620c199 100644 --- a/src/ansys/edb/core/terminal/terminals.py +++ b/src/ansys/edb/core/terminal/terminals.py @@ -8,7 +8,29 @@ from ansys.edb.core import hierarchy, primitive from ansys.edb.core.edb_defs import LayoutObjType from ansys.edb.core.geometry import ArcData -from ansys.edb.core.inner import ObjBase, TypeField, conn_obj, messages, parser +from ansys.edb.core.inner.base import ObjBase, TypeField +from ansys.edb.core.inner.conn_obj import ConnObj +from ansys.edb.core.inner.messages import ( + edb_obj_collection_message, + edge_creation_message, + edge_term_creation_message, + edge_term_set_edges_message, + padstack_inst_term_creation_message, + padstack_inst_term_set_params_message, + pin_group_term_creation_message, + pin_group_term_set_layer_message, + pin_group_term_set_pin_group_message, + point_term_creation_message, + point_term_set_params_message, + term_find_by_name_message, + term_get_product_solver_message, + term_inst_creation_message, + term_inst_term_creation_message, + term_inst_term_set_instance_message, + term_set_params_message, + term_set_solver_option_message, +) +from ansys.edb.core.inner.parser import to_rlc from ansys.edb.core.layer import Layer from ansys.edb.core.session import StubAccessor, StubType from ansys.edb.core.utility import PortPostProcessingProp, Value @@ -88,7 +110,7 @@ def cast(self): @classmethod def _create(cls, **params): - return cls.__stub.Create(messages.edge_creation_message(cls.type.value, **params)) + return cls.__stub.Create(edge_creation_message(cls.type.value, **params)) @property def _type(self): @@ -196,7 +218,7 @@ def point(self): return self._params.point -class Terminal(conn_obj.ConnObj): +class Terminal(ConnObj): """Class representing a terminal object.""" __stub = StubAccessor(StubType.terminal) @@ -246,9 +268,9 @@ def find(cls, layout, name): ------- Terminal """ - return Terminal( - cls.__stub.FindByName(messages.term_find_by_name_message(layout, name)) - ).cast(cls.type) + return Terminal(cls.__stub.FindByName(term_find_by_name_message(layout, name))).cast( + cls.type + ) @property def _params(self): @@ -256,7 +278,7 @@ def _params(self): @_params.setter def _params(self, values): - self.__stub.SetParams(messages.term_set_params_message(self, **values)) + self.__stub.SetParams(term_set_params_message(self, **values)) @property def _type(self): @@ -554,7 +576,7 @@ def model(self, value): self._params = {"s_param_model": value} @property - @parser.to_rlc + @to_rlc def rlc_boundary_parameters(self): """Return the RLC boundary parameters. @@ -604,9 +626,7 @@ def port_post_processing_prop(self, value): self._params = {"port_post_processing_prop": value} def _product_solvers(self, product_id): - return self.__stub.GetProductSolvers( - messages.term_get_product_solver_message(self, product_id) - ) + return self.__stub.GetProductSolvers(term_get_product_solver_message(self, product_id)) def product_solver_option(self, product_id, solver_name): """Return product solver option name. @@ -636,7 +656,7 @@ def set_product_solver_option(self, product_id, solver_name, option): option : str """ self.__stub.SetProductSolverOptions( - messages.term_set_solver_option_message(self, product_id, solver_name, option) + term_set_solver_option_message(self, product_id, solver_name, option) ) def product_solver_names(self, product_id): @@ -649,7 +669,7 @@ def product_solver_names(self, product_id): return [solver.name for solver in self._product_solvers(product_id)] -class TerminalInstance(conn_obj.ConnObj): +class TerminalInstance(ConnObj): """Class representing a terminal instance.""" __stub = StubAccessor(StubType.terminal_instance) @@ -671,9 +691,7 @@ def create(cls, layout, cell_instance, name, net_ref): TerminalInstance """ return TerminalInstance( - cls.__stub.Create( - messages.term_inst_creation_message(layout, net_ref, cell_instance, name) - ) + cls.__stub.Create(term_inst_creation_message(layout, net_ref, cell_instance, name)) ) @property @@ -731,9 +749,7 @@ def create(cls, layout, term_instance, name, net_ref, is_ref=False): """ return TerminalInstanceTerminal( cls.__stub.Create( - messages.term_inst_term_creation_message( - layout, net_ref, name, term_instance, is_ref - ) + term_inst_term_creation_message(layout, net_ref, name, term_instance, is_ref) ) ) @@ -755,7 +771,7 @@ def terminal_instance(self, value): ---------- value : TerminalInstance """ - self.__stub.SetTerminalInstance(messages.term_inst_term_set_instance_message(self, value)) + self.__stub.SetTerminalInstance(term_inst_term_set_instance_message(self, value)) class BundleTerminal(Terminal): @@ -777,7 +793,7 @@ def create(cls, terminals): ------- BundleTerminal """ - return BundleTerminal(cls.__stub.Create(messages.edb_obj_collection_message(terminals))) + return BundleTerminal(cls.__stub.Create(edb_obj_collection_message(terminals))) @property def terminals(self): @@ -819,7 +835,7 @@ def create(cls, layout, net, layer, name, point): PointTerminal """ return PointTerminal( - cls.__stub.Create(messages.point_term_creation_message(layout, net, layer, name, point)) + cls.__stub.Create(point_term_creation_message(layout, net, layer, name, point)) ) @property @@ -866,7 +882,7 @@ def params(self, params): ---------- params : tuple[str or Layer, PointData] """ - self.__stub.SetParameters(messages.point_term_set_params_message(self, *params)) + self.__stub.SetParameters(point_term_set_params_message(self, *params)) class PadstackInstanceTerminal(Terminal): @@ -894,7 +910,7 @@ def create(cls, layout, name, padstack_instance, layer, net, is_ref=False): """ return PadstackInstanceTerminal( cls.__stub.Create( - messages.padstack_inst_term_creation_message( + padstack_inst_term_creation_message( layout, name, padstack_instance, layer, net, is_ref ) ) @@ -923,7 +939,7 @@ def params(self, params): """ (padstack_instance, layer) = params self.__stub.SetParameters( - messages.padstack_inst_term_set_params_message(self, padstack_instance, layer) + padstack_inst_term_set_params_message(self, padstack_instance, layer) ) @property @@ -971,7 +987,7 @@ def create(cls, layout, name, pin_group, net_ref, is_ref=False): """ return PinGroupTerminal( cls.__stub.Create( - messages.pin_group_term_creation_message(layout, net_ref, name, pin_group, is_ref) + pin_group_term_creation_message(layout, net_ref, name, pin_group, is_ref) ) ) @@ -993,7 +1009,7 @@ def pin_group(self, value): ---------- value : PinGroup """ - self.__stub.SetPinGroup(messages.pin_group_term_set_pin_group_message(self, value)) + self.__stub.SetPinGroup(pin_group_term_set_pin_group_message(self, value)) @property def layer(self): @@ -1013,7 +1029,7 @@ def layer(self, value): ---------- value : Layer """ - self.__stub.SetLayer(messages.pin_group_term_set_layer_message(self, value)) + self.__stub.SetLayer(pin_group_term_set_layer_message(self, value)) class EdgeTerminal(Terminal): @@ -1039,9 +1055,7 @@ def create(cls, layout, name, edges, net_ref=None, is_ref=False): EdgeTerminal """ return EdgeTerminal( - cls.__stub.Create( - messages.edge_term_creation_message(layout, net_ref, name, edges, is_ref) - ) + cls.__stub.Create(edge_term_creation_message(layout, net_ref, name, edges, is_ref)) ) @property @@ -1062,4 +1076,4 @@ def edges(self, edges): ---------- edges : list of Edge """ - self.__stub.GetEdges(messages.edge_term_set_edges_message(self, edges)) + self.__stub.GetEdges(edge_term_set_edges_message(self, edges)) diff --git a/src/ansys/edb/core/utility/layer_map.py b/src/ansys/edb/core/utility/layer_map.py index ebc30a94f2..dad729d3a4 100644 --- a/src/ansys/edb/core/utility/layer_map.py +++ b/src/ansys/edb/core/utility/layer_map.py @@ -4,7 +4,8 @@ from ansys.api.edb.v1 import layer_map_pb2 as pb -from ansys.edb.core.inner import ObjBase, messages +from ansys.edb.core.inner.base import ObjBase +from ansys.edb.core.inner.messages import edb_internal_id_message, int_property_message from ansys.edb.core.session import StubAccessor, StubType @@ -33,8 +34,8 @@ def layer_map_two_int_properties_message(target, from_id, to_id): """ return pb.LayerMapTwoIntPropertiesMessage( target=target, - from_id=messages.edb_internal_id_message(from_id), - to_id=messages.edb_internal_id_message(to_id), + from_id=edb_internal_id_message(from_id), + to_id=edb_internal_id_message(to_id), ) @@ -100,7 +101,7 @@ def set_mapping(self, from_id, to_id): def get_mapping_forward(self, layer_id): """Get list of ids mapped forward with the given id (key).""" msg = self.__stub.GetMappingForward( - messages.int_property_message( + int_property_message( target=self, value=layer_id, ) @@ -110,7 +111,7 @@ def get_mapping_forward(self, layer_id): def get_mapping_backward(self, layer_id): """Get list of ids mapped backward with the given id (value).""" msg = self.__stub.GetMappingBackward( - messages.int_property_message( + int_property_message( target=self, value=layer_id, ) diff --git a/src/ansys/edb/core/utility/transform.py b/src/ansys/edb/core/utility/transform.py index da738b47a8..2daa3893f8 100644 --- a/src/ansys/edb/core/utility/transform.py +++ b/src/ansys/edb/core/utility/transform.py @@ -2,7 +2,16 @@ import ansys.api.edb.v1.transform_pb2 as pb from ansys.api.edb.v1.transform_pb2_grpc import TransformServiceStub -from ansys.edb.core.inner import ObjBase, messages, parser +from ansys.edb.core.inner.base import ObjBase +from ansys.edb.core.inner.messages import ( + bool_property_message, + edb_obj_message, + point_property_message, + polygon_data_property_message, + value_message, + value_property_message, +) +from ansys.edb.core.inner.parser import to_polygon_data from ansys.edb.core.session import StubAccessor, StubType from ansys.edb.core.utility.value import Value @@ -11,18 +20,18 @@ class _TransformQueryBuilder: @staticmethod def transform_message(scale, angle, mirror, offset_x, offset_y): return pb.TransformMessage( - scale=messages.value_message(scale), - angle=messages.value_message(angle), + scale=value_message(scale), + angle=value_message(angle), mirror=mirror, - offset_x=messages.value_message(offset_x), - offset_y=messages.value_message(offset_y), + offset_x=value_message(offset_x), + offset_y=value_message(offset_y), ) @staticmethod def transform_operator_message(target, target_2): return pb.TransformOperatorMessage( - target_1=messages.edb_obj_message(target.msg), - target_2=messages.edb_obj_message(target_2.msg), + target_1=edb_obj_message(target.msg), + target_2=edb_obj_message(target_2.msg), ) @@ -64,11 +73,11 @@ def scale(self): This property can be set to :term:`ValueLike` """ - return Value(self.__stub.GetScale(messages.edb_obj_message(self))) + return Value(self.__stub.GetScale(edb_obj_message(self))) @scale.setter def scale(self, value): - self.__stub.SetScale(messages.value_property_message(target=self, value=value)) + self.__stub.SetScale(value_property_message(target=self, value=value)) @property def rotation(self): @@ -76,11 +85,11 @@ def rotation(self): This property can be set to :term:`ValueLike` """ - return Value(self.__stub.GetRotation(messages.edb_obj_message(self))) + return Value(self.__stub.GetRotation(edb_obj_message(self))) @rotation.setter def rotation(self, value): - self.__stub.SetRotation(messages.value_property_message(target=self, value=value)) + self.__stub.SetRotation(value_property_message(target=self, value=value)) @property def offset_x(self): @@ -88,11 +97,11 @@ def offset_x(self): This property can be set to :term:`ValueLike` """ - return Value(self.__stub.GetOffsetX(messages.edb_obj_message(self))) + return Value(self.__stub.GetOffsetX(edb_obj_message(self))) @offset_x.setter def offset_x(self, value): - self.__stub.SetOffsetX(messages.value_property_message(target=self, value=value)) + self.__stub.SetOffsetX(value_property_message(target=self, value=value)) @property def offset_y(self): @@ -100,25 +109,25 @@ def offset_y(self): This property can be set to :term:`ValueLike` """ - return Value(self.__stub.GetOffsetY(messages.edb_obj_message(self))) + return Value(self.__stub.GetOffsetY(edb_obj_message(self))) @offset_y.setter def offset_y(self, value): - self.__stub.SetOffsetY(messages.value_property_message(target=self, value=value)) + self.__stub.SetOffsetY(value_property_message(target=self, value=value)) @property def mirror(self): """:obj:`bool`: Mirror property. If true, mirror about Y-axis.""" - return self.__stub.GetMirror(messages.edb_obj_message(self)).value + return self.__stub.GetMirror(edb_obj_message(self)).value @mirror.setter def mirror(self, value): - self.__stub.SetMirror(messages.bool_property_message(self, value)) + self.__stub.SetMirror(bool_property_message(self, value)) @property def is_identity(self): """:obj:`bool`: Gets whether the transformation is an identity transformation.""" - return self.__stub.IsIdentity(messages.edb_obj_message(self)).value + return self.__stub.IsIdentity(edb_obj_message(self)).value def __add__(self, other_transform): """Add operator, concatenate two transformations. @@ -152,10 +161,10 @@ def transform_point(self, point): :class:`PointData ` The transformed point """ - pnt_msg = self.__stub.TransformPoint(messages.point_property_message(self, point)) + pnt_msg = self.__stub.TransformPoint(point_property_message(self, point)) return Value(pnt_msg.x), Value(pnt_msg.y) - @parser.to_polygon_data + @to_polygon_data def transform_polygon(self, polygon): """Transform a polygon. @@ -169,4 +178,4 @@ def transform_polygon(self, polygon): :class:`PolygonData ` The transformed polygon. """ - return self.__stub.TransformPolygon(messages.polygon_data_property_message(self, polygon)) + return self.__stub.TransformPolygon(polygon_data_property_message(self, polygon)) diff --git a/src/ansys/edb/core/utility/transform3d.py b/src/ansys/edb/core/utility/transform3d.py index aaa165bce2..3d575d9dbc 100644 --- a/src/ansys/edb/core/utility/transform3d.py +++ b/src/ansys/edb/core/utility/transform3d.py @@ -3,7 +3,18 @@ from ansys.api.edb.v1.transform3d_pb2_grpc import Transform3DServiceStub from google.protobuf import empty_pb2 -from ansys.edb.core.inner import ObjBase, messages +from ansys.edb.core.inner.base import ObjBase +from ansys.edb.core.inner.messages import ( + cpos_3d_double_message, + cpos_3d_message, + cpos_3d_pair_message, + cpos_3d_property_message, + cpos_3d_triple_message, + double_property_message, + doubles_property_message, + edb_obj_message, + pointer_property_message, +) from ansys.edb.core.inner.parser import to_3_point3d_data, to_point3d_data from ansys.edb.core.session import StubAccessor, StubType @@ -12,7 +23,7 @@ class _Transform3DQueryBuilder: @staticmethod def is_identity_message(target, eps, rotation): return pb.IsIdentityMessage( - target=messages.edb_obj_message(target), + target=edb_obj_message(target), eps=eps, rotation=rotation, ) @@ -20,8 +31,8 @@ def is_identity_message(target, eps, rotation): @staticmethod def is_equal_message(target, value, eps, rotation): return pb.IsEqualMessage( - target=messages.edb_obj_message(target), - value=messages.edb_obj_message(value), + target=edb_obj_message(target), + value=edb_obj_message(value), eps=eps, rotation=rotation, ) @@ -62,7 +73,7 @@ def create_copy(cls, transform3d): ------- Transform3D """ - return Transform3D(cls.__stub.CreateCopy(messages.edb_obj_message(transform3d))) + return Transform3D(cls.__stub.CreateCopy(edb_obj_message(transform3d))) @classmethod def create_from_matrix(cls, matrix): @@ -92,7 +103,7 @@ def create_from_offset(cls, offset): ------- Transform3D """ - return Transform3D(cls.__stub.CreateOffset(messages.cpos_3d_message(offset))) + return Transform3D(cls.__stub.CreateOffset(cpos_3d_message(offset))) @classmethod def create_from_center_scale(cls, center, scale): @@ -109,9 +120,7 @@ def create_from_center_scale(cls, center, scale): ------- Transform3D """ - return Transform3D( - cls.__stub.CreateCenterScale(messages.cpos_3d_double_message(center, scale)) - ) + return Transform3D(cls.__stub.CreateCenterScale(cpos_3d_double_message(center, scale))) @classmethod def create_from_angle(cls, zyx_decomposition): @@ -125,9 +134,7 @@ def create_from_angle(cls, zyx_decomposition): ------- Transform3D """ - return Transform3D( - cls.__stub.CreateRotationFromAngle(messages.cpos_3d_message(zyx_decomposition)) - ) + return Transform3D(cls.__stub.CreateRotationFromAngle(cpos_3d_message(zyx_decomposition))) @classmethod def create_from_axis(cls, x, y, z): @@ -146,9 +153,7 @@ def create_from_axis(cls, x, y, z): ------- Transform3D """ - return Transform3D( - cls.__stub.CreateRotationFromAxis(messages.cpos_3d_triple_message(x, y, z)) - ) + return Transform3D(cls.__stub.CreateRotationFromAxis(cpos_3d_triple_message(x, y, z))) @classmethod def create_from_axis_and_angle(cls, axis, angle): @@ -166,7 +171,7 @@ def create_from_axis_and_angle(cls, axis, angle): Transform3D """ return Transform3D( - cls.__stub.CreateRotationFromAxisAndAngle(messages.cpos_3d_double_message(axis, angle)) + cls.__stub.CreateRotationFromAxisAndAngle(cpos_3d_double_message(axis, angle)) ) @classmethod @@ -185,7 +190,7 @@ def create_from_one_axis_to_another(cls, from_axis, to_axis): Transform3D """ return Transform3D( - cls.__stub.CreateRotationFromToAxis(messages.cpos_3d_pair_message(from_axis, to_axis)) + cls.__stub.CreateRotationFromToAxis(cpos_3d_pair_message(from_axis, to_axis)) ) @classmethod @@ -203,17 +208,15 @@ def create_from_transform_2d(cls, transform, z_off): ------- Transform3D """ - return Transform3D( - cls.__stub.CreateTransform2D(messages.double_property_message(transform, z_off)) - ) + return Transform3D(cls.__stub.CreateTransform2D(double_property_message(transform, z_off))) def transpose(self): """Transpose transfrom3d.""" - self.__stub.Transpose(messages.edb_obj_message(self)) + self.__stub.Transpose(edb_obj_message(self)) def invert(self): """Invert transfrom3d.""" - self.__stub.Invert(messages.edb_obj_message(self)) + self.__stub.Invert(edb_obj_message(self)) def is_identity(self, eps, rotation): """Get is identity of a Transform3d. @@ -264,14 +267,14 @@ def __add__(self, other_transform): A new transformation3d object. """ return Transform3D( - self.__stub.OperatorPlus(messages.pointer_property_message(self, other_transform)) + self.__stub.OperatorPlus(pointer_property_message(self, other_transform)) ) @property @to_3_point3d_data def axis(self): """:obj:`list` of :term:`Point3DLike`: Axis.""" - return self.__stub.GetAxis(messages.edb_obj_message(self)) + return self.__stub.GetAxis(edb_obj_message(self)) @to_point3d_data def transform_point(self, point): @@ -286,30 +289,30 @@ def transform_point(self, point): :term:`Point3DLike` TransformPoint. """ - return self.__stub.TransformPoint(messages.cpos_3d_property_message(self, point)) + return self.__stub.TransformPoint(cpos_3d_property_message(self, point)) @property @to_point3d_data def z_y_x_rotation(self): """:term:`Point3DLike`: ZYXRotation.""" - return self.__stub.GetZYXRotation(messages.edb_obj_message(self)) + return self.__stub.GetZYXRotation(edb_obj_message(self)) @property @to_point3d_data def scaling(self): """:term:`Point3DLike`: Scaling.""" - return self.__stub.GetScaling(messages.edb_obj_message(self)) + return self.__stub.GetScaling(edb_obj_message(self)) @property @to_point3d_data def shift(self): """:term:`Point3DLike`: Shift.""" - return self.__stub.GetShift(messages.edb_obj_message(self)) + return self.__stub.GetShift(edb_obj_message(self)) @property def matrix(self): """:obj:`list` of :obj:`list` of :obj:`floats` : Transformation matrix as a 2D 4x4 Array.""" - msg = self.__stub.GetMatrix(messages.edb_obj_message(self)) + msg = self.__stub.GetMatrix(edb_obj_message(self)) matrix = [[float(_) for _ in msg.doubles[(i - 1) * 4 : i * 4]] for i in range(1, 5)] return matrix @@ -323,4 +326,4 @@ def matrix(self, value): and len(value[3]) == 4 ): unrolled_matrix = [float(j) for submatrix in value for j in submatrix] - self.__stub.SetMatrix(messages.doubles_property_message(self, unrolled_matrix)) + self.__stub.SetMatrix(doubles_property_message(self, unrolled_matrix)) diff --git a/src/ansys/edb/core/utility/value.py b/src/ansys/edb/core/utility/value.py index c92dcfb232..14c701e7d9 100644 --- a/src/ansys/edb/core/utility/value.py +++ b/src/ansys/edb/core/utility/value.py @@ -5,7 +5,7 @@ from ansys.api.edb.v1.edb_messages_pb2 import ValueMessage from ansys.edb.core import session -from ansys.edb.core.inner import messages +from ansys.edb.core.inner.messages import edb_obj_message from ansys.edb.core.utility import conversions @@ -79,9 +79,7 @@ def __init__(self, val, _owner=None): elif isinstance(val, Value): self.msg = val.msg elif isinstance(val, str): - temp = value_pb2.ValueTextMessage( - text=val, variable_owner=messages.edb_obj_message(_owner) - ) + temp = value_pb2.ValueTextMessage(text=val, variable_owner=edb_obj_message(_owner)) self.msg = self.__stub.CreateValue(temp) elif isinstance(val, float) or isinstance(val, int): self.msg.constant.real = val diff --git a/tests/mock/test_terminals.py b/tests/mock/test_terminals.py index 6ebd05e244..a4f317393a 100644 --- a/tests/mock/test_terminals.py +++ b/tests/mock/test_terminals.py @@ -4,7 +4,16 @@ from utils.test_utils import create_edb_obj_msgs, equals from ansys.edb.core import terminal -from ansys.edb.core.inner import messages +from ansys.edb.core.inner.messages import ( + bool_message, + edb_obj_collection_message, + point_term_creation_message, + point_term_params_message, + point_term_set_params_message, + port_post_processing_prop_message, + rlc_message, + value_message, +) import ansys.edb.core.layer as layer_api from ansys.edb.core.utility import PortPostProcessingProp, Rlc @@ -45,9 +54,7 @@ def test_bundle_terminal_create(mocked_stub, point_terminal, bundle_terminal, ed bt = terminal.BundleTerminal.create([point_terminal, bundle_terminal]) - mock.assert_called_once_with( - messages.edb_obj_collection_message([point_terminal, bundle_terminal]) - ) + mock.assert_called_once_with(edb_obj_collection_message([point_terminal, bundle_terminal])) assert isinstance(bt, terminal.BundleTerminal) assert not bt.is_null assert bt.id == edb_obj_msg.id @@ -93,7 +100,7 @@ def test_point_terminal_create(mocked_stub, layout, net, layer, edb_obj_msg): pt = terminal.PointTerminal.create(layout, net, layer, "test-point-term", (1, 2)) mock.assert_called_once_with( - messages.point_term_creation_message(layout, net, layer, "test-point-term", (1, 2)) + point_term_creation_message(layout, net, layer, "test-point-term", (1, 2)) ) assert isinstance(pt, terminal.PointTerminal) assert not pt.is_null @@ -103,7 +110,7 @@ def test_point_terminal_create(mocked_stub, layout, net, layer, edb_obj_msg): def test_point_terminal_get_params(mocked_stub, point_terminal, layer, lyr_type_mock): point = (1e-9, 2e-9) mock = mocked_stub(terminal, terminal.PointTerminal).GetParameters - mock.return_value = messages.point_term_params_message(layer, point) + mock.return_value = point_term_params_message(layer, point) res = point_terminal.params @@ -127,13 +134,11 @@ def test_point_terminal_get_params(mocked_stub, point_terminal, layer, lyr_type_ ) def test_point_terminal_set_params(mocked_stub, point_terminal, layer_ref, point, success): mock = mocked_stub(terminal, terminal.PointTerminal).SetParameters - mock.return_value = messages.bool_message(success) + mock.return_value = bool_message(success) point_terminal.params = (layer_ref, point) - mock.assert_called_once_with( - messages.point_term_set_params_message(point_terminal, layer_ref, point) - ) + mock.assert_called_once_with(point_term_set_params_message(point_terminal, layer_ref, point)) def test_terminal_get_params(mocked_stub, point_terminal, bundle_terminal, layer, lyr_type_mock): @@ -151,12 +156,12 @@ def test_terminal_get_params(mocked_stub, point_terminal, bundle_terminal, layer is_circuit_port=False, use_ref_from_hierarchy=True, name="name", - impedance=messages.value_message(50), - source_amplitude=messages.value_message(10), - source_phase=messages.value_message(5), + impedance=value_message(50), + source_amplitude=value_message(10), + source_phase=value_message(5), s_param_model="model", - rlc=messages.rlc_message(Rlc(r=10, r_enabled=True)), - port_post_processing_prop=messages.port_post_processing_prop_message( + rlc=rlc_message(Rlc(r=10, r_enabled=True)), + port_post_processing_prop=port_post_processing_prop_message( PortPostProcessingProp(renormalization_impedance=50, do_renormalize=True) ), ) diff --git a/tests/mock/utils/test_utils.py b/tests/mock/utils/test_utils.py index bee14229dd..45100db242 100644 --- a/tests/mock/utils/test_utils.py +++ b/tests/mock/utils/test_utils.py @@ -2,7 +2,7 @@ from ansys.api.edb.v1.edb_messages_pb2 import EDBObjCollectionMessage, EDBObjMessage -from ansys.edb.core.inner import ObjBase +from ansys.edb.core.inner.base import ObjBase # Comparison utils