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 the 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)

# Initialize the variables (you need to initialize
# variables to be used as input to SIVector3.Get)

# 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.

Creative Commons License Except where otherwise noted, this work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License