Hi John,
I think you probably want this:
var selected_edges = Selection(0).subcomponent.componentcollection;
var num_sel_edges = selected_edges.count;
for(var i=0;i<num_sel_edges;++i)
{
var cur_edge = selected_edges(i);
...
...
...etc.
}
Alternatively, you can use subcomponent.elementarray to get the array of
edge indices.
Cheers
Andy
-----Original Message-----
From: owner-xsi(at)Softimage.COM [mailto:owner-xsi(at)Softimage.COM] On Behalf Of
John Bell
Sent: 20 April 2006 05:20
To: XSI(at)Softimage.COM
Subject: Loop through a component selection (scripting)
I am trying to write script that can loop through a selection of components
with a for...in loop.
I created a sphere and then selected some of the edges on it.
selectedEdges = Selection(0);
logmessage(selectedEdges);
This yields:
//INFO : sphere.edge[5,16,35,46,59,69,83,92,107,115,131,138]
So my edges are selected, but how do I get so that I can run through a
for..in loop that effects the next edge in the list as the loop is
reiterated? I have tried messing with SubComponent properties, and other
objects to see if I could store the list as an arrays, but I have not had
success. What am I missing?
Thanks.
---
Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in body:
unsubscribe xsi
---
Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in body:
unsubscribe xsi