add_design_variable#

Edb.add_design_variable(variable_name, variable_value, is_parameter=False, description='')[source]#

Add a variable to edb. The variable can be a design one or a project variable (using $ prefix).

..note::

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

Parameters:
variable_namestr

Name of the variable. To added the variable as a project variable, the name must begin with $.

variable_valuestr, float

Value of the variable with units.

is_parameterbool, optional

Whether to add the variable as a local variable. The default is False. When True, the variable is added as a parameter default.

descriptionstr, optional

Description of the variable.

Returns
——-
tuple

Tuple containing the AddVariable result and variable server.

Examples

>>> from pyedb import Edb
>>> edb_app = Edb()
>>> boolean_1, ant_length = edb_app.add_design_variable("my_local_variable", "1cm")
>>> print(edb_app["my_local_variable"])    #using getitem
>>> edb_app["my_local_variable"] = "1cm"   #using setitem
>>> boolean_2, para_length = edb_app.change_design_variable_value("my_parameter", "1m", is_parameter=True
>>> boolean_3, project_length = edb_app.change_design_variable_value("$my_project_variable", "1m")