Scripting – How to get the active objects for component selection


When you’re in a component selection mode (such as Edge, Polygon, or Point), the active objects are highlighted in orange. The “active objects” are the objects that are “active for component selection”.

When Softimage is in a component selection mode, the Selection will either by empty or it will contain CollectionItems (one for each object with selected components).

So, how do you get the active objects? Here’s one way, using the little known, magical “.[obj].”:

# Python
import win32com.client
oActiveObjects = win32com.client.Dispatch( "XSI.Collection" )
oActiveObjects.Items = ".[obj]."
// JScript
var oActiveObjects = new ActiveXObject( "XSI.Collection" );
oActiveObjects.Items = ".[obj].";

5 thoughts on “Scripting – How to get the active objects for component selection

  1. Hello, I’m new to scripting.
    What Im trying to do is apply a command, Poly Mesh Triangulate in this case, to a selection.

    So because the script needs to apply the triangulation to just the selected faces, I need to get the selection string and apply the triangulate to the string.

    Application.ApplyTopoOp(“TriangulatePolygons”, “cylinder.poly[7]”, “siUnspecified”, “siPersistentOperation”, “”)

    Can I use your script to get the numbers of the selected faces, then go on to apply the triangulate command?

    Cheers,
    Mike

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s