Getting Output Arguments from Methods

Unlike commands, Python can extract output arguments from Softimage methods as long as it uses the tuple syntax. As long as you initialize that variables beforehand (for example, by setting them to 0), you can multiple-assign them from the method (marked in bold below):

    # Set up aN SIVector3 math object
    v3 = XSIMath.CreateVector3()
    v3.Set( 10.0, 20.0, 30.0)
    v3.ScaleInPlace(2)

    # Initialize the variables (you need to initialize
    # variables to be used as input to SIVector3.Get)
    x=0
    y=0
    z=0

    # Retrieve the three values from the SIVector3.Get method
    # (use the same variables as input)
    x, y, z = v3.Get(x, y, z)

    # Write the results to the Script Editor
    Application.LogMessage( '%(x).2f %(y).2f %(z).2f' % vars() )

    # Output of the above script:
    # INFO : 20.00 40.00 60.00

| For another example of using Python with methods, see Python Example: Using Tuples to Access Output Arguments from a Method.

Autodesk Softimage v7.5