## ApplyFlexEnv

### Introduced

v1.0

### Description

Applies an Envelope.

### Scripting Syntax

    oReturn = ApplyFlexEnv( [ConnectionSet], [AssignNewDeformers], [ConstructionMode] );

### Return Value

An XSICollection containing the new envelope operator.
Warning: If the object already has an envelope operator, this command returns an empty collection. You can avoid this error by always testing the XSICollection.Count of the returned collection or by freezing the object's stack (removes any existing envelope operators).

### Parameters

Parameter | Type | Description
--- | --- | ---
ConnectionSet | ConnectionSet | Specifies the envelope and the bone. Default Value: Currently selected objects are used as the main group. Warning: An error occurs if the connection set is invalid. Please verify the connection set required for this operator to avoid breaking your scripts.
AssignNewDeformers | Boolean | True to automatically assign deformer objects when they are added to existing Envelopes. Default Value: False
ConstructionMode | siConstructionMode | Specifies in which construction mode to apply the envelope. Default Value: Use the current construction mode

### Examples

#### VBScript Example

    ' Build a simple Envelope with no picking required.

    CreatePrim "Sphere", "MeshSurface"

    Create2DSkeleton -0.019, 3.703, 0.000, -0.795, 0.000, 0.000, 0.000, 0.000, 1.000, 1

    AppendBone , 0.000, -3.509, 0.000

    SelectObj "sphere", , True

    ApplyFlexEnv "sphere;bone,bone1,eff", False

    ' Add a new chain to the Envelope created above, and assign it automatically.

    Create2DSkeleton 1.996, 3.238, 0.000, 3.275, 0.097, 0.000, 0.000, 0.000, 1.000, 1

    AppendBone , 1.589, -3.257, 0.000

    SelectObj "sphere", , True

    ApplyFlexEnv "sphere;bone2,bone3,eff1", True

### See Also

SIApplyFlexEnv