View Full Version : getting a local x,y,z coord of a vertex
I have two vertices. Is there a way to get the local (or global I guess) coordinates of these two vertices? :hmm:
thanks for your time
05-22-2003, 07:40 PM
Turn on "Echo All Commands" in the Script Editor, and then select the vertices you want coordinates for. It will show you which vertices they are, and I am sure that from there, you can get their x, y and z coordinates.
05-22-2003, 07:44 PM
you can get the local position of one vertex in the mesh node of the poly
the local position is vrts[numvertex]+pnts[numvertex]
vrts is the original local position and pnts is the tweak of this vertex
the position in x of the vertex 293 is
if I understand this correctly you basically move a vertex by 0 and it returns the result, which you capture and use?
thank you for the replies. they have helped.:applause:
In the node reference, for subdiv surfaces, it says there is a node called "vertex", which is a compound type.(file://C:\Program%20Files\AliasWavefront\Maya4.5\docs\en_US\html\Nodes\subdiv.html).
It also says that the array can be accessed using the # construct but gives no example of how to use it. My attempt to get the info gets nothing.
float $z = `getAttr subdivSphere1.vertex`
print ($z); // " " <- no value
I am trying to get the vector coords of a subd point in space, which I can already do with poly vertices.
thank you for your time
05-22-2003, 10:15 PM
i strongly recommend using the command xform , which has switches to query world space coordinates from anything..
05-22-2003, 10:20 PM
can you even select "points" on a subdivision surface? since they are evaluated through polygonal proxies, you can't actually select a "point" on the surface unless the detail level is extremely high, I would imagine. am I way off on this...?
05-22-2003, 10:38 PM
For any points, use pointPosition -w/-l (point)... the result is an array of 3 float values [float float float]. for example:
I have a polygon sphere called pSphere1.
world coordinates :
pointPosition -w pSphere1.vtx;
local coordinates :
pointPosition -l pSphere1.vtx;
Still not sure how well that will work for subd surfaces though.
alex: thanks. Xform doesn't seem to work on vertices though. Select a sud vert and run "xform -q -r -os -m;" the values are the same for everything.
(man I feel like i'm working in the dark because no one knows much about subd. The documentation is hooorrrrible)
Given a subd sphere named "subdivSphere1":
setAttr "subdivSphere1.displayLevel" 1; // where 1 should be desired level
pickWalk -d down;
querySubdiv -a 4; // selects faces.
string $vertex_list = `subdListComponentConversion -ff -tv`;
// print string for vertices
All this being said, does anyone understand what the # means in the flag help documentation (file://C:\Program%20Files\AliasWavefront\Maya4.5\docs\en_US\html\Nodes\flagHelp.html). I just need that damned coord of a subd vertex
05-22-2003, 10:42 PM
not -os.. that is object space i think (no maya here)
ther is a -ws or something for world space..
i am about 102% sure.. roughly.. i counted twice
OMFG tikimon, you are my hero :)
pointPosition -l subdivSphere1.smp;
works like charm now I can finish my poly uv transfer to subd script. Screw that weird # construct.
[edit - actually thanks goes to everyone who replied to this thread :)]
05-22-2003, 10:46 PM
sweeeeeeeeeeeet. in an effort to make myself look less intelligent than it appeared before, I just browsed through the MEL documentation until I found that command. :p anyway, glad it works! :)
01-15-2006, 06:00 AM
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.
vBulletin v3.0.5, Copyright ©2000-2015, Jelsoft Enterprises Ltd.