Parameters and formulas
Drive Scene dimensions from named Parameters and unit-aware formulas with the Formula Graph, and mark design variables for optimization.
Each Scene has a Formula Graph: its Parameters, the constants formulas can use, and the bindings that tie numeric fields to formulas. Change a Parameter and Studio recomputes every field that depends on it.
Parameters#
A Parameter is a named formula, such as w = 2.5 or gap = w / 10. You edit
Parameters in the Parameters panel, from Python with Scene.parameters, or by
asking the Agent. Parameters have no unit; describe what they mean in their
description.
Built-in constants are c (299792458 m/s), pi and inf. Plugins can
register more. Formulas can call math functions such as sin and max;
Parameter names cannot reuse a constant or function name.
Renaming a Parameter rewrites every formula that reads it.
Bindings and units#
A binding attaches a formula to one numeric field, or one component of a
vector field, of an entity. The formula is read in the field's display unit.
For example, with w = 2.5, a field shown in um and bound to w / 2
stores 1.25e-6 m.
Fields always store the evaluated number in SI units. Solvers, Plugins and scripts that read a Scene only ever see numbers, so they do not need to know formulas exist.
Transform rotations are three Euler angles in radians, read in degrees
unless the binding says rad.
Design variables#
Mark a Parameter as a design variable, optionally with lower and upper bounds, to let an optimization change it. Only a free Parameter, one whose formula reads no other Parameter, can be a design variable. Gradients flow through the Formula Graph to every field the variable drives. See Design optimization.
In the file#
Parameters are saved as [[parameter]] rows in the .wtscene file, and each
binding is saved with its entity. A file saved by Studio or by witwin.studio
always holds field values that match their formulas.