GetConstrainedObje cts

Introduced

3.0

Description

Finds all the objects constrained to an X3DObject

Note: This command uses output arguments. C# and some scripting languages (such as JScript, PerlScript and Python) don't support arguments passed by reference so you need to use the best workaround for your situation:

For scripting languages this command returns an ISIVTCollection which you can use to get the output arguments.

For C# you can use the XSIApplication.ExecuteCommand method to call this command. ExecuteCommand packs the output arguments into a C# System.Object containing an Array of the output arguments (see Calling Commands from C#).

Scripting Syntax

    GetConstrainedObjects( InputObj, OutputObjs )

Parameters

Parameter | Type | Description
InputObj | String or X3DObject | Object which is constraining other objects
OutputObjs [out] | XSICollection | Returns the list of constrained objects

Examples

1. VBScript Example

    '
    '  This example demonstrates the GetConstrainedObjects command
    '

    NewScene , false

    Create2DSkeleton 0, -0.2, 3.0, 0, 2, 0.2, 0, 90, 0, 4
    Create2DSkeleton 0, -1, 2.0, 0, 4, 0.1, 0, 90, 0, 4

    CreatePrim "Cube", "MeshSurface"

    ' Constrain two bones to the cube
    ApplyCns "Position", "eff", "cube"
    ApplyCns "Position", "eff1", "cube"

    dim objCollection

    call GetConstrainedObjects (Selection(0), objCollection)

    logmessage "There are " & objCollection.Count & _
       " objects constrained to " & Selection(0)
    logmessage "The first constrained object is " & objCollection.Item(0)
    logmessage "The second constrained object is " & objCollection.Item(1)

    ' Expected results:
    'INFO : There are 2 objects constrained to cube
    'INFO : The first constrained object is eff1
    'INFO : The second constrained object is eff

2. JScript Example

    /*
       This example demonstrates the GetConstrainedObjects command
    */

    NewScene( null, false ) ;

    Create2DSkeleton( 0, -0.2, 3.0, 0, 2, 0.2, 0, 90, 0, 4 );
    Create2DSkeleton( 0, -1, 2.0, 0, 4, 0.1, 0, 90, 0, 4 ) ;

    CreatePrim( "Cube", "MeshSurface" ) ;

    // Constrain both skeletons to the cube
    ApplyCns( "Position", "eff", "cube" ) ;
    ApplyCns( "Position", "eff1", "cube" ) ;

    // JScript doesn't support output arguments but the
    // information is also available as a return value
    var aRetArgs = GetConstrainedObjects(Selection(0) );

    // There is only one output argument so it is
    // first in the returned collection
    var objCollection = aRetArgs(0) ;

    logmessage( "There are " + objCollection.Count +
       " objects constrained to " + Selection(0) ) ;
    logmessage( "The first constrained object is " + objCollection.Item(0) ) ;
    logmessage( "The second constrained object is " + objCollection.Item(1) ) ;

    //Expected results:
    //INFO : There are 2 objects constrained to cube
    //INFO : The first constrained object is eff1
    //INFO : The second constrained object is eff

See Also

Constraint | Kinematics.Constraints | ApplyCns | SelectConstrainingObjects

Autodesk Softimage v7.5