# Expression Class Reference

Related Scripting Object: Expression

An expression string is a mathematical formula that controls any animatable parameter. It may include object and parameter names, mathematical operators, and tokens representing functions or constants. More...

`#include <xsi_expression.h>`

Inheritance diagram for Expression:

List of all members.

## Public Member Functions
| Expression ()
| ~Expression ()
| Expression (const CRef &in_ref)
| Expression (const Expression &in_obj)
bool | IsA (siClassID in_ClassID) const
siClassID | GetClassID () const
Expression & | operator= (const Expression &in_obj)
Expression & | operator= (const CRef &in_ref)

## Detailed Description

An expression string is a mathematical formula that controls any animatable parameter. It may include object and parameter names, mathematical operators, and tokens representing functions or constants.

The Expression object has an expression string (stored in the definition parameter) and can be created with the AddExpr command. If a parameter value is driven by an expression you can get this expression using Parameter::GetSource.

See also:
  Parameter::GetSource

Since:
  4.0

Example:

              using namespace XSI;
              Application app;
              Model root = app.GetActiveSceneRoot();

              Null myNull;
              root.AddNull( L"myNull", myNull );

              Parameter posx = myNull.GetParameter(L"posx");

              CValueArray args(2);
              CValue      outArg;
              args[0] = posx.GetFullName();
              args[1] = posx.GetFullName() + L" + 4.0";

              app.ExecuteCommand(L"AddExpr", args, outArg);

              Expression myPosxExpr = posx.GetSource();
              Parameter myDefinition = myPosxExpr.GetParameter(L"definition");

              app.LogMessage(L"The expression definition is " +
                              myDefinition.GetValue().GetAsText());

## Constructor & Destructor Documentation

Expression | ( |  | ) |

Default constructor.

~Expression | ( |  | ) |

Default destructor.

Expression | ( | const CRef & | in_ref | ) |

Constructor.

Parameters:

  | in_ref | constant reference object.

Expression | ( | const Expression & | in_obj | ) |

Copy constructor.

Parameters:

  | in_obj | constant class object.

## Member Function Documentation

bool IsA | ( | siClassID | in_ClassID | ) | const`[virtual]`

Returns true if a given class type is compatible with this API class.

Parameters:

  | in_ClassID | class type.

Returns:
  true if the class is compatible, false otherwise.

Reimplemented from Operator.

siClassID GetClassID | ( |  | ) | const`[virtual]`

Returns the type of the API class.

Returns:
  The class type.

Reimplemented from Operator.

Expression& operator= | ( | const Expression & | in_obj | ) |

Creates an object from another object. The newly created object is set to empty if the input object is not compatible.

Parameters:

  | in_obj | constant class object.

Returns:
  The new Expression object.

Expression& operator= | ( | const CRef & | in_ref | ) |

Creates an object from a reference object. The newly created object is set to empty if the input reference object is not compatible.

Parameters:

  | in_ref | constant class object.

Returns:
  The new Expression object.

Reimplemented from Operator.

The documentation for this class was generated from the following file:

- xsi_expression.h