add_project_variable#

Edb.add_project_variable(variable_name, variable_value)[source]#

Add a variable to edb database (project). The variable will have the prefix $.

..note::

User can use also the setitem to create or assign a variable. See example below.

Parameters:
variable_namestr

Name of the variable. Name can be provided without $ prefix.

variable_valuestr, float

Value of the variable with units.

Returns:
tuple

Tuple containing the AddVariable result and variable server.

Examples

>>> from pyaedt import Edb
>>> edb_app = Edb()
>>> boolean_1, ant_length = edb_app.add_project_variable("my_local_variable", "1cm")
>>> print(edb_app["$my_local_variable"])    #using getitem
>>> edb_app["$my_local_variable"] = "1cm"   #using setitem