ICE: Getting the edge index of the longest edge


For each polygon, I want to get the EdgeIndex of the longest edge (ultimately, I want to get the midpoint of the longest edge for each polygon).

Being literal-minded, I started by getting the length of the longest edge for each polygon:
edgelength_max
Here’s a Show Values to show it works:
edgelength_max_showvalues

From there, I hacked my way to the edge index:
edgelength_max_index_1
The Show Values:
edgelength_max_index_1_showvalues

For my second try at getting the index of the longest edge, I stopped trying to go from the length back to the index. I think this is a little better approach:
edgelength_max_index_2

edgelength_max_index_2_showvalues

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].";