How using DG nodes can I pass closestPointOnSurface the X Y Z values it wants when the vertices I select are expressed as members of an array vtx[]. How do I get at the data of a particular member of that vtx[] array?
Not sure if I am understanding your question completely, but I try.
If you selected a set of PV values, .vtx[] , but they look something like pPlane1.vtx[0:245] and you need to grab one distinct name like pPlane1.vtx[99], this might help.
string $sel[0] = ls -sl; // this just captures the selected data //
string $expandedSel[0] = filterExpand -ex 1 -sm 31 $sel; // thsi should expand the list into a new array //
int $val = size $expandedSel; // this should give the number of entries in the array above //
for ($x=0; $x print $expandedSel[$x]; // this will simply print each entry to the script editor for viewing //
Within the for loop is an opportunity to check for the specific Poly Verticy also.
Hope this helps,
Morris
Thanks for your suggestion. Not quite what I was looking for, but helpful for me anyway. I got a response from Maya which I'll post here in case anyone else would like to know what I found out.
To query an element in the vtx[] array for its X Y Z position, do the following:
Suppose your mesh is "pCube1" and you want to query the 10th vertex.
float $vertexCoords[3] = xform -q -t -ws pCubeShape1.vtx[9];
setAttr closestPointOnSurface1.inPositionX $vertexCoords[0];
setAttr closestPointOnSurface1.inPositionY $vertexCoords[1];
setAttr closestPointOnSurface1.inPositionZ $vertexCoords[2];