View Full Version : 1-2 questions about poly functions expressions
12-28-2007, 01:07 PM
I have some questions about getattr and vertex size.
I wanna learn that how many vertex selected mesh got. should i do a algorithm like that
1) select all vertex of mesh and declare it to an array
and lean size with size();
is there more simpler command to learn result faster.
and other question is
i try to learn position of a vertex and declare it to another objects translate xyz
how can i do that?
all shows 0 0 0 0 0 0 0 0 0 0 why all positions of vertices are 0 even xyz?
i scale ti but still same. i wanna learn global pos x yz of vertices can you help me about that.
12-28-2007, 01:08 PM
oh by the way i found why its 0 0 0. it gets position depends on pivot. how can i get global position?
12-28-2007, 02:07 PM
nice to see that you keep on scripting!
your idea would surely work but mel scripts are quite slow so your script executed with a high poly meshe could really knock your computer off i guess.
i would do it with the polyEvaluate command. do look it up in the maya documentary!
you can use it like this:
string $selection = `ls -sl`;
int $verts = `polyEvaluate -vertex $selection`;
print ("Vertex Count is: "+$verts+"\n");
yes its strange that i had to define $verts as an array of integers. the documentation says that the return value was an integer but in fact it's an array with the size one. well shouldn't make you too much troubles.
ehm this command works with polygonal objects only! keep this in mind
hope this helped!
12-28-2007, 02:30 PM
gravedigger thank you alot you help me to lean scripting
i checked maya documentation and i saw script editor. i played with vertices x yz at chanel box it gave me "setattr" and i thought getatr would work for me :D and umm i checked documentation, commands area there was huge poly functions i searched some but coudnt find what i wanted.
gravedigger thank you heartly.
i will try to figure out to get global position of a vertex but its hard :
12-28-2007, 02:48 PM
you want to get the global position of a vertex? you may think that you need to calculate the position of the object and then adding up the position vectors or something like that but its really simple:
pointPosition -world pSphere1.vtx; //returns the pointposition in world space coordinates
pointPosition -local pSphere1.vtx; //returns the pointposition in local space coordinates
i used pSphere1 but you should replace this with your $selection or whatever you like.
12-28-2007, 02:48 PM
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-2013, Jelsoft Enterprises Ltd.