diff --git a/doc/changelog.d/6716.added.md b/doc/changelog.d/6716.added.md new file mode 100644 index 00000000000..c1e1b22b7c7 --- /dev/null +++ b/doc/changelog.d/6716.added.md @@ -0,0 +1 @@ +Add dir as property diff --git a/src/ansys/aedt/core/aedt_logger.py b/src/ansys/aedt/core/aedt_logger.py index d4898328b5b..a4577a39769 100644 --- a/src/ansys/aedt/core/aedt_logger.py +++ b/src/ansys/aedt/core/aedt_logger.py @@ -138,7 +138,7 @@ def filter(self, record): return True -class AedtLogger(object): +class AedtLogger: """ Specifies the logger to use for each AEDT logger. diff --git a/src/ansys/aedt/core/application/aedt_objects.py b/src/ansys/aedt/core/application/aedt_objects.py index e5fb211f8ad..5ec686ed54d 100644 --- a/src/ansys/aedt/core/application/aedt_objects.py +++ b/src/ansys/aedt/core/application/aedt_objects.py @@ -27,6 +27,7 @@ import warnings from ansys.aedt.core.application.aedt_units import AedtUnits +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic.constants import SolutionsHfss from ansys.aedt.core.generic.general_methods import is_linux from ansys.aedt.core.generic.general_methods import pyaedt_function_handler @@ -34,7 +35,7 @@ from ansys.aedt.core.internal.desktop_sessions import _desktop_sessions -class AedtObjects(object): +class AedtObjects(PyAedtBase): def __init__(self, desktop=None, project=None, design=None, is_inherithed=False): self._odesign = design self._oproject = project diff --git a/src/ansys/aedt/core/application/aedt_units.py b/src/ansys/aedt/core/application/aedt_units.py index 531d92fb508..3e7940da2fb 100644 --- a/src/ansys/aedt/core/application/aedt_units.py +++ b/src/ansys/aedt/core/application/aedt_units.py @@ -21,10 +21,11 @@ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic.constants import AEDT_UNITS -class AedtUnits: +class AedtUnits(PyAedtBase): """Class containing all default AEDT units. All properties are read-only except length units.""" def __init__(self, aedt_object=None): diff --git a/src/ansys/aedt/core/application/analysis.py b/src/ansys/aedt/core/application/analysis.py index d14c1e011eb..c5a8146402f 100644 --- a/src/ansys/aedt/core/application/analysis.py +++ b/src/ansys/aedt/core/application/analysis.py @@ -44,6 +44,7 @@ from ansys.aedt.core.application.design import Design from ansys.aedt.core.application.job_manager import update_hpc_option from ansys.aedt.core.application.variables import Variable +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic.constants import SOLUTIONS from ansys.aedt.core.generic.constants import Axis from ansys.aedt.core.generic.constants import Gravity @@ -79,7 +80,7 @@ from ansys.aedt.core.modules.solve_sweeps import SetupProps -class Analysis(Design, object): +class Analysis(Design, PyAedtBase): """Contains all common analysis functions. This class is inherited in the caller application and is accessible through it ( eg. ``hfss.method_name``). @@ -2571,7 +2572,7 @@ def number_with_units(self, value, units=None): # pragma: no cover return self.value_with_units(value, units) -class AvailableVariations(object): +class AvailableVariations(PyAedtBase): def __init__(self, app): """Contains available variations. diff --git a/src/ansys/aedt/core/application/analysis_3d.py b/src/ansys/aedt/core/application/analysis_3d.py index 8f18fcbee65..6c95ef72c2c 100644 --- a/src/ansys/aedt/core/application/analysis_3d.py +++ b/src/ansys/aedt/core/application/analysis_3d.py @@ -30,6 +30,7 @@ import warnings from ansys.aedt.core.application.analysis import Analysis +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic.configurations import Configurations from ansys.aedt.core.generic.constants import unit_converter from ansys.aedt.core.generic.file_utils import check_if_path_exists @@ -43,7 +44,7 @@ from ansys.aedt.core.internal.checks import min_aedt_version -class FieldAnalysis3D(Analysis, object): +class FieldAnalysis3D(Analysis, PyAedtBase): """Manages 3D field analysis setup in HFSS, Maxwell 3D, and Q3D. This class is automatically initialized by an application call from one of diff --git a/src/ansys/aedt/core/application/analysis_3d_layout.py b/src/ansys/aedt/core/application/analysis_3d_layout.py index 8c0941ba0b7..580014fec10 100644 --- a/src/ansys/aedt/core/application/analysis_3d_layout.py +++ b/src/ansys/aedt/core/application/analysis_3d_layout.py @@ -26,6 +26,7 @@ import warnings from ansys.aedt.core.application.analysis import Analysis +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic.configurations import Configurations3DLayout from ansys.aedt.core.generic.general_methods import pyaedt_function_handler from ansys.aedt.core.generic.settings import settings @@ -33,7 +34,7 @@ from ansys.aedt.core.modules.solve_setup import Setup3DLayout -class FieldAnalysis3DLayout(Analysis): +class FieldAnalysis3DLayout(Analysis, PyAedtBase): """Manages 3D field analysis setup in HFSS 3D Layout. This class is automatically initialized by an application call from this diff --git a/src/ansys/aedt/core/application/analysis_circuit_netlist.py b/src/ansys/aedt/core/application/analysis_circuit_netlist.py index 3e3907fc0d8..b4f371ae659 100644 --- a/src/ansys/aedt/core/application/analysis_circuit_netlist.py +++ b/src/ansys/aedt/core/application/analysis_circuit_netlist.py @@ -23,10 +23,11 @@ # SOFTWARE. from ansys.aedt.core.application.analysis import Analysis +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic.settings import settings -class AnalysisCircuitNetlist(Analysis, object): +class AnalysisCircuitNetlist(Analysis, PyAedtBase): """Provides the Circuit Netlist (CircuitNetlist) interface. Circuit Netlist Editor has no setup, solution, analysis or postprocessor diff --git a/src/ansys/aedt/core/application/analysis_hf.py b/src/ansys/aedt/core/application/analysis_hf.py index 93170535ec6..abc3fc85018 100644 --- a/src/ansys/aedt/core/application/analysis_hf.py +++ b/src/ansys/aedt/core/application/analysis_hf.py @@ -22,10 +22,11 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic.general_methods import pyaedt_function_handler -class ScatteringMethods(object): +class ScatteringMethods(PyAedtBase): """Class containing all methods related to scattering matrix management that are common to Hfss, Circuit and Hfss3dLayout classes. """ diff --git a/src/ansys/aedt/core/application/analysis_icepak.py b/src/ansys/aedt/core/application/analysis_icepak.py index 7ae520991f8..43006e5bebc 100644 --- a/src/ansys/aedt/core/application/analysis_icepak.py +++ b/src/ansys/aedt/core/application/analysis_icepak.py @@ -27,12 +27,13 @@ from ansys.aedt.core.application.analysis_3d import FieldAnalysis3D from ansys.aedt.core.application.design import DesignSettingsManipulation +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic.configurations import ConfigurationsIcepak from ansys.aedt.core.generic.settings import settings from ansys.aedt.core.modules.boundary.icepak_boundary import BoundaryDictionary -class FieldAnalysisIcepak(FieldAnalysis3D, object): +class FieldAnalysisIcepak(FieldAnalysis3D, PyAedtBase): """Manages Icepak field analysis setup. This class is automatically initialized by an application call from one Icepak. @@ -177,7 +178,7 @@ def monitor(self): return self._monitor -class IcepakDesignSettingsManipulation(DesignSettingsManipulation): +class IcepakDesignSettingsManipulation(DesignSettingsManipulation, PyAedtBase): """Manages Icepak design settings. This class provides methods to modify specific design settings like ambient temperature, diff --git a/src/ansys/aedt/core/application/analysis_maxwell_circuit.py b/src/ansys/aedt/core/application/analysis_maxwell_circuit.py index 41a18fe8457..245afcf387a 100644 --- a/src/ansys/aedt/core/application/analysis_maxwell_circuit.py +++ b/src/ansys/aedt/core/application/analysis_maxwell_circuit.py @@ -23,10 +23,11 @@ # SOFTWARE. from ansys.aedt.core.application.analysis import Analysis +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic.settings import settings -class AnalysisMaxwellCircuit(Analysis): +class AnalysisMaxwellCircuit(Analysis, PyAedtBase): """Provides the Maxwell Circuit (MaxwellCircuit) interface. Maxwell Circuit Editor has no setup, solution, analysis or postprocessor diff --git a/src/ansys/aedt/core/application/analysis_nexxim.py b/src/ansys/aedt/core/application/analysis_nexxim.py index 6b138315a00..8153720a44e 100644 --- a/src/ansys/aedt/core/application/analysis_nexxim.py +++ b/src/ansys/aedt/core/application/analysis_nexxim.py @@ -24,6 +24,7 @@ import warnings from ansys.aedt.core.application.analysis import Analysis +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic.configurations import ConfigurationsNexxim from ansys.aedt.core.generic.general_methods import pyaedt_function_handler from ansys.aedt.core.generic.settings import settings @@ -40,7 +41,7 @@ from ansys.aedt.core.modules.solve_setup import SetupCircuit -class FieldAnalysisCircuit(Analysis): +class FieldAnalysisCircuit(Analysis, PyAedtBase): """FieldCircuitAnalysis class. This class is for circuit analysis setup in Nexxim. diff --git a/src/ansys/aedt/core/application/analysis_r_m_xprt.py b/src/ansys/aedt/core/application/analysis_r_m_xprt.py index 44ed7582c86..e3d28008cdc 100644 --- a/src/ansys/aedt/core/application/analysis_r_m_xprt.py +++ b/src/ansys/aedt/core/application/analysis_r_m_xprt.py @@ -23,11 +23,12 @@ # SOFTWARE. from ansys.aedt.core.application.analysis import Analysis +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic.general_methods import pyaedt_function_handler from ansys.aedt.core.generic.settings import settings -class FieldAnalysisRMxprt(Analysis): +class FieldAnalysisRMxprt(Analysis, PyAedtBase): """Manages RMXprt field analysis setup. (To be implemented.) This class is automatically initialized by an application call (like HFSS, diff --git a/src/ansys/aedt/core/application/analysis_twin_builder.py b/src/ansys/aedt/core/application/analysis_twin_builder.py index eeb3697dbda..c5a85c1ecae 100644 --- a/src/ansys/aedt/core/application/analysis_twin_builder.py +++ b/src/ansys/aedt/core/application/analysis_twin_builder.py @@ -24,13 +24,14 @@ import warnings from ansys.aedt.core.application.analysis import Analysis +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic.general_methods import pyaedt_function_handler from ansys.aedt.core.generic.settings import settings from ansys.aedt.core.modules.setup_templates import SetupKeys from ansys.aedt.core.modules.solve_setup import SetupCircuit -class AnalysisTwinBuilder(Analysis): +class AnalysisTwinBuilder(Analysis, PyAedtBase): """Provides the Twin Builder Analysis Setup (TwinBuilder). It is automatically initialized by Application call (Twin Builder). diff --git a/src/ansys/aedt/core/application/design.py b/src/ansys/aedt/core/application/design.py index 56506287bbe..e085067f6f9 100644 --- a/src/ansys/aedt/core/application/design.py +++ b/src/ansys/aedt/core/application/design.py @@ -59,6 +59,7 @@ from ansys.aedt.core.application.design_solutions import solutions_defaults from ansys.aedt.core.application.variables import DataSet from ansys.aedt.core.application.variables import VariableManager +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.desktop import Desktop from ansys.aedt.core.desktop import exception_to_desktop from ansys.aedt.core.generic.constants import AEDT_UNITS @@ -108,7 +109,7 @@ def load_aedt_thread(project_path) -> None: inner_project_settings.time_stamp = Path(project_path).stat().st_mtime -class Design(AedtObjects): +class Design(AedtObjects, PyAedtBase): """Contains all functions and objects connected to the active project and design. This class is inherited in the caller application and is accessible through it for @@ -4323,7 +4324,7 @@ def __init_desktop_from_design(cls, *args, **kwargs): return Desktop(*args, **kwargs) -class DesignSettings: +class DesignSettings(PyAedtBase): """Get design settings for the current AEDT app. References @@ -4384,7 +4385,7 @@ def available_properties(self) -> List[str]: return [prop for prop in self.design_settings.GetPropNames() if not prop.endswith("/Choices")] -class DesignSettingsManipulation: +class DesignSettingsManipulation(PyAedtBase): @abstractmethod def execute(self, k: str, v: Any) -> Any: pass diff --git a/src/ansys/aedt/core/application/design_solutions.py b/src/ansys/aedt/core/application/design_solutions.py index a782da63407..d111d7e83db 100644 --- a/src/ansys/aedt/core/application/design_solutions.py +++ b/src/ansys/aedt/core/application/design_solutions.py @@ -25,6 +25,7 @@ import copy from ansys.aedt.core.aedt_logger import pyaedt_logger as logger +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic.general_methods import pyaedt_function_handler solutions_defaults = { @@ -664,7 +665,7 @@ } -class DesignSolution(object): +class DesignSolution(PyAedtBase): def __init__(self, odesign, design_type, aedt_version): self._odesign = odesign self._aedt_version = aedt_version @@ -758,7 +759,7 @@ def intrinsics(self): return [] -class HFSSDesignSolution(DesignSolution, object): +class HFSSDesignSolution(DesignSolution, PyAedtBase): def __init__(self, odesign, design_type, aedt_version): DesignSolution.__init__(self, odesign, design_type, aedt_version) self._composite = False @@ -908,7 +909,7 @@ def set_auto_open(self, enable=True, opening_type="Radiation"): return True -class Maxwell2DDesignSolution(DesignSolution, object): +class Maxwell2DDesignSolution(DesignSolution, PyAedtBase): def __init__(self, odesign, design_type, aedt_version): DesignSolution.__init__(self, odesign, design_type, aedt_version) self._geometry_mode = "XY" @@ -968,7 +969,7 @@ def solution_type(self, value): logger.error("Failed to set solution type.") -class IcepakDesignSolution(DesignSolution, object): +class IcepakDesignSolution(DesignSolution, PyAedtBase): def __init__(self, odesign, design_type, aedt_version): DesignSolution.__init__(self, odesign, design_type, aedt_version) self._problem_type = "TemperatureAndFlow" @@ -1047,7 +1048,7 @@ def solution_type(self, solution_type): logger.error("Failed to set solution type.") -class RmXprtDesignSolution(DesignSolution, object): +class RmXprtDesignSolution(DesignSolution, PyAedtBase): def __init__(self, odesign, design_type, aedt_version): DesignSolution.__init__(self, odesign, design_type, aedt_version) diff --git a/src/ansys/aedt/core/application/variables.py b/src/ansys/aedt/core/application/variables.py index a431866a62c..c40593320ad 100644 --- a/src/ansys/aedt/core/application/variables.py +++ b/src/ansys/aedt/core/application/variables.py @@ -43,6 +43,7 @@ import types import warnings +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic.constants import AEDT_UNITS from ansys.aedt.core.generic.constants import SI_UNITS from ansys.aedt.core.generic.constants import _resolve_unit_system @@ -57,7 +58,7 @@ from ansys.aedt.core.internal.errors import GrpcApiError -class CSVDataset: +class CSVDataset(PyAedtBase): """Reads in a CSV file and extracts data, which can be augmented with constant values. Parameters @@ -304,7 +305,7 @@ def generate_validation_errors(property_names, expected_settings, actual_setting return validation_errors -class VariableManager(object): +class VariableManager(PyAedtBase): """Manages design properties and project variables. Design properties are the local variables in a design. Project @@ -1334,7 +1335,7 @@ def _get_var_list_from_aedt(self, desktop_object): return var_list -class Variable(object): +class Variable(PyAedtBase): """Stores design properties and project variables and provides operations to perform on them. Parameters @@ -2099,7 +2100,7 @@ def __rtruediv__(self, other): # return self.__rtruediv__(other) -class DataSet(object): +class DataSet(PyAedtBase): """Manages datasets. Parameters diff --git a/src/ansys/aedt/core/base.py b/src/ansys/aedt/core/base.py new file mode 100644 index 00000000000..c3884f7eea4 --- /dev/null +++ b/src/ansys/aedt/core/base.py @@ -0,0 +1,74 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2025 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + + +class DirMixin: + """ + Mixin that adds a `.public_dir` property as a shorthand for the built-in `dir()` function. + + This is primarily intended to make interactive exploration and autocomplete faster. + Instead of typing `dir(obj)`, you can type `obj.public_dir`. + + Example + ------- + >>> class Example(DirMixin): + ... def foo(self): + ... pass + >>> e = Example() + >>> e.public_dir # same as dir(e) + """ + + def __dir__(self): + # Get default attribute list, there is a fallback for Python 2 or weird metaclasses + attrs = super().__dir__() if hasattr(super(), "__dir__") else dir(type(self)) + # Split public vs private + private = sorted((a for a in attrs if a.startswith("_")), key=str.lower) + public = sorted((a for a in attrs if not a.startswith("_")), key=str.lower) + # Return public first, private at the end + return public + private + + @property + def public_dir(self): + """Shortcut for dir(self).""" + return sorted(i for i in dir(self) if not i.startswith("_") and i != "public_dir") + + +class PyAedtBase(DirMixin): + """ + Common base class for all PyAEDT classes. + + Inherits from `DirMixin` to provide the `.public_dir` property for quick + interactive exploration. This class acts as a central place to + consolidate future mixins or shared functionality. + + Notes + ----- + - Prefer placing `Base` at the rightmost position in multiple inheritance + to avoid unintentionally overriding behavior from other base classes. + - Python's method resolution order (MRO) ensures that if `Base` is + inherited multiple times through different paths, it will only appear + once in the hierarchy. + """ + + pass diff --git a/src/ansys/aedt/core/circuit.py b/src/ansys/aedt/core/circuit.py index 1b5c8b531dd..e27d327ca71 100644 --- a/src/ansys/aedt/core/circuit.py +++ b/src/ansys/aedt/core/circuit.py @@ -33,6 +33,7 @@ from ansys.aedt.core.application.analysis_hf import ScatteringMethods from ansys.aedt.core.application.analysis_nexxim import FieldAnalysisCircuit +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic import ibis_reader from ansys.aedt.core.generic.constants import Setups from ansys.aedt.core.generic.constants import unit_converter @@ -56,7 +57,7 @@ from ansys.aedt.core.modules.circuit_templates import SourceKeys -class Circuit(FieldAnalysisCircuit, ScatteringMethods): +class Circuit(FieldAnalysisCircuit, ScatteringMethods, PyAedtBase): """Provides the Circuit application interface. Parameters diff --git a/src/ansys/aedt/core/circuit_netlist.py b/src/ansys/aedt/core/circuit_netlist.py index b6eb3bb207a..555a6036ab8 100644 --- a/src/ansys/aedt/core/circuit_netlist.py +++ b/src/ansys/aedt/core/circuit_netlist.py @@ -28,11 +28,12 @@ import shutil from ansys.aedt.core.application.analysis_circuit_netlist import AnalysisCircuitNetlist +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic.general_methods import pyaedt_function_handler from ansys.aedt.core.internal.filesystem import search_files -class CircuitNetlist(AnalysisCircuitNetlist, object): +class CircuitNetlist(AnalysisCircuitNetlist, PyAedtBase): """Provides the Circuit Netlist application interface. Parameters diff --git a/src/ansys/aedt/core/desktop.py b/src/ansys/aedt/core/desktop.py index 2f06576e696..a4d9b661857 100644 --- a/src/ansys/aedt/core/desktop.py +++ b/src/ansys/aedt/core/desktop.py @@ -53,6 +53,7 @@ from ansys.aedt.core import __version__ from ansys.aedt.core.aedt_logger import AedtLogger from ansys.aedt.core.aedt_logger import pyaedt_logger +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic.file_utils import available_license_feature from ansys.aedt.core.generic.file_utils import generate_unique_name from ansys.aedt.core.generic.file_utils import open_file @@ -323,7 +324,7 @@ def is_student_version(oDesktop): return False -class Desktop(object): +class Desktop(PyAedtBase): """Provides the Ansys Electronics Desktop (AEDT) interface. Parameters diff --git a/src/ansys/aedt/core/emit.py b/src/ansys/aedt/core/emit.py index e05cdb37871..95af008a4b8 100644 --- a/src/ansys/aedt/core/emit.py +++ b/src/ansys/aedt/core/emit.py @@ -26,6 +26,7 @@ from ansys.aedt.core import emit_core from ansys.aedt.core.application.design import Design +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.emit_core.couplings import CouplingsEmit from ansys.aedt.core.emit_core.emit_constants import EMIT_VALID_UNITS from ansys.aedt.core.emit_core.emit_constants import emit_unit_type_string_to_enum @@ -35,7 +36,7 @@ from ansys.aedt.core.modeler.schematic import ModelerEmit -class Emit(Design, object): +class Emit(Design, PyAedtBase): """Provides the EMIT application interface. Parameters diff --git a/src/ansys/aedt/core/extensions/misc.py b/src/ansys/aedt/core/extensions/misc.py index fb41c11fbc8..78f154c1bb7 100644 --- a/src/ansys/aedt/core/extensions/misc.py +++ b/src/ansys/aedt/core/extensions/misc.py @@ -47,6 +47,7 @@ import requests from ansys.aedt.core import Desktop +from ansys.aedt.core.base import PyAedtBase import ansys.aedt.core.extensions from ansys.aedt.core.generic.design_types import get_pyaedt_app from ansys.aedt.core.generic.general_methods import active_sessions @@ -160,11 +161,11 @@ def to_tuple(v: str): @dataclass -class ExtensionCommonData: +class ExtensionCommonData(PyAedtBase): """Data class containing user input and computed data.""" -class ExtensionCommon: +class ExtensionCommon(PyAedtBase): def __init__( self, title: str, @@ -681,7 +682,7 @@ def get_arguments(args=None, description=""): # pragma: no cover return output_args -class ExtensionTheme: # pragma: no cover +class ExtensionTheme(PyAedtBase): # pragma: no cover def __init__(self): # Define light and dark theme colors self.light = { diff --git a/src/ansys/aedt/core/filtersolutions.py b/src/ansys/aedt/core/filtersolutions.py index b3e4bcedfca..3cedcf4401c 100644 --- a/src/ansys/aedt/core/filtersolutions.py +++ b/src/ansys/aedt/core/filtersolutions.py @@ -28,6 +28,7 @@ from ansys.aedt.core import Hfss from ansys.aedt.core import Hfss3dLayout from ansys.aedt.core import settings +from ansys.aedt.core.base import PyAedtBase import ansys.aedt.core.filtersolutions_core from ansys.aedt.core.filtersolutions_core.attributes import Attributes from ansys.aedt.core.filtersolutions_core.distributed_geometry import DistributedGeometry @@ -49,7 +50,7 @@ from ansys.aedt.core.filtersolutions_core.transmission_zeros import TransmissionZeros -class FilterDesignBase: +class FilterDesignBase(PyAedtBase): """Provides the `FilterSolutions` main parameters applicable for all design types.""" _active_design = None diff --git a/src/ansys/aedt/core/generic/configurations.py b/src/ansys/aedt/core/generic/configurations.py index ad8c6452bfc..ff1a8db212f 100644 --- a/src/ansys/aedt/core/generic/configurations.py +++ b/src/ansys/aedt/core/generic/configurations.py @@ -36,6 +36,7 @@ import ansys.aedt.core from ansys.aedt.core import __version__ +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic.data_handlers import _arg2dict from ansys.aedt.core.generic.file_utils import generate_unique_folder_name from ansys.aedt.core.generic.file_utils import generate_unique_name @@ -84,7 +85,7 @@ def _find_datasets(d, out_list): out_list.append(val[val.find("$") : val.find(",")]) -class ConfigurationsOptions(object): +class ConfigurationsOptions(PyAedtBase): """Options class for the configurations. User can enable or disable import export components. """ @@ -666,7 +667,7 @@ def set_all_import(self): return True -class ImportResults(object): +class ImportResults(PyAedtBase): """Contains the results of the import operations. Each result can be ``True`` or ``False``. @@ -708,7 +709,7 @@ def global_import_success(self): return True -class Configurations(object): +class Configurations(PyAedtBase): """Enables export and import of a JSON configuration file that can be applied to a new or existing design.""" def __init__(self, app): @@ -1528,7 +1529,7 @@ def export_config(self, config_file=None, overwrite=False): return False -class ConfigurationOptionsIcepak(ConfigurationsOptions): +class ConfigurationOptionsIcepak(ConfigurationsOptions, PyAedtBase): def __init__(self, app): ConfigurationsOptions.__init__(self) self._export_monitor = True @@ -1569,7 +1570,7 @@ def export_native_components(self, val): self._export_native_components = val -class ConfigurationOptions3DLayout(ConfigurationsOptions): +class ConfigurationOptions3DLayout(ConfigurationsOptions, PyAedtBase): def __init__(self, app): ConfigurationsOptions.__init__(self) self._export_mesh_operations = False @@ -1582,7 +1583,7 @@ def __init__(self, app): self._import_object_properties = False -class Configurations3DLayout(Configurations): +class Configurations3DLayout(Configurations, PyAedtBase): """Enables export and import configuration options to be applied to a new or existing 3DLayout design.""" def __init__(self, app): @@ -1590,7 +1591,7 @@ def __init__(self, app): self.options = ConfigurationOptions3DLayout(app) -class ConfigurationsIcepak(Configurations): +class ConfigurationsIcepak(Configurations, PyAedtBase): """Enables export and import configuration options to be applied on a new or existing design.""" def __init__(self, app): @@ -2182,7 +2183,7 @@ def apply_operations_to_native_components(obj, operation_dict, native_dict): # return True -class ConfigurationsNexxim(Configurations): +class ConfigurationsNexxim(Configurations, PyAedtBase): """Enables export and import configuration options to be applied to a new or existing Nexxim design.""" @pyaedt_function_handler() diff --git a/src/ansys/aedt/core/generic/general_methods.py b/src/ansys/aedt/core/generic/general_methods.py index bd3741c594b..886323097a0 100644 --- a/src/ansys/aedt/core/generic/general_methods.py +++ b/src/ansys/aedt/core/generic/general_methods.py @@ -42,6 +42,7 @@ import psutil from ansys.aedt.core.aedt_logger import pyaedt_logger +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic.numbers_utils import _units_assignment from ansys.aedt.core.generic.settings import settings from ansys.aedt.core.internal.errors import AEDTRuntimeError @@ -880,7 +881,7 @@ def conversion_function(data, function=None): # pragma: no cover return data -class PropsManager(object): +class PropsManager(PyAedtBase): def __getitem__(self, item): """Get the `self.props` key value. @@ -1103,7 +1104,7 @@ def install_with_pip(package_name, package_path=None, upgrade=False, uninstall=F raise AEDTRuntimeError("An error occurred while installing with pip") from e -class Help: # pragma: no cover +class Help(PyAedtBase): # pragma: no cover def __init__(self): self._base_path = "https://aedt.docs.pyansys.com/version/stable" self.browser = "default" diff --git a/src/ansys/aedt/core/generic/ibis_reader.py b/src/ansys/aedt/core/generic/ibis_reader.py index af2ed4c702f..ed1d141698d 100644 --- a/src/ansys/aedt/core/generic/ibis_reader.py +++ b/src/ansys/aedt/core/generic/ibis_reader.py @@ -28,13 +28,14 @@ import traceback from ansys.aedt.core.aedt_logger import pyaedt_logger as logger +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic.file_utils import check_and_download_file from ansys.aedt.core.generic.file_utils import check_if_path_exists from ansys.aedt.core.generic.file_utils import get_filename_without_extension from ansys.aedt.core.generic.file_utils import open_file -class Component: +class Component(PyAedtBase): """Component extracted from ibis model.""" def __init__(self): @@ -116,7 +117,7 @@ def differential_pins(self, value): self._differential_pins = value -class Pin: +class Pin(PyAedtBase): """Pin from a component with all its data feature. Parameters @@ -327,7 +328,7 @@ def insert(self, x, y, angle=0.0): ) -class DifferentialPin: +class DifferentialPin(PyAedtBase): """Provides the differential pin from a component with all its data feature. Parameters @@ -493,7 +494,7 @@ def insert(self, x, y, angle=0.0): ) -class Buffer: +class Buffer(PyAedtBase): def __init__(self, ibis_name, short_name, app): self._ibis_name = ibis_name self._short_name = short_name @@ -559,7 +560,7 @@ def insert(self, x, y, angle=0.0): ) -class ModelSelector: +class ModelSelector(PyAedtBase): def __init__(self): self._model_selector_items = [] self._name = None @@ -583,7 +584,7 @@ def name(self, value): self._name = value -class ModelSelectorItem: +class ModelSelectorItem(PyAedtBase): def __init__(self): self._description = [] self._name = None @@ -607,7 +608,7 @@ def name(self, value): self._name = value -class Model: +class Model(PyAedtBase): def __init__(self): self._description = [] self._name = None @@ -671,7 +672,7 @@ def c_comp(self, value): self._c_comp = value -class Ibis: +class Ibis(PyAedtBase): """Ibis model with all data extracted: name, components, models. Parameters @@ -733,7 +734,7 @@ def buffers(self, value): self._buffers = value -class AMI: +class AMI(PyAedtBase): """Ibis-AMI model with all data extracted: name, components, models. Parameters @@ -795,7 +796,7 @@ def buffers(self, value): self._buffers = value -class IbisReader(object): +class IbisReader(PyAedtBase): """Reads *.ibis file content. Setup an Ibis object exposing all the extracted data. @@ -1229,7 +1230,7 @@ def get_first_parameter(cls, line): return data[0].strip() -class AMIReader(IbisReader): +class AMIReader(IbisReader, PyAedtBase): """Reads *.ibis file content. Setup an Ibis object exposing all the extracted data. diff --git a/src/ansys/aedt/core/generic/math_utils.py b/src/ansys/aedt/core/generic/math_utils.py index f890958174f..5d8d21a9d88 100644 --- a/src/ansys/aedt/core/generic/math_utils.py +++ b/src/ansys/aedt/core/generic/math_utils.py @@ -25,10 +25,11 @@ import math from sys import float_info +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic.general_methods import pyaedt_function_handler -class MathUtils: +class MathUtils(PyAedtBase): """MathUtils is a utility class that provides methods for numerical comparisons and checks.""" EPSILON = float_info.epsilon * 10.0 diff --git a/src/ansys/aedt/core/generic/numbers_utils.py b/src/ansys/aedt/core/generic/numbers_utils.py index 9ec8485a6f4..dcf09a7d2fd 100644 --- a/src/ansys/aedt/core/generic/numbers_utils.py +++ b/src/ansys/aedt/core/generic/numbers_utils.py @@ -27,13 +27,14 @@ from typing import Any from typing import Dict +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic.constants import AEDT_UNITS from ansys.aedt.core.generic.constants import SI_UNITS from ansys.aedt.core.generic.constants import unit_converter from ansys.aedt.core.generic.constants import unit_system -class Quantity(float): +class Quantity(float, PyAedtBase): """Stores a number with its unit. Parameters diff --git a/src/ansys/aedt/core/generic/python_optimizers.py b/src/ansys/aedt/core/generic/python_optimizers.py index 8ee5ad2a123..e994e7539de 100644 --- a/src/ansys/aedt/core/generic/python_optimizers.py +++ b/src/ansys/aedt/core/generic/python_optimizers.py @@ -27,6 +27,8 @@ import numpy as np +from ansys.aedt.core.base import PyAedtBase + class ThreadTrace(threading.Thread): """Control a thread with python""" @@ -61,7 +63,7 @@ def kill(self): self.killed = True -class GeneticAlgorithm(object): +class GeneticAlgorithm(PyAedtBase): """Genetic Algorithm for Python Basic implementation of elitist genetic algorithm for solving problems with integers, continuous, boolean diff --git a/src/ansys/aedt/core/generic/quaternion.py b/src/ansys/aedt/core/generic/quaternion.py index 62c658bda76..c1c35cfa8cf 100644 --- a/src/ansys/aedt/core/generic/quaternion.py +++ b/src/ansys/aedt/core/generic/quaternion.py @@ -24,12 +24,13 @@ import math +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic.general_methods import pyaedt_function_handler from ansys.aedt.core.generic.math_utils import MathUtils from ansys.aedt.core.modeler.geometry_operators import GeometryOperators -class Quaternion: +class Quaternion(PyAedtBase): """ Implements fundamental quaternion operations. diff --git a/src/ansys/aedt/core/generic/scheduler.py b/src/ansys/aedt/core/generic/scheduler.py index 1baa32e4725..b7abc733ff9 100644 --- a/src/ansys/aedt/core/generic/scheduler.py +++ b/src/ansys/aedt/core/generic/scheduler.py @@ -35,6 +35,8 @@ from typing import Optional from typing import Union +from ansys.aedt.core.base import PyAedtBase + DEFAULT_AUTO_HPC = False """Default setting for Auto HPC.""" DEFAULT_CLUSTER_NAME = "ClusterName" @@ -396,7 +398,7 @@ class _ExecutionConfiguration: wait_for_license: bool = True -class JobConfigurationData: +class JobConfigurationData(PyAedtBase): def __init__( self, aedt_version: Optional[str] = None, diff --git a/src/ansys/aedt/core/generic/settings.py b/src/ansys/aedt/core/generic/settings.py index 63ae4873aa0..8663f42de4e 100644 --- a/src/ansys/aedt/core/generic/settings.py +++ b/src/ansys/aedt/core/generic/settings.py @@ -48,6 +48,7 @@ import warnings from ansys.aedt.core import pyaedt_path +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic.scheduler import DEFAULT_CUSTOM_SUBMISSION_STRING from ansys.aedt.core.generic.scheduler import DEFAULT_NUM_CORES @@ -149,7 +150,7 @@ class _InnerProjectSettings: # pragma: no cover time_stamp: Union[int, float] = 0 -class Settings(object): +class Settings(PyAedtBase): """Manages all PyAEDT environment variables and global settings.""" def __init__(self): diff --git a/src/ansys/aedt/core/hfss.py b/src/ansys/aedt/core/hfss.py index 72848eb1cf8..3efae0596ff 100644 --- a/src/ansys/aedt/core/hfss.py +++ b/src/ansys/aedt/core/hfss.py @@ -35,6 +35,7 @@ from ansys.aedt.core.application.analysis_3d import FieldAnalysis3D from ansys.aedt.core.application.analysis_hf import ScatteringMethods +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic.constants import InfiniteSphereType from ansys.aedt.core.generic.constants import SolutionsHfss from ansys.aedt.core.generic.data_handlers import _dict2arg @@ -62,7 +63,7 @@ from ansys.aedt.core.modules.setup_templates import SetupKeys -class Hfss(FieldAnalysis3D, ScatteringMethods, CreateBoundaryMixin): +class Hfss(FieldAnalysis3D, ScatteringMethods, CreateBoundaryMixin, PyAedtBase): """Provides the HFSS application interface. This class allows you to create an interactive instance of HFSS and @@ -292,7 +293,7 @@ def field_setup_names(self): """ return self.odesign.GetChildObject("Radiation").GetChildNames() - class BoundaryType(CreateBoundaryMixin): + class BoundaryType(CreateBoundaryMixin, PyAedtBase): """Creates and manages boundaries.""" ( diff --git a/src/ansys/aedt/core/hfss3dlayout.py b/src/ansys/aedt/core/hfss3dlayout.py index bba65aaab82..1795236d659 100644 --- a/src/ansys/aedt/core/hfss3dlayout.py +++ b/src/ansys/aedt/core/hfss3dlayout.py @@ -32,6 +32,7 @@ from ansys.aedt.core.application.analysis_3d_layout import FieldAnalysis3DLayout from ansys.aedt.core.application.analysis_hf import ScatteringMethods +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic.file_utils import generate_unique_name from ansys.aedt.core.generic.file_utils import open_file from ansys.aedt.core.generic.file_utils import parse_excitation_file @@ -42,7 +43,7 @@ from ansys.aedt.core.modules.boundary.layout_boundary import BoundaryObject3dLayout -class Hfss3dLayout(FieldAnalysis3DLayout, ScatteringMethods): +class Hfss3dLayout(FieldAnalysis3DLayout, ScatteringMethods, PyAedtBase): """Provides the HFSS 3D Layout application interface. This class inherits all objects that belong to HFSS 3D Layout, including EDB diff --git a/src/ansys/aedt/core/icepak.py b/src/ansys/aedt/core/icepak.py index 81c2ee369c4..99acab2f21e 100644 --- a/src/ansys/aedt/core/icepak.py +++ b/src/ansys/aedt/core/icepak.py @@ -31,6 +31,7 @@ import warnings from ansys.aedt.core.application.analysis_icepak import FieldAnalysisIcepak +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic.constants import Plane from ansys.aedt.core.generic.constants import SolutionsIcepak from ansys.aedt.core.generic.data_handlers import _arg2dict @@ -60,7 +61,7 @@ from ansys.aedt.core.modules.setup_templates import SetupKeys -class Icepak(FieldAnalysisIcepak, CreateBoundaryMixin): +class Icepak(FieldAnalysisIcepak, CreateBoundaryMixin, PyAedtBase): """Provides the Icepak application interface. This class allows you to connect to an existing Icepak design or create a diff --git a/src/ansys/aedt/core/internal/aedt_versions.py b/src/ansys/aedt/core/internal/aedt_versions.py index 9fdf5057170..b032a5eb1d7 100644 --- a/src/ansys/aedt/core/internal/aedt_versions.py +++ b/src/ansys/aedt/core/internal/aedt_versions.py @@ -34,12 +34,13 @@ import re import warnings +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic.settings import settings CURRENT_STABLE_AEDT_VERSION = 2025.2 -class AedtVersions: +class AedtVersions(PyAedtBase): """Class to get the AEDT versions on the system. It caches the data to avoid inspecting the environment variables multiple times. diff --git a/src/ansys/aedt/core/internal/filesystem.py b/src/ansys/aedt/core/internal/filesystem.py index 608c61df2e5..080b076d804 100644 --- a/src/ansys/aedt/core/internal/filesystem.py +++ b/src/ansys/aedt/core/internal/filesystem.py @@ -29,6 +29,7 @@ import string from ansys.aedt.core.aedt_logger import pyaedt_logger as logger +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic.file_utils import _uname @@ -52,7 +53,7 @@ def my_location(): return Path(__file__).parent.resolve(strict=False) -class Scratch: +class Scratch(PyAedtBase): """ """ @property diff --git a/src/ansys/aedt/core/maxwell.py b/src/ansys/aedt/core/maxwell.py index 0296784be4f..5076e4888ed 100644 --- a/src/ansys/aedt/core/maxwell.py +++ b/src/ansys/aedt/core/maxwell.py @@ -30,6 +30,7 @@ import time from ansys.aedt.core.application.analysis_3d import FieldAnalysis3D +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic.constants import SolutionsMaxwell2D from ansys.aedt.core.generic.constants import SolutionsMaxwell3D from ansys.aedt.core.generic.file_utils import generate_unique_name @@ -48,7 +49,7 @@ from ansys.aedt.core.modules.setup_templates import SetupKeys -class Maxwell(CreateBoundaryMixin): +class Maxwell(CreateBoundaryMixin, PyAedtBase): def __init__(self): pass @@ -2689,7 +2690,7 @@ def _create_boundary(self, name, props, boundary_type): raise AEDTRuntimeError(f"Failed to create boundary {boundary_type} {name}") -class Maxwell3d(Maxwell, FieldAnalysis3D, object): +class Maxwell3d(Maxwell, FieldAnalysis3D, PyAedtBase): """Provides the Maxwell 3D app interface. This class allows you to connect to an existing Maxwell 3D design or create a @@ -3689,7 +3690,7 @@ def order_coil_terminals(self, winding_name, list_of_terminals): return True -class Maxwell2d(Maxwell, FieldAnalysis3D, object): +class Maxwell2d(Maxwell, FieldAnalysis3D, PyAedtBase): """Provides the Maxwell 2D app interface. This class allows you to connect to an existing Maxwell 2D design or create a diff --git a/src/ansys/aedt/core/maxwellcircuit.py b/src/ansys/aedt/core/maxwellcircuit.py index 515b02e8fd9..4f41cf740ff 100644 --- a/src/ansys/aedt/core/maxwellcircuit.py +++ b/src/ansys/aedt/core/maxwellcircuit.py @@ -28,11 +28,12 @@ from pathlib import Path from ansys.aedt.core.application.analysis_maxwell_circuit import AnalysisMaxwellCircuit +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic.file_utils import open_file from ansys.aedt.core.generic.general_methods import pyaedt_function_handler -class MaxwellCircuit(AnalysisMaxwellCircuit, object): +class MaxwellCircuit(AnalysisMaxwellCircuit, PyAedtBase): """Provide the Maxwell Circuit application interface. Parameters diff --git a/src/ansys/aedt/core/mechanical.py b/src/ansys/aedt/core/mechanical.py index df63034a899..4b543f3855c 100644 --- a/src/ansys/aedt/core/mechanical.py +++ b/src/ansys/aedt/core/mechanical.py @@ -25,6 +25,7 @@ """This module contains the ``Mechanical`` class.""" from ansys.aedt.core.application.analysis_3d import FieldAnalysis3D +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic.constants import SolutionsMechanical from ansys.aedt.core.generic.file_utils import generate_unique_name from ansys.aedt.core.generic.general_methods import pyaedt_function_handler @@ -33,7 +34,7 @@ from ansys.aedt.core.modules.setup_templates import SetupKeys -class Mechanical(FieldAnalysis3D, CreateBoundaryMixin): +class Mechanical(FieldAnalysis3D, CreateBoundaryMixin, PyAedtBase): """Provides the Mechanical application interface. Parameters diff --git a/src/ansys/aedt/core/modeler/advanced_cad/actors.py b/src/ansys/aedt/core/modeler/advanced_cad/actors.py index 8e0d32b5711..e091a07d87a 100644 --- a/src/ansys/aedt/core/modeler/advanced_cad/actors.py +++ b/src/ansys/aedt/core/modeler/advanced_cad/actors.py @@ -22,6 +22,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic.file_utils import read_json from ansys.aedt.core.generic.general_methods import pyaedt_function_handler from ansys.aedt.core.modeler.advanced_cad.multiparts import Actor @@ -50,7 +51,7 @@ def read_actors(fn, actor_lib): return a -class Generic(Actor, object): +class Generic(Actor, PyAedtBase): """Provides an instance of an actor. This class is derived from :class:`ansys.aedt.core.modeler.multiparts.MultiPartComponent`. @@ -77,7 +78,7 @@ def __init__(self, actor_folder, speed="0", relative_cs_name=None): super(Generic, self).__init__(actor_folder, speed=speed, relative_cs_name=relative_cs_name) -class Person(Actor, object): +class Person(Actor, PyAedtBase): """Provides an instance of a person. This class is derived from :class:`ansys.aedt.core.modeler.multiparts.MultiPartComponent`. @@ -169,7 +170,7 @@ def insert(self, app, motion=True): self._add_walking(app) -class Bird(Actor, object): +class Bird(Actor, PyAedtBase): """Provides an instance of a bird. This class is derived from :class:`ansys.aedt.core.modeler.multiparts.MultiPartComponent`. @@ -231,7 +232,7 @@ def insert(self, app, motion=True): self._add_flying(app) -class Vehicle(Actor, object): +class Vehicle(Actor, PyAedtBase): """Provides an instance of a vehicle. This class is derived from :class:`ansys.aedt.core.modeler.multiparts.MultiPartComponent`. @@ -297,7 +298,7 @@ def insert(self, app, motion=True): return True -class Radar(MultiPartComponent, object): +class Radar(MultiPartComponent, PyAedtBase): """Manages the radar definition and placement in the HFSS design. Parameters diff --git a/src/ansys/aedt/core/modeler/advanced_cad/choke.py b/src/ansys/aedt/core/modeler/advanced_cad/choke.py index c17a93e1882..2becc496eee 100644 --- a/src/ansys/aedt/core/modeler/advanced_cad/choke.py +++ b/src/ansys/aedt/core/modeler/advanced_cad/choke.py @@ -30,6 +30,7 @@ from typing import Any from typing import Dict +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic.file_utils import write_configuration_file from ansys.aedt.core.generic.general_methods import pyaedt_function_handler @@ -85,7 +86,7 @@ @dataclass -class Choke: +class Choke(PyAedtBase): """Class to create chokes in AEDT. Parameters diff --git a/src/ansys/aedt/core/modeler/advanced_cad/coil.py b/src/ansys/aedt/core/modeler/advanced_cad/coil.py index ff0c88b573c..30b59926455 100644 --- a/src/ansys/aedt/core/modeler/advanced_cad/coil.py +++ b/src/ansys/aedt/core/modeler/advanced_cad/coil.py @@ -22,6 +22,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic.general_methods import pyaedt_function_handler from ansys.aedt.core.generic.numbers_utils import Quantity from ansys.aedt.core.modeler.cad.polylines import PolylineSegment @@ -57,7 +58,7 @@ } -class Coil(object): +class Coil(PyAedtBase): """Class to create coils in AEDT. Parameters diff --git a/src/ansys/aedt/core/modeler/advanced_cad/multiparts.py b/src/ansys/aedt/core/modeler/advanced_cad/multiparts.py index 851882c06a9..255018df4c5 100644 --- a/src/ansys/aedt/core/modeler/advanced_cad/multiparts.py +++ b/src/ansys/aedt/core/modeler/advanced_cad/multiparts.py @@ -24,6 +24,7 @@ import os +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic.file_utils import read_configuration_file from ansys.aedt.core.generic.general_methods import pyaedt_function_handler from ansys.aedt.core.internal.filesystem import get_json_files @@ -32,7 +33,7 @@ from ansys.aedt.core.modeler.geometry_operators import GeometryOperators -class MultiPartComponent(object): +class MultiPartComponent(PyAedtBase): """Supports multi-part 3D components for HFSS SBR+. .. note:: @@ -494,7 +495,7 @@ def insert(self, app, motion=False): return self._insert(app, motion=motion) -class Environment(MultiPartComponent, object): +class Environment(MultiPartComponent, PyAedtBase): """Supports multi-part 3D components without motion for HFSS SBR+. This class is derived from :class:`MultiPartComponent`. Its @@ -586,7 +587,7 @@ def offset(self, o): self._offset_values = o -class Actor(MultiPartComponent, object): +class Actor(MultiPartComponent, PyAedtBase): """Provides an instance of an actor. This class is derived from :class:`MultiPartComponent`. diff --git a/src/ansys/aedt/core/modeler/advanced_cad/oms.py b/src/ansys/aedt/core/modeler/advanced_cad/oms.py index 2d76e922570..91574041fc0 100644 --- a/src/ansys/aedt/core/modeler/advanced_cad/oms.py +++ b/src/ansys/aedt/core/modeler/advanced_cad/oms.py @@ -28,6 +28,7 @@ import numpy as np +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic.general_methods import pyaedt_function_handler from ansys.aedt.core.generic.general_methods import settings from ansys.aedt.core.internal.checks import graphics_required @@ -42,7 +43,7 @@ ZONE_LETTERS = "CDEFGHJKLMNPQRSTUVWXX" -class BuildingsPrep(object): +class BuildingsPrep(PyAedtBase): """Contains all basic functions needed to generate buildings stl files.""" def __init__(self, cad_path): @@ -251,7 +252,7 @@ def generate_buildings(self, center_lat_lon, terrain_mesh, max_radius=500): return {"file_name": file_out, "mesh": building_meshes, "temp": temp} -class RoadPrep(object): +class RoadPrep(PyAedtBase): """Contains all basic functions needed to generate road stl files.""" def __init__(self, cad_path): @@ -373,7 +374,7 @@ def create_roads(self, center_lat_lon, terrain_mesh, max_radius=1000, z_offset=0 return {"file_name": file_out, "mesh": roads, "graph": g_projected} -class TerrainPrep(object): +class TerrainPrep(PyAedtBase): """Contains all basic functions needed for creating a terrain stl mesh.""" def __init__(self, cad_path="./"): diff --git a/src/ansys/aedt/core/modeler/advanced_cad/parts.py b/src/ansys/aedt/core/modeler/advanced_cad/parts.py index 63fe0d2703b..ecb670a5e38 100644 --- a/src/ansys/aedt/core/modeler/advanced_cad/parts.py +++ b/src/ansys/aedt/core/modeler/advanced_cad/parts.py @@ -24,11 +24,12 @@ import os +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic.general_methods import pyaedt_function_handler from ansys.aedt.core.modeler.geometry_operators import GeometryOperators -class Part(object): +class Part(PyAedtBase): """Manages 3D component placement and definition. Parameters @@ -456,7 +457,7 @@ def insert(self, app): return aedt_objects -class Antenna(Part, object): +class Antenna(Part, PyAedtBase): """Manages antennas. This class is derived from :class:`Part`. diff --git a/src/ansys/aedt/core/modeler/advanced_cad/stackup_3d.py b/src/ansys/aedt/core/modeler/advanced_cad/stackup_3d.py index f45d9f86a75..e9464d08d93 100644 --- a/src/ansys/aedt/core/modeler/advanced_cad/stackup_3d.py +++ b/src/ansys/aedt/core/modeler/advanced_cad/stackup_3d.py @@ -23,6 +23,7 @@ # SOFTWARE. from ansys.aedt.core import constants +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic.file_utils import generate_unique_name from ansys.aedt.core.generic.general_methods import pyaedt_function_handler from ansys.aedt.core.modules.material_lib import Material @@ -62,7 +63,7 @@ def _replace_by_underscore(character, string): return "".join(reformat_name) -class NamedVariable(object): +class NamedVariable(PyAedtBase): """Cast PyAEDT variable object to simplify getters and setters in Stackup3D. Parameters @@ -181,7 +182,7 @@ def read_only_variable(self, value=True): return True -class DuplicatedParametrizedMaterial(object): +class DuplicatedParametrizedMaterial(PyAedtBase): """Provides a class to duplicate a material and manage its duplication in PyAEDT and in AEDT. For each material property a NamedVariable is created as attribute. @@ -286,7 +287,7 @@ def magnetic_loss_tangent(self): return self._magnetic_loss_tangent -class Layer3D(object): +class Layer3D(PyAedtBase): """Provides a class for a management of a parametric layer in 3D Modeler. The Layer3D class is not intended to be used with its constructor, @@ -852,7 +853,7 @@ def add_polygon(self, points, material="copper", is_void=False, poly_name=None): return polygon -class PadstackLayer(object): +class PadstackLayer(PyAedtBase): """Provides a data class for the definition of a padstack layer and relative pad and antipad values.""" def __init__(self, padstack, layer_name, elevation, thickness): @@ -906,7 +907,7 @@ def antipad_radius(self, value): self._antipad_radius = value -class Padstack(object): +class Padstack(PyAedtBase): """Provides the ``Padstack`` class member of Stackup3D.""" def __init__(self, app, stackup, name, material="copper"): @@ -1146,7 +1147,7 @@ def add_via(self, position_x=0, position_y=0, instance_name=None, reference_syst return -class Stackup3D(object): +class Stackup3D(PyAedtBase): """Main Stackup3D Class. Parameters @@ -1763,7 +1764,7 @@ def resize_around_element(self, element, percentage_offset=0.25): return True -class CommonObject(object): +class CommonObject(PyAedtBase): """CommonObject Class in Stackup3D. This class must not be directly used.""" def __init__(self, application): @@ -1875,7 +1876,7 @@ def points_on_layer(self): return [[bb[0], bb[1]], [bb[0], bb[4]], [bb[3], bb[4]], [bb[3], bb[1]]] -class Patch(CommonObject, object): +class Patch(CommonObject, PyAedtBase): """Patch Class in Stackup3D. Create a parametrized patch. It is preferable to use the add_patch method @@ -2519,7 +2520,7 @@ def set_optimal_width(self): self.width.expression = "(c0 * 1000/(2 * " + f + " * sqrt((" + er + " + 1)/2)))mm" -class Trace(CommonObject, object): +class Trace(CommonObject, PyAedtBase): """Trace Class in Stackup3D. Create a parametrized trace. It is preferable to use the add_trace method in the class Layer3D @@ -3193,7 +3194,7 @@ def create_lumped_port(self, reference_layer, opposite_side=False, port_name=Non return port -class Polygon(CommonObject, object): +class Polygon(CommonObject, PyAedtBase): """Polygon Class in Stackup3D. It is preferable to use the add_polygon method in the class Layer3D than directly the class constructor. diff --git a/src/ansys/aedt/core/modeler/cad/component_array.py b/src/ansys/aedt/core/modeler/cad/component_array.py index 1b2c58e0adf..f8836f546e1 100644 --- a/src/ansys/aedt/core/modeler/cad/component_array.py +++ b/src/ansys/aedt/core/modeler/cad/component_array.py @@ -25,6 +25,7 @@ import os import re +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic.constants import AEDT_UNITS from ansys.aedt.core.generic.file_utils import _uname from ansys.aedt.core.generic.file_utils import generate_unique_name @@ -34,7 +35,7 @@ from ansys.aedt.core.internal.errors import AEDTRuntimeError -class ComponentArray(object): +class ComponentArray(PyAedtBase): """Manages object attributes for a 3D component array. Parameters @@ -883,7 +884,7 @@ def __map_coordinate_system_to_id(self): return res -class CellArray(object): +class CellArray(PyAedtBase): """Manages object attributes for a 3D component and a user-defined model. Parameters diff --git a/src/ansys/aedt/core/modeler/cad/components_3d.py b/src/ansys/aedt/core/modeler/cad/components_3d.py index de568318ec9..ea435673cd0 100644 --- a/src/ansys/aedt/core/modeler/cad/components_3d.py +++ b/src/ansys/aedt/core/modeler/cad/components_3d.py @@ -26,6 +26,7 @@ import re import secrets +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.edb import Edb from ansys.aedt.core.generic.data_handlers import _dict2arg from ansys.aedt.core.generic.file_utils import _uname @@ -82,7 +83,7 @@ def _setitem_without_update(self, key, value): dict.__setitem__(self, key, value) -class UserDefinedComponent(object): +class UserDefinedComponent(PyAedtBase): """Manages object attributes for 3DComponent and User Defined Model. Parameters @@ -899,7 +900,7 @@ def edit_definition(self, password=None): return False -class LayoutComponent(object): +class LayoutComponent(PyAedtBase): """Manages object attributes for Layout components. Parameters diff --git a/src/ansys/aedt/core/modeler/cad/elements_3d.py b/src/ansys/aedt/core/modeler/cad/elements_3d.py index 66e243dc493..63beee7078b 100644 --- a/src/ansys/aedt/core/modeler/cad/elements_3d.py +++ b/src/ansys/aedt/core/modeler/cad/elements_3d.py @@ -22,6 +22,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic.general_methods import clamp from ansys.aedt.core.generic.general_methods import pyaedt_function_handler from ansys.aedt.core.generic.general_methods import rgb_color_codes @@ -30,7 +31,7 @@ from ansys.aedt.core.modeler.geometry_operators import GeometryOperators -class EdgeTypePrimitive(object): +class EdgeTypePrimitive(PyAedtBase): """Provides common methods for EdgePrimitive and FacePrimitive.""" @pyaedt_function_handler() @@ -178,7 +179,7 @@ def chamfer(self, left_distance=1, right_distance=None, angle=45, chamfer_type=0 return True -class VertexPrimitive(EdgeTypePrimitive, object): +class VertexPrimitive(EdgeTypePrimitive, PyAedtBase): """Contains the vertex object within the AEDT Desktop Modeler. Parameters @@ -233,7 +234,7 @@ def __repr__(self): return str(self.id) -class EdgePrimitive(EdgeTypePrimitive, object): +class EdgePrimitive(EdgeTypePrimitive, PyAedtBase): """Contains the edge object within the AEDT Desktop Modeler. Parameters @@ -412,7 +413,7 @@ def move_along_normal(self, offset=1.0): return self._object3d._primitives.move_edge(self, offset) -class FacePrimitive(object): +class FacePrimitive(PyAedtBase): """Contains the face object within the AEDT Desktop Modeler. Parameters @@ -926,7 +927,7 @@ def create_object(self, non_model=False): return self._object3d._primitives.create_object_from_face(self, non_model) -class Point(object): +class Point(PyAedtBase): """Manages point attributes for the AEDT 3D Modeler. Parameters @@ -1120,7 +1121,7 @@ def _change_property(self, vPropChange): return self._primitives._change_point_property(vPropChange, self.name) -class Plane(object): +class Plane(PyAedtBase): """Manages plane attributes for the AEDT 3D Modeler. Parameters diff --git a/src/ansys/aedt/core/modeler/cad/modeler.py b/src/ansys/aedt/core/modeler/cad/modeler.py index 0a207727b49..05efb299ce1 100644 --- a/src/ansys/aedt/core/modeler/cad/modeler.py +++ b/src/ansys/aedt/core/modeler/cad/modeler.py @@ -30,6 +30,7 @@ 3D Layout Modeler, and Circuit Modeler. """ +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic.data_handlers import _dict2arg from ansys.aedt.core.generic.file_utils import generate_unique_name from ansys.aedt.core.generic.general_methods import PropsManager @@ -94,7 +95,7 @@ def _setitem_without_update(self, key, value): dict.__setitem__(self, key, value) -class BaseCoordinateSystem(PropsManager, object): +class BaseCoordinateSystem(PropsManager, PyAedtBase): """Base methods common to FaceCoordinateSystem and CoordinateSystem. Parameters @@ -392,7 +393,7 @@ def delete(self): return True -class FaceCoordinateSystem(BaseCoordinateSystem, object): +class FaceCoordinateSystem(BaseCoordinateSystem, PyAedtBase): """Manages face coordinate system data and execution. Parameters @@ -662,7 +663,7 @@ def update(self): return True -class CoordinateSystem(BaseCoordinateSystem, object): +class CoordinateSystem(BaseCoordinateSystem, PyAedtBase): """Manages the coordinate system data and execution. Parameters @@ -1234,7 +1235,7 @@ def _attributes(self): return coordinateSystemAttributes -class ObjectCoordinateSystem(BaseCoordinateSystem, object): +class ObjectCoordinateSystem(BaseCoordinateSystem, PyAedtBase): """Manages object coordinate system data and execution. Parameters @@ -1701,7 +1702,7 @@ def _position_parser(self, pos): return pos -class Lists(PropsManager, object): +class Lists(PropsManager, PyAedtBase): """Manages list data and execution. Parameters @@ -1874,7 +1875,7 @@ def _list_verification(self, object_list, list_type): return object_list_new -class Modeler(object): +class Modeler(PyAedtBase): """Provides the `Modeler` application class that other `Modeler` classes inherit. This class is inherited in the caller application and is accessible through the modeler variable diff --git a/src/ansys/aedt/core/modeler/cad/object_3d.py b/src/ansys/aedt/core/modeler/cad/object_3d.py index bd30c382c77..ca8722b12cb 100644 --- a/src/ansys/aedt/core/modeler/cad/object_3d.py +++ b/src/ansys/aedt/core/modeler/cad/object_3d.py @@ -37,6 +37,7 @@ from pathlib import Path import re +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic.constants import AEDT_UNITS from ansys.aedt.core.generic.constants import Plane from ansys.aedt.core.generic.constants import unit_converter @@ -57,7 +58,7 @@ from ansys.aedt.core.modeler.geometry_operators import GeometryOperators -class Object3d(object): +class Object3d(PyAedtBase): """Manages object attributes for the AEDT 3D Modeler. Parameters @@ -2991,7 +2992,7 @@ def _check_polyline_health(self): return True -class PolylineSegment(object): +class PolylineSegment(PyAedtBase): """Creates and manipulates a segment of a polyline. Parameters diff --git a/src/ansys/aedt/core/modeler/cad/polylines.py b/src/ansys/aedt/core/modeler/cad/polylines.py index 389513a9485..6bf2554b3d5 100644 --- a/src/ansys/aedt/core/modeler/cad/polylines.py +++ b/src/ansys/aedt/core/modeler/cad/polylines.py @@ -22,11 +22,12 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.modeler.cad.object_3d import Object3d from ansys.aedt.core.modeler.cad.object_3d import PolylineSegment -class Polyline(Object3d): +class Polyline(Object3d, PyAedtBase): """Creates and manipulates a polyline. The constructor for this class is intended to be called from the diff --git a/src/ansys/aedt/core/modeler/cad/primitives.py b/src/ansys/aedt/core/modeler/cad/primitives.py index d7c2d5a68cf..93b7b92e577 100644 --- a/src/ansys/aedt/core/modeler/cad/primitives.py +++ b/src/ansys/aedt/core/modeler/cad/primitives.py @@ -34,6 +34,7 @@ import ansys.aedt.core from ansys.aedt.core.application.variables import Variable +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic.constants import Plane as PlaneEnum from ansys.aedt.core.generic.data_handlers import json_to_dict from ansys.aedt.core.generic.file_utils import _uname @@ -220,7 +221,7 @@ def __init__(self, parent, obj_type="o", props=None): self.__refreshed = False -class GeometryModeler(Modeler): +class GeometryModeler(Modeler, PyAedtBase): """Manages the main AEDT Modeler functionalities for geometry-based designs. Parameters @@ -379,7 +380,7 @@ def __init__(self, *args): except Exception: self.Z = 0 - class SweepOptions(object): + class SweepOptions(PyAedtBase): """Manages sweep options. Parameters @@ -9079,7 +9080,7 @@ def convert_segments_to_line(self, assignment): return True -class PrimitivesBuilder(object): +class PrimitivesBuilder(PyAedtBase): """Create primitives from a JSON file or dictionary of properties. Parameters diff --git a/src/ansys/aedt/core/modeler/cad/primitives_2d.py b/src/ansys/aedt/core/modeler/cad/primitives_2d.py index cdf13b46be0..f1f2729740d 100644 --- a/src/ansys/aedt/core/modeler/cad/primitives_2d.py +++ b/src/ansys/aedt/core/modeler/cad/primitives_2d.py @@ -22,11 +22,12 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic.general_methods import pyaedt_function_handler from ansys.aedt.core.modeler.cad.primitives import GeometryModeler -class Primitives2D(GeometryModeler, object): +class Primitives2D(GeometryModeler, PyAedtBase): """Manages primitives in 2D tools. This class is inherited in the caller application and is accessible through the primitives variable part diff --git a/src/ansys/aedt/core/modeler/cad/primitives_3d.py b/src/ansys/aedt/core/modeler/cad/primitives_3d.py index d728d7f3648..b969284facb 100644 --- a/src/ansys/aedt/core/modeler/cad/primitives_3d.py +++ b/src/ansys/aedt/core/modeler/cad/primitives_3d.py @@ -37,6 +37,7 @@ from pathlib import Path from ansys.aedt.core import Edb +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic.file_utils import generate_unique_name from ansys.aedt.core.generic.file_utils import generate_unique_project_name from ansys.aedt.core.generic.file_utils import normalize_path @@ -53,7 +54,7 @@ from ansys.aedt.core.modeler.geometry_operators import GeometryOperators -class Primitives3D(GeometryModeler): +class Primitives3D(GeometryModeler, PyAedtBase): """Manages primitives in applications using the 3D modeler. Each Electonics Desktop application uses an instance of this class diff --git a/src/ansys/aedt/core/modeler/calculators.py b/src/ansys/aedt/core/modeler/calculators.py index bfa823ce5a8..ef3e3c3594b 100644 --- a/src/ansys/aedt/core/modeler/calculators.py +++ b/src/ansys/aedt/core/modeler/calculators.py @@ -25,12 +25,13 @@ import math from ansys.aedt.core import constants +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic.constants import AEDT_UNITS from ansys.aedt.core.generic.constants import SpeedOfLight from ansys.aedt.core.generic.general_methods import pyaedt_function_handler -class TransmissionLine(object): +class TransmissionLine(PyAedtBase): """Provides base methods common to transmission line calculation. Parameters @@ -241,7 +242,7 @@ def suspended_strip_synthesis(self, substrate_height, permittivity, w1, units="m return effective_permittivity -class StandardWaveguide(object): +class StandardWaveguide(PyAedtBase): """Provides base methods common to standard waveguides. Parameters diff --git a/src/ansys/aedt/core/modeler/circuits/object_3d_circuit.py b/src/ansys/aedt/core/modeler/circuits/object_3d_circuit.py index bdd95108ef3..7eccfb306aa 100644 --- a/src/ansys/aedt/core/modeler/circuits/object_3d_circuit.py +++ b/src/ansys/aedt/core/modeler/circuits/object_3d_circuit.py @@ -25,6 +25,7 @@ import math import time +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic.constants import AEDT_UNITS from ansys.aedt.core.generic.data_handlers import _arg2dict from ansys.aedt.core.generic.data_handlers import _dict2arg @@ -35,7 +36,7 @@ from ansys.aedt.core.modeler.geometry_operators import GeometryOperators as go -class CircuitPins(object): +class CircuitPins(PyAedtBase): """Manages circuit component pins.""" def __init__(self, circuit_comp, pinname, pin_number): @@ -386,7 +387,7 @@ def __init__(self, component, tab, *args, **kw): self._tab = tab -class ModelParameters(object): +class ModelParameters(PyAedtBase): """Manages model parameters.""" def update(self): @@ -413,7 +414,7 @@ def __init__(self, component, name, props): self.name = name -class CircuitComponent(object): +class CircuitComponent(PyAedtBase): """Manages circuit components.""" def __getitem__(self, item): @@ -1216,7 +1217,7 @@ def component_path(self): return (data[1][12][1].split(" ")[1])[1:-1] -class Wire(object): +class Wire(PyAedtBase): """Creates and manipulates a wire.""" def __init__(self, modeler, composed_name=None): diff --git a/src/ansys/aedt/core/modeler/circuits/primitives_circuit.py b/src/ansys/aedt/core/modeler/circuits/primitives_circuit.py index f631a01100a..588353791f4 100644 --- a/src/ansys/aedt/core/modeler/circuits/primitives_circuit.py +++ b/src/ansys/aedt/core/modeler/circuits/primitives_circuit.py @@ -27,6 +27,7 @@ import secrets import warnings +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic.constants import AEDT_UNITS from ansys.aedt.core.generic.file_utils import generate_unique_name from ansys.aedt.core.generic.file_utils import open_file @@ -41,7 +42,7 @@ from ansys.aedt.core.modeler.circuits.object_3d_circuit import Wire -class CircuitComponents(object): +class CircuitComponents(PyAedtBase): """CircutComponents class. Manages all circuit components for Nexxim and Twin Builder. @@ -1631,7 +1632,7 @@ def create_wire(self, points, name="", page=1): return False -class ComponentInfo(object): +class ComponentInfo(PyAedtBase): """Manages Circuit Catalog info.""" def __init__(self, name, component_manager, file_name, component_library): @@ -1685,7 +1686,7 @@ def place(self, assignment, location=None, angle=0, use_instance_id_netlist=Fals ) -class ComponentCatalog(object): +class ComponentCatalog(PyAedtBase): """Indexes Circuit Sys Catalog.""" @pyaedt_function_handler() diff --git a/src/ansys/aedt/core/modeler/circuits/primitives_emit.py b/src/ansys/aedt/core/modeler/circuits/primitives_emit.py index 84fa5ab68d7..c9870210fa0 100644 --- a/src/ansys/aedt/core/modeler/circuits/primitives_emit.py +++ b/src/ansys/aedt/core/modeler/circuits/primitives_emit.py @@ -25,13 +25,14 @@ from collections import defaultdict import warnings +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.emit_core import emit_constants as emit_consts import ansys.aedt.core.generic.constants as consts from ansys.aedt.core.generic.general_methods import pyaedt_function_handler from ansys.aedt.core.modeler.circuits.primitives_circuit import ComponentCatalog -class EmitComponents(object): +class EmitComponents(PyAedtBase): """EmitComponents class. This is the class for managing all EMIT components. @@ -387,7 +388,7 @@ def update_object_properties(self, o): return o -class EmitComponent(object): +class EmitComponent(PyAedtBase): """A component in the EMIT schematic.""" # Dictionary of subclass types. Register each subclass types with @@ -1036,7 +1037,7 @@ def get_sampling(self): return samp_node[0] -class EmitComponentPropNode(object): +class EmitComponentPropNode(PyAedtBase): def __init__(self, editor, design, parent_component, node_name): self.oeditor = editor """Oeditor module""" diff --git a/src/ansys/aedt/core/modeler/circuits/primitives_maxwell_circuit.py b/src/ansys/aedt/core/modeler/circuits/primitives_maxwell_circuit.py index ff1eeaf32bf..52aabe26ed7 100644 --- a/src/ansys/aedt/core/modeler/circuits/primitives_maxwell_circuit.py +++ b/src/ansys/aedt/core/modeler/circuits/primitives_maxwell_circuit.py @@ -22,11 +22,12 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic.general_methods import pyaedt_function_handler from ansys.aedt.core.modeler.circuits.primitives_circuit import CircuitComponents -class MaxwellCircuitComponents(CircuitComponents): +class MaxwellCircuitComponents(CircuitComponents, PyAedtBase): """MaxwellCircuitComponents class. This class is for managing all circuit components for MaxwellCircuit. diff --git a/src/ansys/aedt/core/modeler/circuits/primitives_nexxim.py b/src/ansys/aedt/core/modeler/circuits/primitives_nexxim.py index 607f519b313..0261ed2caa9 100644 --- a/src/ansys/aedt/core/modeler/circuits/primitives_nexxim.py +++ b/src/ansys/aedt/core/modeler/circuits/primitives_nexxim.py @@ -28,6 +28,7 @@ import time import warnings +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic.constants import AEDT_UNITS from ansys.aedt.core.generic.file_utils import generate_unique_name from ansys.aedt.core.generic.file_utils import open_file @@ -42,7 +43,7 @@ from ansys.aedt.core.modeler.circuits.primitives_circuit import Excitations -class NexximComponents(CircuitComponents): +class NexximComponents(CircuitComponents, PyAedtBase): """Manages circuit components for Nexxim. Parameters diff --git a/src/ansys/aedt/core/modeler/circuits/primitives_twin_builder.py b/src/ansys/aedt/core/modeler/circuits/primitives_twin_builder.py index 768eaf863b5..217f8c9c767 100644 --- a/src/ansys/aedt/core/modeler/circuits/primitives_twin_builder.py +++ b/src/ansys/aedt/core/modeler/circuits/primitives_twin_builder.py @@ -22,12 +22,13 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic.general_methods import pyaedt_function_handler from ansys.aedt.core.modeler.circuits.primitives_circuit import CircuitComponents from ansys.aedt.core.modeler.circuits.primitives_circuit import ComponentCatalog -class TwinBuilderComponents(CircuitComponents): +class TwinBuilderComponents(CircuitComponents, PyAedtBase): """TwinBuilderComponents class. This class is for managing all circuit components for Twin Builder. diff --git a/src/ansys/aedt/core/modeler/geometry_operators.py b/src/ansys/aedt/core/modeler/geometry_operators.py index 637a209ffb0..596ecf2197b 100644 --- a/src/ansys/aedt/core/modeler/geometry_operators.py +++ b/src/ansys/aedt/core/modeler/geometry_operators.py @@ -27,6 +27,7 @@ import sys import warnings +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic.constants import Axis from ansys.aedt.core.generic.constants import Plane from ansys.aedt.core.generic.constants import SweepDraft @@ -35,7 +36,7 @@ from ansys.aedt.core.generic.math_utils import MathUtils -class GeometryOperators(object): +class GeometryOperators(PyAedtBase): """Manages geometry operators.""" @staticmethod diff --git a/src/ansys/aedt/core/modeler/modeler_2d.py b/src/ansys/aedt/core/modeler/modeler_2d.py index 9537d14d2e9..39734a28e20 100644 --- a/src/ansys/aedt/core/modeler/modeler_2d.py +++ b/src/ansys/aedt/core/modeler/modeler_2d.py @@ -25,12 +25,13 @@ import math from warnings import warn +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic.general_methods import pyaedt_function_handler from ansys.aedt.core.modeler.cad.modeler import Modeler from ansys.aedt.core.modeler.cad.primitives_2d import Primitives2D -class ModelerRMxprt(Modeler): +class ModelerRMxprt(Modeler, PyAedtBase): """Provides the Modeler RMxprt application interface. This class is inherited in the caller application and is accessible through the modeler variable @@ -54,7 +55,7 @@ def oeditor(self): return self._app.oeditor -class Modeler2D(Primitives2D): +class Modeler2D(Primitives2D, PyAedtBase): """Provides the Modeler 2D application interface. This class is inherited in the caller application and is accessible through the modeler variable diff --git a/src/ansys/aedt/core/modeler/modeler_3d.py b/src/ansys/aedt/core/modeler/modeler_3d.py index bec649befc4..d35947c31da 100644 --- a/src/ansys/aedt/core/modeler/modeler_3d.py +++ b/src/ansys/aedt/core/modeler/modeler_3d.py @@ -29,6 +29,7 @@ import warnings from ansys.aedt.core.application.variables import generate_validation_errors +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic.constants import Axis from ansys.aedt.core.generic.file_utils import generate_unique_name from ansys.aedt.core.generic.file_utils import open_file @@ -40,7 +41,7 @@ from ansys.aedt.core.syslib.nastran_import import nastran_to_stl -class Modeler3D(Primitives3D): +class Modeler3D(Primitives3D, PyAedtBase): """Provides the Modeler 3D application interface. This class is inherited in the caller application and is accessible through the modeler variable diff --git a/src/ansys/aedt/core/modeler/modeler_pcb.py b/src/ansys/aedt/core/modeler/modeler_pcb.py index e45b71fdf50..eb5767c0868 100644 --- a/src/ansys/aedt/core/modeler/modeler_pcb.py +++ b/src/ansys/aedt/core/modeler/modeler_pcb.py @@ -26,6 +26,7 @@ import re from warnings import warn +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic.file_utils import generate_unique_name from ansys.aedt.core.generic.file_utils import get_filename_without_extension from ansys.aedt.core.generic.file_utils import open_file @@ -38,7 +39,7 @@ from ansys.aedt.core.modules.layer_stackup import Layers -class Modeler3DLayout(Modeler, Primitives3DLayout): +class Modeler3DLayout(Modeler, Primitives3DLayout, PyAedtBase): """Manages Modeler 3D layouts. This class is inherited in the caller application and is accessible through the modeler variable diff --git a/src/ansys/aedt/core/modeler/pcb/object_3d_layout.py b/src/ansys/aedt/core/modeler/pcb/object_3d_layout.py index c55b106c72a..e70a8320f7a 100644 --- a/src/ansys/aedt/core/modeler/pcb/object_3d_layout.py +++ b/src/ansys/aedt/core/modeler/pcb/object_3d_layout.py @@ -31,6 +31,7 @@ from typing import Optional from typing import Tuple +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic.constants import unit_converter from ansys.aedt.core.generic.file_utils import generate_unique_name from ansys.aedt.core.generic.general_methods import pyaedt_function_handler @@ -38,7 +39,7 @@ from ansys.aedt.core.modeler.geometry_operators import GeometryOperators -class Object3DLayout(object): +class Object3DLayout(PyAedtBase): """Manages properties of objects in HFSS 3D Layout. Parameters @@ -407,7 +408,7 @@ def lock_position(self, lock_position=True): self.change_property(vMaterial) -class ModelInfoRlc(object): +class ModelInfoRlc(PyAedtBase): def __init__(self, component, name): self._comp = component self._name = name @@ -454,7 +455,7 @@ def is_parallel(self): return self.rlc_model_type[6] -class Components3DLayout(Object3DLayout, object): +class Components3DLayout(Object3DLayout, PyAedtBase): """Contains components in HFSS 3D Layout.""" def __init__(self, primitives, name="", edb_object=None): @@ -890,7 +891,7 @@ def model(self): return ModelInfoRlc(self, self.name) -class Nets3DLayout(object): +class Nets3DLayout(PyAedtBase): """Contains Nets in HFSS 3D Layout.""" def __init__(self, primitives, name=""): @@ -978,7 +979,7 @@ def plot( ) -class Pins3DLayout(Object3DLayout, object): +class Pins3DLayout(Object3DLayout, PyAedtBase): """Contains the pins in HFSS 3D Layout.""" def __init__(self, primitives, name="", component_name=None, is_pin=True): @@ -1033,7 +1034,7 @@ def holediam(self): return self._oeditor.GetPropertyValue("BaseElementTab", self.name, "HoleDiameter") -class Geometries3DLayout(Object3DLayout, object): +class Geometries3DLayout(Object3DLayout, PyAedtBase): """Contains geometries in HFSS 3D Layout.""" def __init__(self, primitives, name, prim_type="poly", is_void=False): @@ -1286,7 +1287,7 @@ def net_name(self, netname=""): self.change_property(vMaterial) -class Polygons3DLayout(Geometries3DLayout, object): +class Polygons3DLayout(Geometries3DLayout, PyAedtBase): """Manages Hfss 3D Layout polygons.""" def __init__(self, primitives, name, prim_type="poly", is_void=False): @@ -1320,7 +1321,7 @@ def polygon_voids(self): return pvoids -class Circle3dLayout(Geometries3DLayout, object): +class Circle3dLayout(Geometries3DLayout, PyAedtBase): """Manages Hfss 3D Layout circles.""" def __init__(self, primitives, name, is_void=False): @@ -1369,7 +1370,7 @@ def radius(self, value): self.change_property(vMaterial) -class Rect3dLayout(Geometries3DLayout, object): +class Rect3dLayout(Geometries3DLayout, PyAedtBase): """Manages Hfss 3D Layout rectangles.""" def __init__(self, primitives, name, is_void=False): @@ -1536,7 +1537,7 @@ def point_b(self, value): self.change_property(vMaterial) -class Line3dLayout(Geometries3DLayout, object): +class Line3dLayout(Geometries3DLayout, PyAedtBase): """Manages Hfss 3D Layout lines.""" def __init__(self, primitives, name, is_void=False): @@ -1767,7 +1768,7 @@ def _edit(self, points): self._oeditor.Edit(arg_edit) -class Points3dLayout(object): +class Points3dLayout(PyAedtBase): """Manages HFSS 3D Layout points.""" def __init__(self, primitives, point): @@ -1816,7 +1817,7 @@ def move(self, location): return True -class ComponentsSubCircuit3DLayout(Object3DLayout, object): +class ComponentsSubCircuit3DLayout(Object3DLayout, PyAedtBase): """Contains 3d Components in HFSS 3D Layout. Parameters @@ -1996,7 +1997,7 @@ def location(self, position): self.change_property(props) -class Padstack(object): +class Padstack(PyAedtBase): """Manages properties of a padstack. Parameters @@ -2027,7 +2028,7 @@ def __init__(self, name="Padstack", padstackmanager=None, units="mm"): self.solder_mat = "solder" self.layerid = 1 - class PDSHole(object): + class PDSHole(PyAedtBase): """Manages properties of a padstack hole. Parameters @@ -2052,7 +2053,7 @@ def __init__(self, holetype="Cir", sizes=["1mm"], xpos="0mm", ypos="0mm", rot="0 self.y = ypos self.rot = rot - class PDSLayer(object): + class PDSLayer(PyAedtBase): """Manages properties of a padstack layer.""" def __init__(self, layername="Default", id=1): @@ -2365,7 +2366,7 @@ def remove(self): self.padstackmgr.Remove(self.name, True, "", "Project") -class CoordinateSystems3DLayout(object): +class CoordinateSystems3DLayout(PyAedtBase): """Coordinate systems in HFSS 3D Layout.""" def __init__(self, primitives): diff --git a/src/ansys/aedt/core/modeler/pcb/primitives_3d_layout.py b/src/ansys/aedt/core/modeler/pcb/primitives_3d_layout.py index 103ad5f809a..3a07d6f7284 100644 --- a/src/ansys/aedt/core/modeler/pcb/primitives_3d_layout.py +++ b/src/ansys/aedt/core/modeler/pcb/primitives_3d_layout.py @@ -27,6 +27,7 @@ # import sys import warnings +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic.file_utils import _uname from ansys.aedt.core.generic.file_utils import generate_unique_name from ansys.aedt.core.generic.general_methods import pyaedt_function_handler @@ -44,7 +45,7 @@ from ansys.aedt.core.modeler.pcb.object_3d_layout import Rect3dLayout -class Primitives3DLayout(object): +class Primitives3DLayout(PyAedtBase): """Manages primitives in HFSS 3D Layout. This class is inherited in the caller application and is accessible through the primitives variable part diff --git a/src/ansys/aedt/core/modeler/schematic.py b/src/ansys/aedt/core/modeler/schematic.py index 5d69ee56096..b6b66d87775 100644 --- a/src/ansys/aedt/core/modeler/schematic.py +++ b/src/ansys/aedt/core/modeler/schematic.py @@ -39,6 +39,7 @@ else: # pragma: no cover warnings.warn("EMIT API is only available for Python 3.8-3.12.") +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.modeler.circuits.primitives_maxwell_circuit import MaxwellCircuitComponents from ansys.aedt.core.modeler.circuits.primitives_nexxim import NexximComponents from ansys.aedt.core.modeler.circuits.primitives_twin_builder import TwinBuilderComponents @@ -46,7 +47,7 @@ from ansys.aedt.core.modules.layer_stackup import Layers -class ModelerCircuit(Modeler): +class ModelerCircuit(Modeler, PyAedtBase): """ModelerCircuit class. Parameters @@ -487,7 +488,7 @@ def _get_components_selections(self, selections, return_as_list=True): return sels -class ModelerNexxim(ModelerCircuit): +class ModelerNexxim(ModelerCircuit, PyAedtBase): """ModelerNexxim class. Parameters @@ -696,7 +697,7 @@ def rotate(self, assignment, degrees=90): return True -class ModelerTwinBuilder(ModelerCircuit): +class ModelerTwinBuilder(ModelerCircuit, PyAedtBase): """ModelerTwinBuilder class. Parameters @@ -732,7 +733,7 @@ def schematic(self): return self._components -class ModelerEmit(ModelerCircuit): +class ModelerEmit(ModelerCircuit, PyAedtBase): """ModelerEmit class. Parameters @@ -766,7 +767,7 @@ def _get_components_selections(self, selections, return_as_list=True): # pragma return sels -class ModelerMaxwellCircuit(ModelerCircuit): +class ModelerMaxwellCircuit(ModelerCircuit, PyAedtBase): """ModelerMaxwellCircuit class. Parameters diff --git a/src/ansys/aedt/core/modules/boundary/circuit_boundary.py b/src/ansys/aedt/core/modules/boundary/circuit_boundary.py index a7a64c6cef2..b924aa19ee4 100644 --- a/src/ansys/aedt/core/modules/boundary/circuit_boundary.py +++ b/src/ansys/aedt/core/modules/boundary/circuit_boundary.py @@ -25,11 +25,12 @@ import copy import re +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic.general_methods import pyaedt_function_handler from ansys.aedt.core.modules.circuit_templates import SourceKeys -class Sources(object): +class Sources(PyAedtBase): """Manages sources in Circuit projects.""" def __init__(self, app, name, source_type=None): @@ -317,7 +318,7 @@ def create(self): return True -class PowerSinSource(Sources, object): +class PowerSinSource(Sources): """Power Sinusoidal Class.""" def __init__(self, app, name, source_type=None): @@ -478,7 +479,7 @@ def tone(self, value): self._child.SetPropValue("TONE", value) -class PowerIQSource(Sources, object): +class PowerIQSource(Sources): """Power IQ Class.""" def __init__(self, app, name, source_type=None): @@ -728,7 +729,7 @@ def file(self, value): self.update() -class VoltageFrequencyDependentSource(Sources, object): +class VoltageFrequencyDependentSource(Sources): """Voltage Frequency Dependent Class.""" def __init__(self, app, name, source_type=None): @@ -890,7 +891,7 @@ def _update_prop(self): return True -class VoltageDCSource(Sources, object): +class VoltageDCSource(Sources): """Power Sinusoidal Class.""" def __init__(self, app, name, source_type=None): @@ -946,7 +947,7 @@ def dc_magnitude(self, value): self._child.SetPropValue("DC", value) -class VoltageSinSource(Sources, object): +class VoltageSinSource(Sources): """Power Sinusoidal Class.""" def __init__(self, app, name, source_type=None): @@ -1107,7 +1108,7 @@ def tone(self, value): self._child.SetPropValue("TONE", value) -class CurrentSinSource(Sources, object): +class CurrentSinSource(Sources): """Current Sinusoidal Class.""" def __init__(self, app, name, source_type=None): diff --git a/src/ansys/aedt/core/modules/boundary/common.py b/src/ansys/aedt/core/modules/boundary/common.py index 42ce19b305c..be296f91b6e 100644 --- a/src/ansys/aedt/core/modules/boundary/common.py +++ b/src/ansys/aedt/core/modules/boundary/common.py @@ -24,6 +24,7 @@ """This module contains these classes: ``BoundaryCommon`` and ``BoundaryObject``.""" +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic.data_handlers import _dict2arg from ansys.aedt.core.generic.general_methods import PropsManager from ansys.aedt.core.generic.general_methods import pyaedt_function_handler @@ -70,7 +71,7 @@ def _setitem_without_update(self, key, value): dict.__setitem__(self, key, value) -class BoundaryCommon(PropsManager): +class BoundaryCommon(PropsManager, PyAedtBase): """ """ @pyaedt_function_handler() @@ -190,7 +191,7 @@ def wrapper(self, *args, **kwargs): return wrapper -class BoundaryObject(BoundaryCommon, BinaryTreeNode): +class BoundaryObject(BoundaryCommon, BinaryTreeNode, PyAedtBase): """Manages boundary data and execution. Parameters diff --git a/src/ansys/aedt/core/modules/boundary/hfss_boundary.py b/src/ansys/aedt/core/modules/boundary/hfss_boundary.py index 7379a957e09..23d8cd33d6d 100644 --- a/src/ansys/aedt/core/modules/boundary/hfss_boundary.py +++ b/src/ansys/aedt/core/modules/boundary/hfss_boundary.py @@ -22,6 +22,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic.data_handlers import _dict2arg from ansys.aedt.core.generic.general_methods import pyaedt_function_handler from ansys.aedt.core.modeler.cad.elements_3d import BinaryTreeNode @@ -29,7 +30,7 @@ from ansys.aedt.core.modules.boundary.common import BoundaryProps -class FieldSetup(BoundaryCommon, BinaryTreeNode): +class FieldSetup(BoundaryCommon, BinaryTreeNode, PyAedtBase): """Manages far field and near field component data and execution. Examples @@ -187,7 +188,7 @@ def delete(self): return True -class FarFieldSetup(FieldSetup, object): +class FarFieldSetup(FieldSetup): """Manages Far Field Component data and execution. Examples @@ -514,7 +515,7 @@ def elevation_step(self, value): self.update() -class NearFieldSetup(FieldSetup, object): +class NearFieldSetup(FieldSetup): """Manages Near Field Component data and execution. Examples diff --git a/src/ansys/aedt/core/modules/boundary/icepak_boundary.py b/src/ansys/aedt/core/modules/boundary/icepak_boundary.py index 3dfcfbdfdc5..0b40e74677d 100644 --- a/src/ansys/aedt/core/modules/boundary/icepak_boundary.py +++ b/src/ansys/aedt/core/modules/boundary/icepak_boundary.py @@ -24,13 +24,14 @@ from abc import abstractmethod import copy +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic.file_utils import generate_unique_name from ansys.aedt.core.generic.general_methods import pyaedt_function_handler from ansys.aedt.core.generic.numbers_utils import decompose_variable_value from ansys.aedt.core.modules.boundary.common import BoundaryObject -class BoundaryDictionary: +class BoundaryDictionary(PyAedtBase): """Handles Icepak transient and temperature-dependent boundary condition assignments. Parameters diff --git a/src/ansys/aedt/core/modules/boundary/layout_boundary.py b/src/ansys/aedt/core/modules/boundary/layout_boundary.py index 8caf7c00b69..9b817f56219 100644 --- a/src/ansys/aedt/core/modules/boundary/layout_boundary.py +++ b/src/ansys/aedt/core/modules/boundary/layout_boundary.py @@ -22,6 +22,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic.data_handlers import _dict2arg from ansys.aedt.core.generic.data_handlers import random_string from ansys.aedt.core.generic.general_methods import pyaedt_function_handler @@ -32,7 +33,7 @@ from ansys.aedt.core.modules.boundary.common import disable_auto_update -class NativeComponentObject(BoundaryCommon, BinaryTreeNode): +class NativeComponentObject(BoundaryCommon, BinaryTreeNode, PyAedtBase): """Manages Native Component data and execution. Parameters @@ -278,7 +279,7 @@ def delete(self): return True -class BoundaryObject3dLayout(BoundaryCommon, BinaryTreeNode): +class BoundaryObject3dLayout(BoundaryCommon, BinaryTreeNode, PyAedtBase): """Manages boundary data and execution for Hfss3dLayout. Parameters @@ -410,7 +411,7 @@ def update(self): return True -class NativeComponentPCB(NativeComponentObject, object): +class NativeComponentPCB(NativeComponentObject): """Manages native component PCB data and execution. Parameters @@ -869,7 +870,7 @@ def set_board_extents(self, extent_type=None, extent_polygon=None): return True -class PCBSettingsPackageParts(object): +class PCBSettingsPackageParts(PyAedtBase): """Handle package part settings of the PCB component. Parameters @@ -1000,7 +1001,7 @@ def __repr__(self): return "Package" -class PCBSettingsDeviceParts(object): +class PCBSettingsDeviceParts(PyAedtBase): """Handle device part settings of the PCB component. Parameters diff --git a/src/ansys/aedt/core/modules/boundary/maxwell_boundary.py b/src/ansys/aedt/core/modules/boundary/maxwell_boundary.py index fbbf63417b8..a37df8ed6ee 100644 --- a/src/ansys/aedt/core/modules/boundary/maxwell_boundary.py +++ b/src/ansys/aedt/core/modules/boundary/maxwell_boundary.py @@ -22,6 +22,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic.constants import SolutionsMaxwell3D from ansys.aedt.core.generic.data_handlers import _dict2arg from ansys.aedt.core.generic.file_utils import generate_unique_name @@ -32,7 +33,7 @@ from ansys.aedt.core.modules.boundary.common import BoundaryProps -class MaxwellParameters(BoundaryCommon, BinaryTreeNode): +class MaxwellParameters(BoundaryCommon, BinaryTreeNode, PyAedtBase): """Manages parameters data and execution. Parameters @@ -270,7 +271,7 @@ def join_parallel(self, sources, matrix_name=None, join_name=None): ) -class MaxwellMatrix(object): +class MaxwellMatrix(PyAedtBase): """ Provides methods to interact with reduced matrices in Maxwell. diff --git a/src/ansys/aedt/core/modules/boundary/q3d_boundary.py b/src/ansys/aedt/core/modules/boundary/q3d_boundary.py index 18bf358819d..e555d706f4a 100644 --- a/src/ansys/aedt/core/modules/boundary/q3d_boundary.py +++ b/src/ansys/aedt/core/modules/boundary/q3d_boundary.py @@ -24,6 +24,7 @@ import warnings +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic.constants import CATEGORIESQ3D from ansys.aedt.core.generic.constants import PlotCategoriesQ3D from ansys.aedt.core.generic.file_utils import generate_unique_name @@ -31,7 +32,7 @@ from ansys.aedt.core.generic.general_methods import pyaedt_function_handler -class Matrix(object): +class Matrix(PyAedtBase): """Manages Matrix in Q3d and Q2d Projects. Examples diff --git a/src/ansys/aedt/core/modules/cable_modeling.py b/src/ansys/aedt/core/modules/cable_modeling.py index f1155bafae5..9445358e804 100644 --- a/src/ansys/aedt/core/modules/cable_modeling.py +++ b/src/ansys/aedt/core/modules/cable_modeling.py @@ -26,6 +26,7 @@ import json import os +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic.file_utils import generate_unique_name from ansys.aedt.core.generic.file_utils import open_file from ansys.aedt.core.generic.file_utils import read_configuration_file @@ -34,7 +35,7 @@ from ansys.aedt.core.internal.load_aedt_file import load_entire_aedt_file -class Cable: +class Cable(PyAedtBase): """Contains all common Cable features. Parameters diff --git a/src/ansys/aedt/core/modules/circuit_templates.py b/src/ansys/aedt/core/modules/circuit_templates.py index 0212f2d1c20..c5707ca9f98 100644 --- a/src/ansys/aedt/core/modules/circuit_templates.py +++ b/src/ansys/aedt/core/modules/circuit_templates.py @@ -573,7 +573,7 @@ ] -class SourceKeys(object): +class SourceKeys: """Provides source keys.""" SourceTemplates = { diff --git a/src/ansys/aedt/core/modules/design_xploration.py b/src/ansys/aedt/core/modules/design_xploration.py index ac53fb3e79d..a80157afc76 100644 --- a/src/ansys/aedt/core/modules/design_xploration.py +++ b/src/ansys/aedt/core/modules/design_xploration.py @@ -29,6 +29,7 @@ from typing import Dict from typing import Optional +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic.constants import SolutionsHfss from ansys.aedt.core.generic.constants import SolutionsMaxwell3D from ansys.aedt.core.generic.data_handlers import _arg2dict @@ -47,7 +48,7 @@ from ansys.aedt.core.modules.solve_sweeps import SetupProps -class CommonOptimetrics(PropsManager, object): +class CommonOptimetrics(PropsManager, PyAedtBase): """Creates and sets up optimizations. Parameters @@ -558,7 +559,7 @@ def analyze( ) -class SetupOpti(CommonOptimetrics, object): +class SetupOpti(CommonOptimetrics, PyAedtBase): """Sets up an optimization in Opimetrics.""" def __init__(self, app, name, dictinputs=None, optim_type="OptiDesignExplorer"): @@ -782,7 +783,7 @@ def add_variation( return True -class SetupParam(CommonOptimetrics, object): +class SetupParam(CommonOptimetrics, PyAedtBase): """Sets up a parametric analysis in Optimetrics.""" def __init__(self, p_app, name, dictinputs=None, optim_type="OptiParametric"): @@ -951,7 +952,7 @@ def export_to_csv(self, output_file): return True -class ParametricSetups(object): +class ParametricSetups(PyAedtBase): """Sets up Parametrics analyses. It includes Parametrics, Sensitivity and Statistical Analysis. Examples @@ -1145,7 +1146,7 @@ def add_from_file(self, input_file, name=None): return setup -class OptimizationSetups(object): +class OptimizationSetups(PyAedtBase): """Sets up optimizations. It includes Optimization, DOE and DesignXplorer Analysis. Examples diff --git a/src/ansys/aedt/core/modules/layer_stackup.py b/src/ansys/aedt/core/modules/layer_stackup.py index 3295d7980fd..c72d6557ce8 100644 --- a/src/ansys/aedt/core/modules/layer_stackup.py +++ b/src/ansys/aedt/core/modules/layer_stackup.py @@ -28,6 +28,7 @@ This module provides all layer stackup functionalities for the Circuit and HFSS 3D Layout tools. """ +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic.constants import unit_converter from ansys.aedt.core.generic.data_handlers import str_to_bool from ansys.aedt.core.generic.general_methods import pyaedt_function_handler @@ -76,7 +77,7 @@ def _getRGBfromI(value): return [r, g, b] -class Layer(object): +class Layer(PyAedtBase): """Manages the stackup layer for the Circuit and HFSS 3D Layout tools. Parameters @@ -1067,7 +1068,7 @@ def remove_stackup_layer(self): return False -class Layers(object): +class Layers(PyAedtBase): """Manages stackup for the Circuit and HFSS 3D Layout tools. Parameters diff --git a/src/ansys/aedt/core/modules/material.py b/src/ansys/aedt/core/modules/material.py index 9f262308392..7e389ea1c77 100644 --- a/src/ansys/aedt/core/modules/material.py +++ b/src/ansys/aedt/core/modules/material.py @@ -40,6 +40,7 @@ import copy import warnings +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic.constants import CSS4_COLORS from ansys.aedt.core.generic.constants import unit_converter from ansys.aedt.core.generic.data_handlers import _dict2arg @@ -48,7 +49,7 @@ from ansys.aedt.core.generic.numbers_utils import is_number -class MatProperties(object): +class MatProperties(PyAedtBase): """Contains a list of constant names for all materials with mappings to their internal XML names. Internal names are used in scripts, and XML names are used in the XML syntax. @@ -203,7 +204,7 @@ def get_defaultvalue(cls, aedtname): raise TypeError("get_defaultunit: Either the full name or category name must be defined.") -class SurfMatProperties(object): +class SurfMatProperties(PyAedtBase): """Contains a list of constant names for all surface materials with mappings to their internal XML names. Internal names are used in scripts, and XML names are used in the XML syntax. @@ -259,7 +260,7 @@ def get_defaultvalue(cls, aedtname=None): raise TypeError("get_defaultunit: Either the full name or category name must be defined.") -class ClosedFormTM(object): +class ClosedFormTM: """Manages closed-form thermal modifiers.""" Tref = "22cel" @@ -272,7 +273,7 @@ class ClosedFormTM(object): TMU = 1000 -class Dataset(object): +class Dataset: """Manages datasets.""" ds = [] @@ -285,7 +286,7 @@ class Dataset(object): namez = None -class BasicValue(object): +class BasicValue: """Manages thermal and spatial modifier calculations.""" def __init__(self): @@ -295,7 +296,7 @@ def __init__(self): self.spatialmodifier = None -class MatProperty(object): +class MatProperty(PyAedtBase): """Manages simple, anisotropic, tensor, and non-linear properties. Parameters @@ -1221,7 +1222,7 @@ def add_spatial_modifier_dataset(self, dataset, index=0): return self._add_spatial_modifier(formula, index) -class CommonMaterial(object): +class CommonMaterial(PyAedtBase): """Manages datasets with frequency-dependent materials. Parameters @@ -1377,7 +1378,7 @@ def _update_props(self, propname, propvalue, update_aedt=True): return False -class Material(CommonMaterial, object): +class Material(CommonMaterial, PyAedtBase): """Manages material properties. Parameters @@ -2763,7 +2764,7 @@ def _does_material_exists(self, material_name): return False -class SurfaceMaterial(CommonMaterial, object): +class SurfaceMaterial(CommonMaterial, PyAedtBase): """Manages surface material properties for Icepak only. Parameters diff --git a/src/ansys/aedt/core/modules/material_lib.py b/src/ansys/aedt/core/modules/material_lib.py index e9fad850288..b23814a3001 100644 --- a/src/ansys/aedt/core/modules/material_lib.py +++ b/src/ansys/aedt/core/modules/material_lib.py @@ -32,6 +32,7 @@ import sys import warnings +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic.data_handlers import _arg2dict from ansys.aedt.core.generic.file_utils import generate_unique_name from ansys.aedt.core.generic.file_utils import open_file @@ -46,7 +47,7 @@ from ansys.aedt.core.modules.material_workbench import MaterialWorkbench -class Materials(object): +class Materials(PyAedtBase): """Contains the AEDT materials database and all methods for creating and editing materials. Parameters diff --git a/src/ansys/aedt/core/modules/material_workbench.py b/src/ansys/aedt/core/modules/material_workbench.py index 2c9dfbe27b1..883fee24486 100644 --- a/src/ansys/aedt/core/modules/material_workbench.py +++ b/src/ansys/aedt/core/modules/material_workbench.py @@ -36,13 +36,14 @@ from defusedxml.ElementTree import ParseError from ansys.aedt.core.aedt_logger import pyaedt_logger as logger +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic.data_handlers import normalize_string_format from ansys.aedt.core.modules.material import MatProperties defusedxml.defuse_stdlib() -class MaterialWorkbench: +class MaterialWorkbench(PyAedtBase): """Manages the import of materials from a Workbench Engineering Data XML file. Parameters diff --git a/src/ansys/aedt/core/modules/mesh.py b/src/ansys/aedt/core/modules/mesh.py index ad826bc4c30..12fc4dbc874 100644 --- a/src/ansys/aedt/core/modules/mesh.py +++ b/src/ansys/aedt/core/modules/mesh.py @@ -28,6 +28,7 @@ import shutil from ansys.aedt.core.application.design_solutions import model_names +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic.data_handlers import _dict2arg from ansys.aedt.core.generic.file_utils import generate_unique_name from ansys.aedt.core.generic.general_methods import pyaedt_function_handler @@ -107,7 +108,7 @@ def _setitem_without_update(self, key, value): dict.__setitem__(self, key, value) -class MeshOperation(BinaryTreeNode): +class MeshOperation(BinaryTreeNode, PyAedtBase): """MeshOperation class. Parameters @@ -412,7 +413,7 @@ def _initialize_tree_node(self): return False -class Mesh(object): +class Mesh(PyAedtBase): """Manages AEDT mesh functions for 2D and 3D solvers (HFSS, Maxwell, and Q3D). Parameters diff --git a/src/ansys/aedt/core/modules/mesh_3d_layout.py b/src/ansys/aedt/core/modules/mesh_3d_layout.py index e26ffe1c7f0..91d9288d356 100644 --- a/src/ansys/aedt/core/modules/mesh_3d_layout.py +++ b/src/ansys/aedt/core/modules/mesh_3d_layout.py @@ -29,6 +29,7 @@ """ +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic.data_handlers import _dict2arg from ansys.aedt.core.generic.file_utils import generate_unique_name from ansys.aedt.core.generic.general_methods import PropsManager @@ -36,7 +37,7 @@ from ansys.aedt.core.modules.mesh import MeshProps -class Mesh3DOperation(PropsManager, object): +class Mesh3DOperation(PropsManager, PyAedtBase): """Mesh3DOperation class. Parameters @@ -134,7 +135,7 @@ def delete(self): return True -class Mesh3d(object): +class Mesh3d(PyAedtBase): """Manages mesh operations for HFSS 3D Layout. Provides the main AEDT mesh functionality. The inherited class diff --git a/src/ansys/aedt/core/modules/mesh_icepak.py b/src/ansys/aedt/core/modules/mesh_icepak.py index 864f9bd1e2a..4fbf5e2749d 100644 --- a/src/ansys/aedt/core/modules/mesh_icepak.py +++ b/src/ansys/aedt/core/modules/mesh_icepak.py @@ -25,6 +25,7 @@ import os.path import warnings +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic.data_handlers import _dict2arg from ansys.aedt.core.generic.file_utils import generate_unique_name from ansys.aedt.core.generic.general_methods import pyaedt_function_handler @@ -38,7 +39,7 @@ from ansys.aedt.core.modules.mesh import meshers -class CommonRegion(object): +class CommonRegion(PyAedtBase): def __init__(self, app, name): self._app = app self._name = name @@ -437,7 +438,7 @@ def parts(self, parts): self._app.modeler.reassign_subregion(self, parts) -class MeshSettings(object): +class MeshSettings(PyAedtBase): """Manages mesh settings. It can be used like a dictionary. Available keys change according @@ -608,7 +609,7 @@ def __contains__(self, x): return x in self.keys() -class MeshRegionCommon(BinaryTreeNode): +class MeshRegionCommon(BinaryTreeNode, PyAedtBase): """ Manages Icepak mesh region settings. @@ -1063,7 +1064,7 @@ def Submodels(self, objects): self.assignment = objects -class IcepakMesh(object): +class IcepakMesh(PyAedtBase): """Manages Icepak meshes. Parameters diff --git a/src/ansys/aedt/core/modules/profile.py b/src/ansys/aedt/core/modules/profile.py index 47072e5bfd5..9e8b5de9497 100644 --- a/src/ansys/aedt/core/modules/profile.py +++ b/src/ansys/aedt/core/modules/profile.py @@ -45,6 +45,7 @@ ) from ansys.aedt.core.aedt_logger import pyaedt_logger as logging +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic.general_methods import pyaedt_function_handler from ansys.aedt.core.generic.numbers_utils import Quantity from ansys.aedt.core.modeler.cad.elements_3d import BinaryTreeNode @@ -173,7 +174,7 @@ def sort_key(k: str): @total_ordering -class MemoryGB(object): +class MemoryGB(PyAedtBase): """Represent memory with conversion to *gigabytes* and arithmetic. Parameters @@ -388,7 +389,7 @@ def step_name_map(input_name: str) -> str: } -class ProfileStepSummary(object): +class ProfileStepSummary(PyAedtBase): """Summary information for a single profile step. This light-weight container extracts a small set of common metrics @@ -429,7 +430,7 @@ def __add__(self, other): return self -class ProfileStep(object): +class ProfileStep(PyAedtBase): """A profile step possibly containing nested sub-steps. Parameters @@ -932,7 +933,7 @@ def convert_icepak_info(info_str: str) -> tuple: return elapsed, memory -class SimulationProfile(object): +class SimulationProfile(PyAedtBase): """Container for all profile data from a single simulation. This class parses a *Solution Process Group* and exposes convenience @@ -1425,7 +1426,7 @@ def _parse_profile_data(profile_data: BinaryTreeNode) -> SimulationProfile: return _merge_profiles(profiles) # Merge "groups" into a single simulation profile. -class Profiles(Mapping): +class Profiles(Mapping, PyAedtBase): """Provide an interface to solver profiles. The Profiles class is iterable. Individual profiles are accessed via the unique diff --git a/src/ansys/aedt/core/modules/solve_setup.py b/src/ansys/aedt/core/modules/solve_setup.py index 584746e2df6..1dcaee0838f 100644 --- a/src/ansys/aedt/core/modules/solve_setup.py +++ b/src/ansys/aedt/core/modules/solve_setup.py @@ -36,6 +36,7 @@ import time import warnings +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic.constants import AEDT_UNITS from ansys.aedt.core.generic.data_handlers import _dict2arg from ansys.aedt.core.generic.file_utils import generate_unique_name @@ -54,7 +55,7 @@ from ansys.aedt.core.modules.solve_sweeps import identify_setup -class CommonSetup(PropsManager, BinaryTreeNode): +class CommonSetup(PropsManager, BinaryTreeNode, PyAedtBase): def __init__(self, app, solution_type, name="MySetupAuto", is_new_setup=True): self.auto_update = False self._app = app @@ -2509,7 +2510,7 @@ def use_matrix_convergence( return self.update() -class SetupHFSS(Setup, object): +class SetupHFSS(Setup, PyAedtBase): """Initializes, creates, and updates an HFSS setup. Parameters @@ -3235,7 +3236,7 @@ def use_matrix_convergence( return False -class SetupHFSSAuto(Setup, object): +class SetupHFSSAuto(Setup, PyAedtBase): """Initializes, creates, and updates an HFSS SBR+ or HFSS Auto setup. Parameters @@ -3523,7 +3524,7 @@ def enable_adaptive_setup_multifrequency(self, frequencies, max_delta_s=0.02): return self.update() -class SetupSBR(Setup, object): +class SetupSBR(Setup, PyAedtBase): """Initializes, creates, and updates an HFSS SBR+ or HFSS Auto setup. Parameters @@ -3602,7 +3603,7 @@ def add_subrange(self, range_type, start, end=None, count=None, unit="GHz", clea return self.update() -class SetupMaxwell(Setup, object): +class SetupMaxwell(Setup, PyAedtBase): """Initializes, creates, and updates a Maxwell setup. Parameters @@ -3973,7 +3974,7 @@ def export_matrix( raise AEDTRuntimeError("Invalid matrix type. It has to be either 'RL' or 'C'.") -class SetupQ3D(Setup, object): +class SetupQ3D(Setup, PyAedtBase): """Initializes, creates, and updates an Q3D setup. Parameters @@ -4434,7 +4435,7 @@ def update(self, properties=None): return True -class SetupIcepak(Setup, object): +class SetupIcepak(Setup, PyAedtBase): def __init__(self, app, solution_type, setup_name, is_new_setup=True): Setup.__init__(self, app, solution_type, setup_name, is_new_setup) diff --git a/src/ansys/aedt/core/modules/solve_sweeps.py b/src/ansys/aedt/core/modules/solve_sweeps.py index 1adf2c206ce..bc380353f8e 100644 --- a/src/ansys/aedt/core/modules/solve_sweeps.py +++ b/src/ansys/aedt/core/modules/solve_sweeps.py @@ -29,6 +29,7 @@ import sys import warnings +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic.constants import unit_converter from ansys.aedt.core.generic.data_handlers import _dict2arg from ansys.aedt.core.generic.general_methods import pyaedt_function_handler @@ -84,7 +85,7 @@ def identify_setup(props): return False -class SweepCommon: +class SweepCommon(PyAedtBase): def __repr__(self): return f"{self.setup_name} : {self.name}" diff --git a/src/ansys/aedt/core/q3d.py b/src/ansys/aedt/core/q3d.py index 3d9eeac6192..6986cb45b35 100644 --- a/src/ansys/aedt/core/q3d.py +++ b/src/ansys/aedt/core/q3d.py @@ -31,6 +31,7 @@ import warnings from ansys.aedt.core.application.analysis_3d import FieldAnalysis3D +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic.constants import MatrixOperationsQ2D from ansys.aedt.core.generic.constants import MatrixOperationsQ3D from ansys.aedt.core.generic.file_utils import generate_unique_name @@ -48,7 +49,7 @@ from ansys.aedt.core.modules.setup_templates import SetupKeys -class QExtractor(FieldAnalysis3D, object): +class QExtractor(FieldAnalysis3D, PyAedtBase): """Extracts a 2D or 3D field analysis. Parameters @@ -1189,7 +1190,7 @@ def export_equivalent_circuit( raise AEDTRuntimeError("Export of equivalent circuit was unsuccessful.") -class Q3d(QExtractor, CreateBoundaryMixin): +class Q3d(QExtractor, CreateBoundaryMixin, PyAedtBase): """Provides the Q3D app interface. This class allows you to create an instance of Q3D and link to an @@ -2574,7 +2575,7 @@ def insert_em_field_sphere( return self._create_boundary(name, props, "NearFieldSphere") -class Q2d(QExtractor, CreateBoundaryMixin): +class Q2d(QExtractor, CreateBoundaryMixin, PyAedtBase): """Provides the Q2D app interface. This class allows you to create an instance of Q2D and link to an diff --git a/src/ansys/aedt/core/rmxprt.py b/src/ansys/aedt/core/rmxprt.py index 62b7556f000..cca51819ae1 100644 --- a/src/ansys/aedt/core/rmxprt.py +++ b/src/ansys/aedt/core/rmxprt.py @@ -25,12 +25,13 @@ """This module contains these classes: ``RMXprtModule`` and ``Rmxprt``.""" from ansys.aedt.core.application.analysis_r_m_xprt import FieldAnalysisRMxprt +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic.general_methods import pyaedt_function_handler from ansys.aedt.core.modeler.cad.elements_3d import BinaryTreeNode from ansys.aedt.core.modules.setup_templates import SetupKeys -class RMXprtModule(object): +class RMXprtModule(PyAedtBase): """Provides RMxprt module properties.""" component = None @@ -132,7 +133,7 @@ class Circuit(RMXprtModule): component = "Circuit" -class Rmxprt(FieldAnalysisRMxprt): +class Rmxprt(FieldAnalysisRMxprt, PyAedtBase): """Provides the RMxprt app interface. Parameters diff --git a/src/ansys/aedt/core/rpc/rpyc_services.py b/src/ansys/aedt/core/rpc/rpyc_services.py index d2a8d486f97..48e4be05fcf 100644 --- a/src/ansys/aedt/core/rpc/rpyc_services.py +++ b/src/ansys/aedt/core/rpc/rpyc_services.py @@ -27,12 +27,13 @@ from ansys.aedt.core.generic.settings import is_linux from ansys.aedt.core.internal.aedt_versions import aedt_versions from ansys.aedt.core.internal.filesystem import is_safe_path +from ansys.aedt.core.base import PyAedtBase logging.basicConfig(stream=sys.stderr, level=logging.INFO) logger = logging.getLogger(__name__) -class FileManagement(object): +class FileManagement(PyAedtBase): """Class to manage file transfer.""" def __init__(self, client): @@ -208,7 +209,7 @@ def check_port(port): return port -class PyaedtServiceWindows(rpyc.Service): +class PyaedtServiceWindows(rpyc.Service, PyAedtBase): """Server Pyaedt rpyc Service.""" def on_connect(self, connection): @@ -860,7 +861,7 @@ def exposed_q2d( return aedtapp -class GlobalService(rpyc.Service): +class GlobalService(rpyc.Service, PyAedtBase): """Global class to manage rpyc Server of PyAEDT.""" def on_connect(self, connection): @@ -1124,7 +1125,7 @@ def normpath(remotepath): return os.path.normpath(remotepath) -class ServiceManager(rpyc.Service): +class ServiceManager(rpyc.Service, PyAedtBase): """Global class to manage rpyc Server of PyAEDT.""" def on_connect(self, connection): diff --git a/src/ansys/aedt/core/twinbuilder.py b/src/ansys/aedt/core/twinbuilder.py index e075b440eee..de4bb424db0 100644 --- a/src/ansys/aedt/core/twinbuilder.py +++ b/src/ansys/aedt/core/twinbuilder.py @@ -29,6 +29,7 @@ from ansys.aedt.core.application.analysis_twin_builder import AnalysisTwinBuilder from ansys.aedt.core.application.variables import Variable +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic.constants import unit_converter from ansys.aedt.core.generic.file_utils import generate_unique_name from ansys.aedt.core.generic.file_utils import open_file @@ -38,7 +39,7 @@ from ansys.aedt.core.internal.checks import min_aedt_version -class TwinBuilder(AnalysisTwinBuilder, object): +class TwinBuilder(AnalysisTwinBuilder, PyAedtBase): """Provides the Twin Builder application interface. Parameters diff --git a/src/ansys/aedt/core/visualization/advanced/doa.py b/src/ansys/aedt/core/visualization/advanced/doa.py index 8c186ee7600..93d3ce16761 100644 --- a/src/ansys/aedt/core/visualization/advanced/doa.py +++ b/src/ansys/aedt/core/visualization/advanced/doa.py @@ -26,6 +26,7 @@ import numpy as np +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic.constants import SpeedOfLight from ansys.aedt.core.generic.general_methods import conversion_function from ansys.aedt.core.generic.general_methods import pyaedt_function_handler @@ -36,7 +37,7 @@ raise Exception("Python 3.10 or higher is required for direction of arrival (DoA) post-processing.") -class DirectionOfArrival: +class DirectionOfArrival(PyAedtBase): """ Class for direction of arrival (DoA) estimation using 2D planar antenna arrays with coordinates in meters and user-defined frequency. diff --git a/src/ansys/aedt/core/visualization/advanced/farfield_visualization.py b/src/ansys/aedt/core/visualization/advanced/farfield_visualization.py index 7c4c9b39edb..c8a2198bb59 100644 --- a/src/ansys/aedt/core/visualization/advanced/farfield_visualization.py +++ b/src/ansys/aedt/core/visualization/advanced/farfield_visualization.py @@ -34,6 +34,7 @@ import numpy as np from ansys.aedt.core.aedt_logger import pyaedt_logger as logger +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic.constants import AEDT_UNITS from ansys.aedt.core.generic.constants import SpeedOfLight from ansys.aedt.core.generic.constants import unit_converter @@ -51,7 +52,7 @@ defusedxml.defuse_stdlib() -class FfdSolutionData(object): +class FfdSolutionData(PyAedtBase): """Provides antenna far-field data. Read element pattern information in a JSON file generated by :func:`FfdSolutionDataExporter` and return the @@ -1574,7 +1575,7 @@ def __rotation_to_euler_angles(rotation): # pragma: no cover return np.array([x, y, z]) -class UpdateBeamForm: +class UpdateBeamForm(PyAedtBase): """Provides for updating far field data. This class is used to interact with the far field Theta and Phi scan. diff --git a/src/ansys/aedt/core/visualization/advanced/frtm_visualization.py b/src/ansys/aedt/core/visualization/advanced/frtm_visualization.py index 49370d0f25e..96d88be896b 100644 --- a/src/ansys/aedt/core/visualization/advanced/frtm_visualization.py +++ b/src/ansys/aedt/core/visualization/advanced/frtm_visualization.py @@ -29,6 +29,7 @@ import numpy as np from ansys.aedt.core.aedt_logger import pyaedt_logger as logger +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic.constants import SpeedOfLight from ansys.aedt.core.generic.general_methods import conversion_function from ansys.aedt.core.generic.general_methods import pyaedt_function_handler @@ -40,7 +41,7 @@ raise Exception("Python 3.10 or higher is required for Monostatic RCS post-processing.") -class FRTMData(object): +class FRTMData(PyAedtBase): """Provides FRTM data. Read FRTM data and return the Python interface to analyze the data. All units are in SI. @@ -854,7 +855,7 @@ def __read_frtm(self): self.__all_data[ch] = temp -class FRTMPlotter(object): +class FRTMPlotter(PyAedtBase): """Provides range doppler data. Read FRTM data and return the Python interface to analyze the range doppler data. All units are in SI. diff --git a/src/ansys/aedt/core/visualization/advanced/hdm_plot.py b/src/ansys/aedt/core/visualization/advanced/hdm_plot.py index d72661d4d3d..159747ec909 100644 --- a/src/ansys/aedt/core/visualization/advanced/hdm_plot.py +++ b/src/ansys/aedt/core/visualization/advanced/hdm_plot.py @@ -29,6 +29,7 @@ import numpy as np +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic.constants import AEDT_UNITS from ansys.aedt.core.generic.general_methods import pyaedt_function_handler from ansys.aedt.core.internal.checks import graphics_required @@ -36,7 +37,7 @@ from ansys.aedt.core.visualization.plot.pyvista import ObjClass -class HDMPlotter(CommonPlotter): +class HDMPlotter(CommonPlotter, PyAedtBase): """ Manages Hdm data to be plotted with ``pyvista``. diff --git a/src/ansys/aedt/core/visualization/advanced/misc.py b/src/ansys/aedt/core/visualization/advanced/misc.py index 6cb23dfe3a7..e3f8776f174 100644 --- a/src/ansys/aedt/core/visualization/advanced/misc.py +++ b/src/ansys/aedt/core/visualization/advanced/misc.py @@ -29,6 +29,7 @@ import re from ansys.aedt.core import settings +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic.constants import CSS4_COLORS from ansys.aedt.core.generic.constants import SI_UNITS from ansys.aedt.core.generic.constants import unit_system @@ -39,7 +40,7 @@ from ansys.aedt.core.internal.load_aedt_file import load_keyword_in_aedt_file -class BoxFacePointsAndFields(object): +class BoxFacePointsAndFields(PyAedtBase): """Data model class containing field component and coordinates.""" def __init__(self): diff --git a/src/ansys/aedt/core/visualization/advanced/rcs_visualization.py b/src/ansys/aedt/core/visualization/advanced/rcs_visualization.py index 8a14ab079d3..593f7505592 100644 --- a/src/ansys/aedt/core/visualization/advanced/rcs_visualization.py +++ b/src/ansys/aedt/core/visualization/advanced/rcs_visualization.py @@ -31,6 +31,7 @@ from scipy.interpolate import RegularGridInterpolator from ansys.aedt.core.aedt_logger import pyaedt_logger as logger +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic.constants import AEDT_UNITS from ansys.aedt.core.generic.constants import SpeedOfLight from ansys.aedt.core.generic.constants import unit_converter @@ -76,7 +77,7 @@ ) -class MonostaticRCSData(object): +class MonostaticRCSData(PyAedtBase): """Provides monostatic radar cross-section (RCS) data. Read monostatic RCS metadata in a JSON file generated by :func:`MonostaticRCSExporter` and return the @@ -620,7 +621,7 @@ def __init_rcs(self): return True -class MonostaticRCSPlotter(object): +class MonostaticRCSPlotter(PyAedtBase): """Provides monostatic radar cross-section (RCS) plot functionalities. Parameters @@ -2557,7 +2558,7 @@ def __get_geometry(self): return obj_meshes -class SceneMeshObject: +class SceneMeshObject(PyAedtBase): """ A class representing a custom 3D mesh object with visualization properties. diff --git a/src/ansys/aedt/core/visualization/advanced/sbrplus/hdm_parser.py b/src/ansys/aedt/core/visualization/advanced/sbrplus/hdm_parser.py index 897cd177fac..4a8ffe84bbf 100644 --- a/src/ansys/aedt/core/visualization/advanced/sbrplus/hdm_parser.py +++ b/src/ansys/aedt/core/visualization/advanced/sbrplus/hdm_parser.py @@ -33,9 +33,10 @@ pass from ansys.aedt.core.aedt_logger import pyaedt_logger +from ansys.aedt.core.base import PyAedtBase -class Parser: +class Parser(PyAedtBase): """Parser class that loads an HDM-format export file from HFSS SBR+, interprets its header and its binary content. Except for the header, the binary content is not parsed until an explicit call to parse_message. diff --git a/src/ansys/aedt/core/visualization/advanced/touchstone_parser.py b/src/ansys/aedt/core/visualization/advanced/touchstone_parser.py index 6d33938bf0b..8705e220b47 100644 --- a/src/ansys/aedt/core/visualization/advanced/touchstone_parser.py +++ b/src/ansys/aedt/core/visualization/advanced/touchstone_parser.py @@ -36,6 +36,7 @@ from ansys.aedt.core import Edb from ansys.aedt.core.aedt_logger import pyaedt_logger as logger +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic.file_utils import open_file from ansys.aedt.core.generic.general_methods import pyaedt_function_handler from ansys.aedt.core.internal.aedt_versions import aedt_versions @@ -58,7 +59,7 @@ keys = {REAL_IMAG: ("real", "imag"), MAG_ANGLE: ("mag", "deg"), DB_ANGLE: ("db20", "deg")} -class TouchstoneData(rf.Network): +class TouchstoneData(rf.Network, PyAedtBase): """Contains data information from Touchstone Read call. Parameters diff --git a/src/ansys/aedt/core/visualization/plot/matplotlib.py b/src/ansys/aedt/core/visualization/plot/matplotlib.py index 362aae9ce47..5f276f2762b 100644 --- a/src/ansys/aedt/core/visualization/plot/matplotlib.py +++ b/src/ansys/aedt/core/visualization/plot/matplotlib.py @@ -29,6 +29,7 @@ import numpy as np +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic.general_methods import pyaedt_function_handler from ansys.aedt.core.generic.settings import settings from ansys.aedt.core.internal.checks import ERROR_GRAPHICS_REQUIRED @@ -82,7 +83,7 @@ def is_ipython(): return False # Probably standard Python interpreter -class Note: +class Note(PyAedtBase): def __init__(self): self._position = (0, 0) self._text = "" @@ -237,7 +238,7 @@ def italic(self, value): self._italic = value -class Trace: +class Trace(PyAedtBase): """Trace class.""" def __init__(self): @@ -449,7 +450,7 @@ def __init__(self): self.hatch_above = True -class ReportPlotter: +class ReportPlotter(PyAedtBase): """Matplotlib Report manager.""" def __init__(self): diff --git a/src/ansys/aedt/core/visualization/plot/pdf.py b/src/ansys/aedt/core/visualization/plot/pdf.py index e1b97be23fe..617714efaf9 100644 --- a/src/ansys/aedt/core/visualization/plot/pdf.py +++ b/src/ansys/aedt/core/visualization/plot/pdf.py @@ -31,13 +31,14 @@ from fpdf import FontFace from ansys.aedt.core import __version__ +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic.constants import unit_converter from ansys.aedt.core.generic.file_utils import open_file from ansys.aedt.core.internal.checks import graphics_required @dataclass -class ReportSpec: +class ReportSpec(PyAedtBase): """Data class containing all report template specifications.""" document_prefix: str = "ANSS" @@ -74,7 +75,7 @@ class ReportSpec: font_caption_color: list = field(default_factory=lambda: [0, 0, 0]) -class AnsysReport(FPDF): +class AnsysReport(FPDF, PyAedtBase): def __init__(self, version="2025R1", design_name="design1", project_name="AnsysProject", tempplate_json_file=None): super().__init__() self.report_specs = ReportSpec() diff --git a/src/ansys/aedt/core/visualization/plot/pyvista.py b/src/ansys/aedt/core/visualization/plot/pyvista.py index d7a8c8d59ea..88d4c1b7880 100644 --- a/src/ansys/aedt/core/visualization/plot/pyvista.py +++ b/src/ansys/aedt/core/visualization/plot/pyvista.py @@ -35,6 +35,7 @@ import numpy as np from ansys.aedt.core.aedt_logger import pyaedt_logger +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic.constants import AEDT_UNITS from ansys.aedt.core.generic.constants import CSS4_COLORS from ansys.aedt.core.generic.file_utils import open_file @@ -290,7 +291,7 @@ def _parse_streamline(filepath): return streamlines -class ObjClass(object): +class ObjClass(PyAedtBase): """Manages mesh files to be plotted in pyvista. Parameters @@ -330,7 +331,7 @@ def color(self, value): self._color = tuple(int(h[i : i + 2], 16) for i in (0, 2, 4)) -class FieldClass(object): +class FieldClass(PyAedtBase): """Class to manage Field data to be plotted in pyvista. Parameters @@ -385,7 +386,7 @@ def __init__( self.scalar_name = None -class CommonPlotter(object): +class CommonPlotter(PyAedtBase): def __init__(self): self._objects = [] self._fields = [] diff --git a/src/ansys/aedt/core/visualization/post/common.py b/src/ansys/aedt/core/visualization/post/common.py index 0c423319a36..55712e34a40 100644 --- a/src/ansys/aedt/core/visualization/post/common.py +++ b/src/ansys/aedt/core/visualization/post/common.py @@ -33,6 +33,7 @@ import re from ansys.aedt.core import Quantity +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic.data_handlers import _dict_items_to_list_items from ansys.aedt.core.generic.file_utils import generate_unique_name from ansys.aedt.core.generic.file_utils import read_configuration_file @@ -68,7 +69,7 @@ } -class PostProcessorCommon(object): +class PostProcessorCommon(PyAedtBase): """Manages the main AEDT postprocessing functions. This class is inherited in the caller application and is accessible through the post variable( eg. ``hfss.post`` or @@ -1951,7 +1952,7 @@ def __apply_settings(props, report_settings): return props -class Reports(object): +class Reports(PyAedtBase): """Provides the names of default solution types.""" def __init__(self, post_app, design_type): diff --git a/src/ansys/aedt/core/visualization/post/compliance.py b/src/ansys/aedt/core/visualization/post/compliance.py index b4705758d8d..696aacf271d 100644 --- a/src/ansys/aedt/core/visualization/post/compliance.py +++ b/src/ansys/aedt/core/visualization/post/compliance.py @@ -31,6 +31,7 @@ from pyedb.generic.constants import unit_converter from ansys.aedt.core import settings +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic.design_types import get_pyaedt_app from ansys.aedt.core.generic.file_utils import generate_unique_name from ansys.aedt.core.generic.file_utils import read_configuration_file @@ -60,7 +61,7 @@ ] -class CommonTemplate: +class CommonTemplate(PyAedtBase): def __init__(self, report): self._name = report["name"] self.report_type = report.get("type", "frequency") @@ -260,7 +261,7 @@ def trace_pins(self, val): self._trace_pins = val -class VirtualComplianceGenerator: +class VirtualComplianceGenerator(PyAedtBase): """Class to generate a Virtual Compliance configuration.""" def __init__(self, compliance_name, project_name, specification_folder=None): @@ -474,7 +475,7 @@ def save_configuration(self, output_file): return write_configuration_file(self.config, output_file) -class VirtualComplianceChaptersData: +class VirtualComplianceChaptersData(PyAedtBase): def __init__(self, title): self.title = title self.content = [] @@ -513,7 +514,7 @@ def add_table(self, table_data) -> dict: return self.add_content(table_data, 3) -class VirtualComplianceData: +class VirtualComplianceData(PyAedtBase): """Virtual compliance data class.""" def __init__(self): @@ -548,7 +549,7 @@ def add_chapter(self, chapter, position=None) -> VirtualComplianceChaptersData: return self.chapters[position] -class VirtualCompliance: +class VirtualCompliance(PyAedtBase): """Provides automatic report generation with pass/fail criteria on virtual compliance. Parameters diff --git a/src/ansys/aedt/core/visualization/post/farfield_exporter.py b/src/ansys/aedt/core/visualization/post/farfield_exporter.py index 9b30bdb79e7..a75e61730f4 100644 --- a/src/ansys/aedt/core/visualization/post/farfield_exporter.py +++ b/src/ansys/aedt/core/visualization/post/farfield_exporter.py @@ -27,6 +27,7 @@ import time from ansys.aedt.core.application.analysis_hf import ScatteringMethods +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic.constants import unit_converter from ansys.aedt.core.generic.data_handlers import variation_string_to_dict from ansys.aedt.core.generic.file_utils import check_and_download_folder @@ -37,7 +38,7 @@ from ansys.aedt.core.visualization.advanced.farfield_visualization import export_pyaedt_antenna_metadata -class FfdSolutionDataExporter: +class FfdSolutionDataExporter(PyAedtBase): """Class to enable export of embedded element pattern data from HFSS. An instance of this class is returned from the diff --git a/src/ansys/aedt/core/visualization/post/field_data.py b/src/ansys/aedt/core/visualization/post/field_data.py index 3e0e1c2708c..ebddea4aa28 100644 --- a/src/ansys/aedt/core/visualization/post/field_data.py +++ b/src/ansys/aedt/core/visualization/post/field_data.py @@ -31,6 +31,7 @@ import tempfile import warnings +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic.constants import AllowedMarkers from ansys.aedt.core.generic.constants import EnumUnits from ansys.aedt.core.generic.data_handlers import _dict2arg @@ -52,7 +53,7 @@ pd = None -class BaseFolderPlot: +class BaseFolderPlot(PyAedtBase): @abstractmethod def to_dict(self): """Convert the settings to a dictionary. @@ -321,7 +322,7 @@ def from_dict(self, dictionary): self.n_levels = dictionary["m_nLevels"] -class SpecifiedScale: +class SpecifiedScale(PyAedtBase): """Provides methods and variables for editing min-max scale folder settings. Parameters @@ -896,7 +897,7 @@ def from_dict(self, dictionary): self.marker_settings = marker -class FieldPlot: +class FieldPlot(PyAedtBase): """Provides for creating and editing field plots. Parameters diff --git a/src/ansys/aedt/core/visualization/post/field_summary.py b/src/ansys/aedt/core/visualization/post/field_summary.py index ce2270cd321..bf736b7786e 100644 --- a/src/ansys/aedt/core/visualization/post/field_summary.py +++ b/src/ansys/aedt/core/visualization/post/field_summary.py @@ -35,6 +35,7 @@ import tempfile import warnings +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic.file_utils import open_file from ansys.aedt.core.generic.general_methods import pyaedt_function_handler @@ -99,7 +100,7 @@ ] -class FieldSummary: +class FieldSummary(PyAedtBase): """Provides Icepak field summary methods.""" def __init__(self, app): diff --git a/src/ansys/aedt/core/visualization/post/fields_calculator.py b/src/ansys/aedt/core/visualization/post/fields_calculator.py index d6f083561c7..b7d272418d1 100644 --- a/src/ansys/aedt/core/visualization/post/fields_calculator.py +++ b/src/ansys/aedt/core/visualization/post/fields_calculator.py @@ -30,6 +30,7 @@ from jsonschema import validate import ansys.aedt.core +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic.file_utils import generate_unique_name from ansys.aedt.core.generic.file_utils import generate_unique_project_name from ansys.aedt.core.generic.file_utils import open_file @@ -37,7 +38,7 @@ from ansys.aedt.core.generic.general_methods import pyaedt_function_handler -class FieldsCalculator: +class FieldsCalculator(PyAedtBase): """Provides the Advanced fields calculator methods. Provide methods to add, load and delete named expressions on top of the diff --git a/src/ansys/aedt/core/visualization/post/monitor_icepak.py b/src/ansys/aedt/core/visualization/post/monitor_icepak.py index 2b7a6701eb0..f7afa9bf995 100644 --- a/src/ansys/aedt/core/visualization/post/monitor_icepak.py +++ b/src/ansys/aedt/core/visualization/post/monitor_icepak.py @@ -24,6 +24,7 @@ import re +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic.constants import SI_UNITS from ansys.aedt.core.generic.constants import unit_system from ansys.aedt.core.generic.data_handlers import _dict2arg @@ -87,7 +88,7 @@ } -class Monitor: +class Monitor(PyAedtBase): """Provides Icepak monitor methods.""" def __init__(self, p_app): @@ -677,7 +678,7 @@ def insert_monitor_object_from_dict(self, monitor_dict, mode=0): return m_name -class ObjectMonitor: +class ObjectMonitor(PyAedtBase): """Provides Icepak Monitor methods and properties.""" def __init__(self, monitor_name, monitor_type, monitor_id, quantity, app): diff --git a/src/ansys/aedt/core/visualization/post/post_3dlayout.py b/src/ansys/aedt/core/visualization/post/post_3dlayout.py index e73a3d2b5af..142c1fde28d 100644 --- a/src/ansys/aedt/core/visualization/post/post_3dlayout.py +++ b/src/ansys/aedt/core/visualization/post/post_3dlayout.py @@ -24,12 +24,13 @@ from pathlib import Path import re +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic.general_methods import pyaedt_function_handler from ansys.aedt.core.generic.settings import settings from ansys.aedt.core.visualization.post.post_common_3d import PostProcessor3D -class PostProcessor3DLayout(PostProcessor3D): +class PostProcessor3DLayout(PostProcessor3D, PyAedtBase): """Manages the main schematic postprocessing functions. .. note:: diff --git a/src/ansys/aedt/core/visualization/post/post_circuit.py b/src/ansys/aedt/core/visualization/post/post_circuit.py index 638db3381e9..c779cfe53ad 100644 --- a/src/ansys/aedt/core/visualization/post/post_circuit.py +++ b/src/ansys/aedt/core/visualization/post/post_circuit.py @@ -28,6 +28,7 @@ import numpy as np +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic.constants import unit_converter from ansys.aedt.core.generic.file_utils import generate_unique_name from ansys.aedt.core.generic.general_methods import pyaedt_function_handler @@ -42,7 +43,7 @@ ) -class PostProcessorCircuit(PostProcessorCommon): +class PostProcessorCircuit(PostProcessorCommon, PyAedtBase): """Manages the main schematic postprocessing functions. .. note:: diff --git a/src/ansys/aedt/core/visualization/post/post_common_3d.py b/src/ansys/aedt/core/visualization/post/post_common_3d.py index dcbe3f5f5b4..3c3cece6979 100644 --- a/src/ansys/aedt/core/visualization/post/post_common_3d.py +++ b/src/ansys/aedt/core/visualization/post/post_common_3d.py @@ -41,6 +41,7 @@ import numpy as np +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic.constants import unit_converter from ansys.aedt.core.generic.file_utils import check_and_download_file from ansys.aedt.core.generic.file_utils import generate_unique_name @@ -55,7 +56,7 @@ from ansys.aedt.core.visualization.report.constants import ORIENTATION_TO_VIEW -class PostProcessor3D(PostProcessorCommon): +class PostProcessor3D(PostProcessorCommon, PyAedtBase): """Manages the main AEDT postprocessing functions. The inherited ``AEDTConfig`` class contains all ``_desktop`` diff --git a/src/ansys/aedt/core/visualization/post/post_hfss.py b/src/ansys/aedt/core/visualization/post/post_hfss.py index 13cc3ef2ccd..bc3ae9891eb 100644 --- a/src/ansys/aedt/core/visualization/post/post_hfss.py +++ b/src/ansys/aedt/core/visualization/post/post_hfss.py @@ -28,13 +28,14 @@ It contains all advanced postprocessing functionalities for creating and editing plots in the 3D tools. """ +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic.general_methods import pyaedt_function_handler from ansys.aedt.core.visualization.post.post_3dlayout import PostProcessor3DLayout from ansys.aedt.core.visualization.post.post_common_3d import PostProcessor3D from ansys.aedt.core.visualization.post.vrt_data import VRTFieldPlot -class PostProcessorHFSS(PostProcessor3D): +class PostProcessorHFSS(PostProcessor3D, PyAedtBase): """Manages the specific HFSS postprocessing functions. .. note:: diff --git a/src/ansys/aedt/core/visualization/post/post_icepak.py b/src/ansys/aedt/core/visualization/post/post_icepak.py index 33e96d00d17..84ea65c60ee 100644 --- a/src/ansys/aedt/core/visualization/post/post_icepak.py +++ b/src/ansys/aedt/core/visualization/post/post_icepak.py @@ -36,6 +36,7 @@ from typing import Optional from typing import Tuple +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic.constants import unit_converter from ansys.aedt.core.generic.file_utils import generate_unique_name from ansys.aedt.core.generic.file_utils import open_file @@ -47,7 +48,7 @@ from ansys.aedt.core.visualization.post.post_common_3d import PostProcessor3D -class PostProcessorIcepak(PostProcessor3D): +class PostProcessorIcepak(PostProcessor3D, PyAedtBase): """Manages the specific Icepak postprocessing functions. .. note:: diff --git a/src/ansys/aedt/core/visualization/post/post_maxwell.py b/src/ansys/aedt/core/visualization/post/post_maxwell.py index f4408498a32..e33ed20dded 100644 --- a/src/ansys/aedt/core/visualization/post/post_maxwell.py +++ b/src/ansys/aedt/core/visualization/post/post_maxwell.py @@ -31,13 +31,14 @@ import secrets import string +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic.general_methods import pyaedt_function_handler from ansys.aedt.core.visualization.post.field_data import FieldPlot from ansys.aedt.core.visualization.post.post_3dlayout import PostProcessor3DLayout from ansys.aedt.core.visualization.post.post_common_3d import PostProcessor3D -class PostProcessorMaxwell(PostProcessor3D): +class PostProcessorMaxwell(PostProcessor3D, PyAedtBase): """Manages the specific Maxwell postprocessing functions. .. note:: diff --git a/src/ansys/aedt/core/visualization/post/rcs_exporter.py b/src/ansys/aedt/core/visualization/post/rcs_exporter.py index 842de1148fd..a3ff1a175f6 100644 --- a/src/ansys/aedt/core/visualization/post/rcs_exporter.py +++ b/src/ansys/aedt/core/visualization/post/rcs_exporter.py @@ -27,6 +27,7 @@ from pathlib import Path import shutil +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic.constants import unit_converter from ansys.aedt.core.generic.file_utils import check_and_download_folder from ansys.aedt.core.generic.general_methods import pyaedt_function_handler @@ -37,7 +38,7 @@ DEFAULT_EXPRESSION = "ComplexMonostaticRCSTheta" -class MonostaticRCSExporter: +class MonostaticRCSExporter(PyAedtBase): """Class to enable export of radar cross-section (RCS) data from HFSS. An instance of this class is returned from the diff --git a/src/ansys/aedt/core/visualization/post/solution_data.py b/src/ansys/aedt/core/visualization/post/solution_data.py index ff92eb3f17e..24f42a711d7 100644 --- a/src/ansys/aedt/core/visualization/post/solution_data.py +++ b/src/ansys/aedt/core/visualization/post/solution_data.py @@ -29,6 +29,7 @@ import numpy as np +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic.constants import AEDT_UNITS from ansys.aedt.core.generic.file_utils import open_file from ansys.aedt.core.generic.file_utils import write_csv @@ -45,7 +46,7 @@ ) -class SolutionData(object): +class SolutionData(PyAedtBase): """Contains information from the :func:`GetSolutionDataPerVariation` method.""" def __init__(self, aedtdata): diff --git a/src/ansys/aedt/core/visualization/post/spisim.py b/src/ansys/aedt/core/visualization/post/spisim.py index 140386d785f..c9ab788d2a9 100644 --- a/src/ansys/aedt/core/visualization/post/spisim.py +++ b/src/ansys/aedt/core/visualization/post/spisim.py @@ -38,6 +38,7 @@ from pydantic import BaseModel from pydantic import Field +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic.file_utils import generate_unique_name from ansys.aedt.core.generic.file_utils import open_file from ansys.aedt.core.generic.general_methods import env_value @@ -49,7 +50,7 @@ from ansys.aedt.core.visualization.post.spisim_com_configuration_files.com_parameters import COMParametersVer3p4 -class ReportBase(BaseModel): +class ReportBase(BaseModel, PyAedtBase): model_config = {"populate_by_name": True} @@ -181,7 +182,7 @@ def dump_spisim_cfg(self, file_path: Union[str, Path]) -> str: return str(file_path) -class SpiSim: +class SpiSim(PyAedtBase): """Provides support to SpiSim batch mode.""" def __init__(self, touchstone_file=""): @@ -738,7 +739,7 @@ def detect_encoding(file_path, expected_pattern="", re_flags=0): return encoding -class DataSet(object): +class DataSet(PyAedtBase): """Base class for storing all traces of a RAW file. Returned by the get_trace() or by the get_axis() methods. Normally the user doesn't have to be aware of this class. It is only used internally to encapsulate the different @@ -818,7 +819,7 @@ class SpiSimRawException(Exception): ... -class SpiSimRawRead(object): +class SpiSimRawRead(PyAedtBase): """Class for reading SPISim wave Files. It can read all types of Files.""" @staticmethod diff --git a/src/ansys/aedt/core/visualization/post/vrt_data.py b/src/ansys/aedt/core/visualization/post/vrt_data.py index d0ccf53d20f..0a30cd99fe9 100644 --- a/src/ansys/aedt/core/visualization/post/vrt_data.py +++ b/src/ansys/aedt/core/visualization/post/vrt_data.py @@ -24,10 +24,11 @@ import os +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic.general_methods import pyaedt_function_handler -class VRTFieldPlot: +class VRTFieldPlot(PyAedtBase): """Creates and edits VRT field plots for SBR+ and Creeping Waves. Parameters diff --git a/src/ansys/aedt/core/visualization/report/common.py b/src/ansys/aedt/core/visualization/report/common.py index 76aa45dbc79..504e91862df 100644 --- a/src/ansys/aedt/core/visualization/report/common.py +++ b/src/ansys/aedt/core/visualization/report/common.py @@ -27,6 +27,7 @@ import os import warnings +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic.constants import LineStyle from ansys.aedt.core.generic.constants import SymbolStyle from ansys.aedt.core.generic.constants import TraceType @@ -40,7 +41,7 @@ from ansys.aedt.core.modeler.geometry_operators import GeometryOperators -class LimitLine(BinaryTreeNode): +class LimitLine(BinaryTreeNode, PyAedtBase): """Line Limit Management Class.""" def __init__(self, post, trace_name, oo=None): @@ -116,7 +117,7 @@ def set_line_properties( return self._change_property(props) -class Note(BinaryTreeNode): +class Note(BinaryTreeNode, PyAedtBase): """Note Management Class.""" def __init__(self, post, plot_note_name, oo=None): @@ -244,7 +245,7 @@ def set_note_properties( return self._change_property(props) -class Trace(BinaryTreeNode): +class Trace(BinaryTreeNode, PyAedtBase): """Provides trace management.""" def __init__( @@ -431,7 +432,7 @@ def set_symbol_properties(self, show=True, style=None, show_arrows=None, fill=No return self._change_property(props) -class CommonReport(BinaryTreeNode): +class CommonReport(BinaryTreeNode, PyAedtBase): """Provides common reports.""" def __init__(self, app, report_category, setup_name, expressions=None): diff --git a/src/ansys/aedt/core/visualization/report/standard.py b/src/ansys/aedt/core/visualization/report/standard.py index 46cf697804a..baa7da7a326 100644 --- a/src/ansys/aedt/core/visualization/report/standard.py +++ b/src/ansys/aedt/core/visualization/report/standard.py @@ -31,13 +31,14 @@ import re +from ansys.aedt.core.base import PyAedtBase from ansys.aedt.core.generic.file_utils import generate_unique_name from ansys.aedt.core.generic.general_methods import pyaedt_function_handler from ansys.aedt.core.modeler.cad.elements_3d import BinaryTreeNode from ansys.aedt.core.visualization.report.common import CommonReport -class Standard(CommonReport): +class Standard(CommonReport, PyAedtBase): """Provides a reporting class that fits most of the app's standard reports.""" def __init__(self, app, report_category, setup_name, expressions=None): @@ -539,7 +540,7 @@ def _context(self): return ctxt -class Spectral(CommonReport): +class Spectral(CommonReport, PyAedtBase): """Provides for managing spectral reports from transient data.""" def __init__(self, app, report_category, setup_name, expressions=None): diff --git a/tests/system/filter_solutions/test_raise_error.py b/tests/system/filter_solutions/test_raise_error.py index e72df3b381e..20d1590a38f 100644 --- a/tests/system/filter_solutions/test_raise_error.py +++ b/tests/system/filter_solutions/test_raise_error.py @@ -43,7 +43,7 @@ def test_close_lumped_design(self, lumped_design): for attr_name in dir(lumped_design): if attr_name.startswith("_") or callable(getattr(lumped_design, attr_name)): continue - if attr_name in ["version"]: + if attr_name in ["version", "public_dir"]: continue assert getattr(lumped_design, attr_name) is None @@ -53,6 +53,6 @@ def test_close_distributed_design(self, distributed_design): for attr_name in dir(distributed_design): if attr_name.startswith("_") or callable(getattr(distributed_design, attr_name)): continue - if attr_name in ["version"]: + if attr_name in ["version", "public_dir"]: continue assert getattr(distributed_design, attr_name) is None diff --git a/tests/system/solvers/test_01_pdf.py b/tests/system/solvers/test_01_pdf.py index 3978309ef45..69c7fedfd91 100644 --- a/tests/system/solvers/test_01_pdf.py +++ b/tests/system/solvers/test_01_pdf.py @@ -55,7 +55,7 @@ def circuit_test(add_app): app.close_project(save=False) -class TestClass(object): +class TestClass: def test_create_pdf(self, local_scratch): report = AnsysReport(design_name="Design1", project_name="Coaxial") report.aedt_version = desktop_version diff --git a/tests/unit/test_pyaedt_base_class.py b/tests/unit/test_pyaedt_base_class.py new file mode 100644 index 00000000000..dd65e069f31 --- /dev/null +++ b/tests/unit/test_pyaedt_base_class.py @@ -0,0 +1,143 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 - 2025 ANSYS, Inc. and/or its affiliates. +# SPDX-License-Identifier: MIT +# +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +from ansys.aedt.core.base import PyAedtBase + + +# Sample hierarchy for chaining +class Vertex(PyAedtBase): + def position(self): + pass + + +class Edge(PyAedtBase): + def vertices(self): + return Vertex() + + +class Face(PyAedtBase): + def edges(self): + return Edge() + + +class Cube(PyAedtBase): + def faces(self): + return Face() + + +# Example classes for testing +class Base(PyAedtBase): + def base_method(self): + pass + + def _base_private(self): + pass + + +class Child(Base): + def child_method(self): + pass + + def _child_private(self): + pass + + +# --------------------------- +# UNIT TESTS +# --------------------------- + +# tests for public_dir method and DirMixin functionality + + +def test_instance_dir_contains_methods(): + cube = Cube() + d = cube.public_dir + assert "faces" in d + assert all(not i.startswith("_") for i in d) + assert "public_dir" not in d # exclude the property itself + + +def test_chaining_dir(): + cube = Cube() + vertex_dir = cube.faces().edges().vertices().public_dir + assert "position" in vertex_dir + assert all(not i.startswith("_") for i in vertex_dir) + + +def test_base_inheritance(): + assert issubclass(Cube, PyAedtBase) + cube = Cube() + assert isinstance(cube, PyAedtBase) + + +def test_dir_sorted(): + cube = Cube() + d = cube.public_dir + assert d == sorted(d) + + +# tests for __dir__ method and DirMixin functionality + + +def test_dir_includes_all_attributes(): + """Ensure __dir__ returns all attributes, not just reordered subset.""" + c = Child() + default_attrs = object.__dir__(c) + custom_attrs = c.__dir__() + + # The sets should be identical — only order changes + assert set(default_attrs) <= set(custom_attrs) + # There must be at least one public and one private + assert any(not a.startswith("_") for a in custom_attrs) + assert any(a.startswith("_") for a in custom_attrs) + + +def test_dir_orders_public_first(): + """Public attributes should appear before private ones.""" + c = Child() + attrs = c.__dir__() + # Find the first private index + first_private = next(i for i, a in enumerate(attrs) if a.startswith("_")) + # Ensure no public names appear after a private + assert all(a.startswith("_") for a in attrs[first_private:]) + + +def test_dir_preserves_methods_from_parents(): + """Inherited public and private methods should appear.""" + c = Child() + attrs = c.__dir__() + assert "base_method" in attrs + assert "_base_private" in attrs + assert "child_method" in attrs + assert "_child_private" in attrs + + +def test_dir_is_sorted_within_groups(): + """Public and private groups should each be alphabetically ordered.""" + c = Child() + attrs = c.__dir__() + public = [a for a in attrs if not a.startswith("_")] + private = [a for a in attrs if a.startswith("_")] + assert public == sorted(public) + assert private == sorted(private) diff --git a/tests/unit/test_utils.py b/tests/unit/test_utils.py index ba12a7f0c48..0bc971a2484 100644 --- a/tests/unit/test_utils.py +++ b/tests/unit/test_utils.py @@ -229,7 +229,7 @@ def test_settings_check_allowed_properties(): ALLOWED_LOG_SETTINGS + ALLOWED_GENERAL_SETTINGS + ALLOWED_LSF_SETTINGS + ["aedt_environment_variables"] ) # Check attributes that are not related to Python objects (otherwise they are not 'allowed') - properties_ignored = ["formatter", "logger", "remote_rpc_session", "time_tick"] + properties_ignored = ["formatter", "logger", "remote_rpc_session", "time_tick", "public_dir"] def get_properties(obj): return [name for name, _ in inspect.getmembers(type(obj), lambda v: isinstance(v, property))]