to_dict#

ScalarComplex.to_dict(name: str, assignment: str = '') dict#

Compile this expression to a Fields Calculator expression dictionary.

Parameters:
namestr

Name assigned to the compiled expression.

assignmentstr, optional

Assignment stored in the exported dictionary.

Returns:
dict

Dictionary payload accepted by FieldsCalculator.

Examples

Serialize a magnitude expression to the calculator schema.

>>> from ansys.aedt.core.visualization.post.field_calculator_expressions import FieldExpressions
>>> fx = FieldExpressions(calculator=None)
>>> data = fx.vector("E").magnitude().to_dict("e_mag")
>>> data["name"], data["operations"][-1]
('e_mag', "Operation('Mag')")