add#

ScalarComplex.add(name: str, assignment=None) str | bool#

Register this expression as an AEDT named expression.

Parameters:
namestr

Name of the named expression to create.

assignmentoptional

Object assignment passed through to FieldsCalculator.add_expression(). Geometry referenced through Line / Surface / Volume is already embedded in the operation stack, so this is usually None.

Returns:
str or bool

The named-expression name when successful, False otherwise.

Examples

Register a compiled expression through the bound calculator.

>>> calc = type(
...     "Calc",
...     (),
...     {
...         "design_type": "HFSS",
...         "add_expression": staticmethod(lambda *args, **kwargs: kwargs["name"]),
...     },
... )()
>>> from ansys.aedt.core.visualization.post.field_calculator_expressions import FieldExpressions
>>> fx = FieldExpressions(calc)
>>> fx.vector("E").magnitude().add("e_mag")
'e_mag'