create_variable#

ENS_GLOBALS.create_variable(name: str, value: str, sources: List[ENS_PART] | None = None, private: int = 0) ENS_VAR#

This method creates a new EnSight variable.

It creates a variable with the provided name, using the calculator expression supplied by the value. If the expression requires a partlist, this is supplied using the ‘sources’ keyword (the default is the current part selection).

Args:
name:

The name of the variable to create.

value:

The expression to evaluate as the new variable. See also: Calculator Functions.

sources:

A list of parts to create the variable with. This can be specified as an ENS_GROUP object, or a list of part names/ids/objects.

private:

If the private=1 keyword is set, the variable will be marked as “hidden” and will not show up in some part lists (e.g. in popup dialogs).

Returns:

An ENS_VAR instance.

Example:
var = session.ensight.objs.core.create_variable("EleSize", "EleSize(plist)", sources=session.ensight.objs.core.PARTS)