Point Selection List

when you select multiple points in an poly.mesh, how do I refer the invididual points in the selection? When script the following:
set SelList = GetValue("SelectionList")
MsgBox SelList.Count

I get displayed "1" even though 2 points are selected. SelList(0).Name returns "sphere.pnt[19,46]". How can I determine exactly the points 19 and 46 that are selected without parsing the string or by creating a cluster (wastes computational time)?

Also, once I've determined the selected points, how do I manipulate the points (editing their x,y,z values)?

Some of the scripting functions are quite confusing and I think scripting is poorly documented in this version of XSI.

Thanks for your help,
-Vijay

I resorted to just parsing the string (works decently).

And I worked out how to determine the parent of a sub-Component Selection by using ActiveProject.ActiveScene.root.FindChild(name)(0).

Next problem is determining how I can add an edge between two points (not 1 point and a virtual point which is how XSI's current AddEdge command works).

Any help would be greatly appreciated.

Thanks,
Vijay

you have to pass the points to an array.

you can access the selections local XYZ via the object model. If you have multiple points selected it will take the averaged center.

-Rafe

I got it all sorted

To get the selected points out of pnt[23,25,45,90] I used
Split(Split(Split(SelList(0).Value, "[", -1, 1)(1), "]",-1,1)(0), ",", -1, 1)

Less elegant but works well.

Yeah, my main problem was using the object name (of the poly.mesh, not the geometry which is selected) to access the points and hence access their x, y, z co-ordinates. I achieved that by looking at how others did it.

From a point selection (say "pnt[23,45,54]") you can access the object name via SelList(0).Name - where SelList is the SelectionList Object. Then you can use ActiveProject.ActiveScene.root.FindChildren(ObjName)(0) to actually assign your object to a variable, which then allows you to access the geometry.

I'll say it once and I'll say it again, the documentation provided by Softimage isn't terribly good. There are alot of empty spaces and edges aren't even on the object model (which the documentation says there are).
Having said that, all Softimage need is a time to mature their product and I'm sure all my concerns are being addressed by them as I type.

-Vijay

with 1.5 and 1.5.1 the best way to get the selection is the following:

for each oItem in selection
logmessage "The object name is " & oItem.name
pointsSelected = oItem.subelements
next

subelement will contain a list of the selected sub-elements, in your case the points, while the selection contains only objects.

-Olivier Ozoux

@with 1.5 and 1.5.1 the best way to get the selection is the following:

for each oItem in selection
logmessage "The object name is " & oItem.name
pointsSelected = oItem.subelements
next

subelement will contain a list of the selected sub-elements, in your case the points, while the selection contains only objects.

--------------------------snip------------

I tried this on surface meshes, but there's a problem:

var selected = Selection;
for ( i = 0; i < selected.count; i++ ) {
oItem = selected(i);
LogMessage( "Object: " + oItem.name, siInfo );
points = new VBArray( oItem.subelements );
for ( j = 0; j < points.ubound(); j++ ) {
LogMessage( "Points: " + points.getItem(j), siInfo );
}
}

Here's the output for a default surface_mesh grid where the points in the positive XZ quadrant are tagged:

//INFO : "Object: grid"
//INFO : "Points: 74"
//INFO : "Points: 75"
//INFO : "Points: 76"
//INFO : "Points: 85"
//INFO : "Points: 86"
//INFO : "Points: 87"
//INFO : "Points: 96"
//INFO : "Points: 97"
//INFO : "Points: 98"
//INFO : "Points: 107"
//INFO : "Points: 108"
//INFO : "Points: 109"
//INFO : "Points: 118"
//INFO : "Points: 119"

Question: Since the U and V vectors are not separted by commas, how do you determine, for example, whether point 119 is (11, 9) or (1, 19)?

Matt


Matt Lind
Animator / Technical Director
Softimage certified instructor:
Softimage|3D
Softimage|XSI
speye_21@hotmaill.com