Anatomy of a Rule
Learn about the base requirements to structure a Rule script.
Read time 2 minutesLast updated 2 hours ago
A Rule script needs two complementary statements at minimum. One defines a user control, and another applies its value to a property.
Minimum functional Rule structure
To compose a basic functional Rule, you minimally have to specify two complementary statements, each represented by a code line:
- A statement that defines the Rule, which includes the definition of a user control.
- A statement that sets the model property value you want to manipulate with the user control.
The first statement outputs a variable value that the second one uses as an input. You can additionally process the variable value in between, if needed.
Rule definition
Here's the generic syntax of a statement that defines a Rule and its user control.
<variable_name> = <rule_definition_function>(<rule_name>, <reference_values>)
Key element | Description |
|---|---|
| The name of the variable that holds the value controlled by the Rule. |
| The function that defines which type of control to use in the UI (slider, checkbox...) Several rule definition functions are available. |
| The name of the Rule, and optionally the name of its grouping category, in the UI. |
| Static values that frame the Rule according to its type, including default values. |
Property value setup
Here's the generic syntax of a statement that sets a model property value to manipulate.
<property_value_setup_function>(<target_property_identifiers>, <input_parameters>)
Key element | Description |
|---|---|
| Function to specify which type of property setup to perform. Several property value setup functions are available. |
| Parameters to specify which property of which object to control with the Rule. |
| Parameters to set the property value according to the variable |