spacial script selection


does anyone know if there is a way to select components by specifying world space coords?

I have always wondered this because you could write scripts to mirror selections over an axis:

-select a cv or vtx
-run script that would say something like:
*get the coordinates of the current selected point
*select the point that resides at these same coordinates but change the x value to be negative.


So the idea is that you want your script to select the corresponding point on the other side of a perfectly symmetric object?

You could (1) get the selection, (2) for each point in the selection get the position in world space with the xform command, (3) search the CVs on the entire object for ones that are near the mirrored position (see below), and (4) add any matches to the selection. This wouldn’t be a very complicated script, but it’s not as easy as if there were a nice option in the select command.

The trick is that you do not want to test for whether the X position is EQUAL to the negative X for the other CV. Rounding errors will infrequently yield the answer “no.”

So instead of

if ($thisx == $thatx)

where $thisx and $thatx are float variables, you want to do something like this:

float $epsilon = 0.00001 // a small number

if (($thisx < ($thatx + $epsilon) && ($thisx > $thatx - $epsilon))

Just like a delta epsilon proof in calculus class, if you ever took that in high school…

– Mark


Thanks for the reply Mark…

I actually want to do this with subDs so I am unsure as to how to loop through the vertices… how can you get a list of verticies on the different levels?
My workflow goes a little something like:
1 - create subD object
2 - create multiple sets of verticies (on multiple levels)
3 - mirror the subD
4 - mirror the sets
5 - attach both subDs
6 - recreate sets
… but of course now the vertices will be indexed differently
7 - attach to another subD
8 - recreate sets

BOTTOM LINE: how can you attach subDs and retain vertex sets?


you got me. :smiley:

– Mark


This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.