VariableManager#

class pyaedt.application.Variables.VariableManager(app)[source]#

Manages design properties and project variables.

Design properties are the local variables in a design. Project variables are defined at the project level and start with $.

This class provides access to all variables or a subset of the variables. Manipulation of the numerical or string definitions of variable values is provided in the pyaedt.application.Variables.Variable class.

Parameters:
variablesdict

Dictionary of all design properties and project variables in the active design.

design_variablesdict

Dictionary of all design properties in the active design.

project_variablesdict

Dictionary of all project variables available to the active design (key by variable name).

dependent_variablesdict

Dictionary of all dependent variables available to the active design (key by variable name).

independent_variablesdict

Dictionary of all independent variables (constant numeric values) available to the active design (key by variable name).

independent_design_variablesdict
independent_project_variablesdict
variable_namesstr or list

One or more variable names.

project_variable_namesstr or list

One or more project variable names.

design_variable_namesstr or list

One or more design variable names.

dependent_variable_namesstr or list

All dependent variable names within the project.

independent_variable_nameslist of str

All independent variable names within the project. These can be sweep variables for optimetrics.

independent_project_variable_namesstr or list

All independent project variable names within the project. These can be sweep variables for optimetrics.

independent_design_variable_namesstr or list

All independent design properties (local variables) within the project. These can be sweep variables for optimetrics.

Examples

>>> from pyaedt.maxwell import Maxwell3d
>>> from pyaedt.desktop import Desktop
>>> d = Desktop()
>>> aedtapp = Maxwell3d()

Define some test variables.

>>> aedtapp["Var1"] = 3
>>> aedtapp["Var2"] = "12deg"
>>> aedtapp["Var3"] = "Var1 * Var2"
>>> aedtapp["$PrjVar1"] = "pi"

Get the variable manager for the active design.

>>> v = aedtapp.variable_manager

Get a dictionary of all project and design variables.

>>> v.variables
{'Var1': <pyaedt.application.Variables.Variable at 0x2661f34c448>,
 'Var2': <pyaedt.application.Variables.Variable at 0x2661f34c308>,
 'Var3': <pyaedt.application.Variables.Expression at 0x2661f34cb48>,
 '$PrjVar1': <pyaedt.application.Variables.Expression at 0x2661f34cc48>}

Get a dictionary of only the design variables.

>>> v.design_variables
{'Var1': <pyaedt.application.Variables.Variable at 0x2661f339508>,
 'Var2': <pyaedt.application.Variables.Variable at 0x2661f3415c8>,
 'Var3': <pyaedt.application.Variables.Expression at 0x2661f341808>}

Get a dictionary of only the independent design variables.

>>> v.independent_design_variables
{'Var1': <pyaedt.application.Variables.Variable at 0x2661f335d08>,
 'Var2': <pyaedt.application.Variables.Variable at 0x2661f3557c8>}

Methods

VariableManager.aedt_object(variable)

Retrieve an AEDT object.

VariableManager.decompose(variable_value)

Decompose a variable string to a floating with its unit.

VariableManager.delete_separator(separator_name)

Delete a separator from either the active project or design.

VariableManager.delete_unused_variables()

Delete unused design and project variables.

VariableManager.delete_variable(var_name)

Delete a variable.

VariableManager.get_expression(variable_name)

Retrieve the variable value of a project or design variable as a string.

VariableManager.is_used(var_name)

Find if a variable is used.

VariableManager.set_variable(variable_name)

Set the value of a design property or project variable.

Attributes

VariableManager.dependent_design_variable_names

List of dependent design variables.

VariableManager.dependent_design_variables

Dependent design variables.

VariableManager.dependent_project_variable_names

List of dependent project variables.

VariableManager.dependent_project_variables

Dependent project variables.

VariableManager.dependent_variable_names

List of dependent variables.

VariableManager.dependent_variables

Dependent variables.

VariableManager.design_variable_names

List of design variables.

VariableManager.design_variables

Design variables.

VariableManager.independent_design_variable_names

List of independent design variables.

VariableManager.independent_design_variables

Independent design variables.

VariableManager.independent_project_variable_names

List of independent project variables.

VariableManager.independent_project_variables

Independent project variables.

VariableManager.independent_variable_names

List of independent variables.

VariableManager.independent_variables

Independent variables.

VariableManager.post_processing_variables

Post Processing variables.

VariableManager.project_variable_names

List of project variables.

VariableManager.project_variables

Project variables.

VariableManager.variable_names

List of variables.

VariableManager.variables

Variables.