add_expression#
- FieldsCalculator.add_expression(calculation, assignment, name=None)#
Add named expression.
- Parameters:
- calculation
str
,dict
Calculation type. If provided as a string, it has to be a name defined in the expression_catalog.toml. If provided as a dict, it has to contain all the necessary arguments to define an expression. For reference look at the expression_catalog.toml.
- assignment
int
oransys.aedt.core.modeler.cad.object_3d.Object3d
or
- :class:`ansys.aedt.core.modeler.cad.FacePrimitive
Name of the object to add the named expression from.
- name
str
,optional
Name of the named expression. The default is
None
.
- calculation
- Returns:
Examples
>>> from ansys.aedt.core import Hfss >>> hfss = Hfss() >>> poly = hfss.modeler.create_polyline([[0, 0, 0], [1, 0, 1]], name="Polyline1") >>> my_expression = { ... "name": "test", ... "description": "Voltage drop along a line", ... "design_type": ["HFSS", "Q3D Extractor"], ... "fields_type": ["Fields", "CG Fields"], ... "solution_type": "", ... "primary_sweep": "Freq", ... "assignment": "", ... "assignment_type": ["Line"], ... "operations": ["Fundamental_Quantity('E')", ... "Operation('Real')", ... "Operation('Tangent')", ... "Operation('Dot')", ... "EnterLine('assignment')", ... "Operation('LineValue')", ... "Operation('Integrate')", ... "Operation('CmplxR')"], ... "report": ["Data Table", "Rectangular Plot"], ... } >>> expr_name = hfss.post.fields_calculator.add_expression(my_expression, "Polyline1") >>> hfss.release_desktop(False, False)