VariableManager#
- class pyedb.dotnet.database.Variables.VariableManager(app)#
Bases:
objectManages 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
pyedb.dotnet.database.Variables.Variableclass.- Parameters:
- variables
dict Dictionary of all design properties and project variables in the active design.
- design_variables
dict Dictionary of all design properties in the active design.
- project_variables
dict Dictionary of all project variables available to the active design (key by variable name).
- dependent_variables
dict Dictionary of all dependent variables available to the active design (key by variable name).
- independent_variables
dict Dictionary of all independent variables (constant numeric values) available to the active design (key by variable name).
- independent_design_variables
dict - independent_project_variables
dict - variable_names
strorlist One or more variable names.
- project_variable_names
strorlist One or more project variable names.
- design_variable_names
strorlist One or more design variable names.
- dependent_variable_names
strorlist All dependent variable names within the project.
- independent_variable_names
listofstr All independent variable names within the project. These can be sweep variables for optimetrics.
- independent_project_variable_names
strorlist All independent project variable names within the project. These can be sweep variables for optimetrics.
- independent_design_variable_names
strorlist All independent design properties (local variables) within the project. These can be sweep variables for optimetrics.
- variables
Examples
>>> from ansys.aedt.core.maxwell import Maxwell3d >>> from ansys.aedt.core.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':
, 'Var2':, 'Var3':, '$PrjVar1':} Get a dictionary of only the design variables.
>>> v.design_variables {'Var1':
, 'Var2':, 'Var3':} Get a dictionary of only the independent design variables.
>>> v.independent_design_variables {'Var1':
, 'Var2':}
Overview#
Decompose a variable string to a floating with its unit. |
|
Retrieve the variable value of a project or design variable as a string. |
|
Retrieve an AEDT object. |
|
Set the value of a design property or project variable. |
|
Delete a separator from either the active project or design. |
|
Delete a variable. |
Variables. |
|
Design variables. |
|
Project variables. |
|
Post Processing variables. |
|
Independent variables. |
|
Independent project variables. |
|
Independent design variables. |
|
Dependent variables. |
|
Dependent project variables. |
|
Dependent design variables. |
|
List of variables. |
|
List of project variables. |
|
List of design variables. |
|
List of independent project variables. |
|
List of independent design variables. |
|
List of independent variables. |
|
List of dependent project variables. |
|
List of dependent design variables. |
|
List of dependent variables. |
Implement del with array name or index. |
|
Import detail#
from pyedb.dotnet.database.Variables import VariableManager
Property detail#
- property VariableManager.variables#
Variables.
- Returns:
dictDictionary of the Variable objects for each project variable and each design property in the active design.
References
>>> oProject.GetVariables >>> oDesign.GetVariables >>> oProject.GetChildObject("Variables").GetChildNames >>> oDesign.GetChildObject("Variables").GetChildNames
- property VariableManager.design_variables#
Design variables.
- Returns:
dictDictionary of the design properties (local properties) in the design.
References
>>> oDesign.GetVariables >>> oDesign.GetChildObject("Variables").GetChildNames
- property VariableManager.project_variables#
Project variables.
- Returns:
dictDictionary of the project properties.
References
>>> oProject.GetVariables >>> oProject.GetChildObject("Variables").GetChildNames
- property VariableManager.post_processing_variables#
Post Processing variables.
- Returns:
dictDictionary of the post processing variables (constant numeric values) available to the design.
References
>>> oProject.GetVariables >>> oDesign.GetVariables >>> oProject.GetChildObject("Variables").GetChildNames >>> oDesign.GetChildObject("Variables").GetChildNames
- property VariableManager.independent_variables#
Independent variables.
- Returns:
dictDictionary of the independent variables (constant numeric values) available to the design.
References
>>> oProject.GetVariables >>> oDesign.GetVariables >>> oProject.GetChildObject("Variables").GetChildNames >>> oDesign.GetChildObject("Variables").GetChildNames
- property VariableManager.independent_project_variables#
Independent project variables.
- Returns:
dictDictionary of the independent project variables available to the design.
References
>>> oProject.GetVariables >>> oProject.GetChildObject("Variables").GetChildNames
- property VariableManager.independent_design_variables#
Independent design variables.
- Returns:
dictDictionary of the independent design properties (local variables) available to the design.
References
>>> oDesign.GetVariables >>> oDesign.GetChildObject("Variables").GetChildNames
- property VariableManager.dependent_variables#
Dependent variables.
- Returns:
dictDictionary of the dependent design properties (local variables) and project variables available to the design.
References
>>> oProject.GetVariables >>> oDesign.GetVariables >>> oProject.GetChildObject("Variables").GetChildNames >>> oDesign.GetChildObject("Variables").GetChildNames
- property VariableManager.dependent_project_variables#
Dependent project variables.
- Returns:
dictDictionary of the dependent project variables available to the design.
References
>>> oProject.GetVariables >>> oProject.GetChildObject("Variables").GetChildNames
- property VariableManager.dependent_design_variables#
Dependent design variables.
- Returns:
dictDictionary of the dependent design properties (local variables) available to the design.
References
>>> oDesign.GetVariables >>> oDesign.GetChildObject("Variables").GetChildNames
- property VariableManager.variable_names#
List of variables.
- property VariableManager.project_variable_names#
List of project variables.
References
>>> oProject.GetVariables >>> oProject.GetChildObject("Variables").GetChildNames
- property VariableManager.design_variable_names#
List of design variables.
References
>>> oDesign.GetVariables >>> oDesign.GetChildObject("Variables").GetChildNames
- property VariableManager.independent_project_variable_names#
List of independent project variables.
References
>>> oProject.GetVariables >>> oProject.GetChildObject("Variables").GetChildNames
- property VariableManager.independent_design_variable_names#
List of independent design variables.
References
>>> oDesign.GetVariables >>> oDesign.GetChildObject("Variables").GetChildNames
- property VariableManager.independent_variable_names#
List of independent variables.
References
>>> oProject.GetVariables >>> oDesign.GetVariables >>> oProject.GetChildObject("Variables").GetChildNames >>> oDesign.GetChildObject("Variables").GetChildNames
- property VariableManager.dependent_project_variable_names#
List of dependent project variables.
References
>>> oProject.GetVariables >>> oProject.GetChildObject("Variables").GetChildNames
- property VariableManager.dependent_design_variable_names#
List of dependent design variables.
References
>>> oDesign.GetVariables >>> oDesign.GetChildObject("Variables").GetChildNames
- property VariableManager.dependent_variable_names#
List of dependent variables.
References
>>> oProject.GetVariables >>> oDesign.GetVariables >>> oProject.GetChildObject("Variables").GetChildNames >>> oDesign.GetChildObject("Variables").GetChildNames
Method detail#
- VariableManager.decompose(variable_value)#
Decompose a variable string to a floating with its unit.
- Parameters:
- variable_value
str
- variable_value
- Returns:
tupleThe float value of the variable and the units exposed as a string.
Examples
>>> hfss = Hfss() >>> print(hfss.variable_manager.decompose("5mm")) >>> (5.0, "mm") >>> hfss["v1"] = "3N" >>> print(hfss.variable_manager.decompose("v1")) >>> (3.0, "N") >>> hfss["v2"] = "2*v1" >>> print(hfss.variable_manager.decompose("v2")) >>> (6.0, "N")
- VariableManager.__delitem__(key)#
Implement del with array name or index.
- VariableManager.__getitem__(variable_name)#
- VariableManager.__setitem__(variable, value)#
- VariableManager.get_expression(variable_name)#
Retrieve the variable value of a project or design variable as a string.
References
>>> oProject.GetVariableValue >>> oDesign.GetVariableValue
- VariableManager.aedt_object(variable)#
Retrieve an AEDT object.
- Parameters:
- variable
str - Name of the variable.
- variable
- VariableManager.set_variable(variable_name, expression=None, readonly=False, hidden=False, description=None, overwrite=True, postprocessing=False, circuit_parameter=True)#
Set the value of a design property or project variable.
- Parameters:
- variable_name
str Name of the design property or project variable (
$var). If this variable does not exist, a new one is created and a value is set.- expression
str Valid string expression within the AEDT design and project structure. For example,
"3*cos(34deg)".- readonlybool,
optional Whether to set the design property or project variable to read-only. The default is
False.- hiddenbool,
optional Whether to hide the design property or project variable. The default is
False.- description
str,optional Text to display for the design property or project variable in the
Propertieswindow. The default isNone.- overwritebool,
optional Whether to overwrite an existing value for the design property or project variable. The default is
False, in which case this method is ignored.- postprocessingbool,
optional - Whether to define a postprocessing variable.
The default is
False, in which case the variable is not used in postprocessing.
- circuit_parameterbool,
optional - Whether to define a parameter in a circuit design or a local parameter.
The default is
True, in which case a circuit variable is created as a parameter default.
- variable_name
- Returns:
- bool
Truewhen successful,Falsewhen failed.
References
>>> oProject.ChangeProperty >>> oDesign.ChangeProperty
Examples
Set the value of design property
p1to"10mm", creating the property if it does not already eixst.>>> aedtapp.variable_manager.set_variable("p1", expression="10mm")
Set the value of design property
p1to"20mm"only if the property does not already exist.>>> aedtapp.variable_manager.set_variable("p1", expression="20mm", overwrite=False)
Set the value of design property
p2to"10mm", creating the property if it does not already exist. Also make it read-only and hidden and add a description.>>> aedtapp.variable_manager.set_variable( ... variable_name="p2", ... expression="10mm", ... readonly=True, ... hidden=True, ... description="This is the description of this variable.", ... )
Set the value of the project variable
$p1to"30mm", creating the variable if it does not exist.>>> aedtapp.variable_manager.set_variable["$p1"] == "30mm"
- VariableManager.delete_separator(separator_name)#
Delete a separator from either the active project or design.
- Parameters:
- separator_name
str Value to use for the delimiter.
- separator_name
- Returns:
- bool
Truewhen the separator exists and can be deleted,Falseotherwise.
References
>>> oProject.ChangeProperty >>> oDesign.ChangeProperty