View Full Version : select all vertices - but not all
12-08-2011, 09:55 AM
this title might sound a bit strange at the beginning, but i really mean it :)
here is the problem:
i have some mesh objects on which i need to run a polyMergeVertex operation. unfortunately this operation crashes maya, because the objects have a non-continuous vertex numbering.
if i select the objects, switch to vertex selection mode and drag over them, i get a selection like this:
object.vtx[0:132] object.vtx[138:256] object.vtx[261:554] .......
this is exactely the type of selection i need to run the polyMergeVertex with. (the command needs to be run with a distance of 0.0)
if i run the command with the object as the selection or even a selection like object.vtx[:] maya crashes.
it does not crash with the long selection from above.
so: how can i get that non-continuous selection using a script? i need to recreate what a user does while mouse-selecting the vertices in the GUI.
12-08-2011, 10:08 AM
try: `getVerts` command
12-08-2011, 10:17 AM
is that 2012?
i can not find a command or a method like that.
if you mean "verts"; that does not help either, because it returns the wrong result with a count from 0 to max vertex ID.
12-08-2011, 11:49 AM
you didn't mention MEL or python in your original post so I went with the most basic solution which was MEL, hence the `backticks`. getVerts is a MEL (script) command that returns the expanded names of verts based on the selected object or verts, and it should be in 2012 (it's in 2011)
If this method works for your situation (I have no idea as I don't have a "corrupt" mesh to test it on) and you want to do the same using python simply open up the getVerts script and replicate what it does in python. (or mel.eval it)
12-08-2011, 12:46 PM
ah i see. a mel script itself :) thats why i can not find it in the manuals.
looked promising, but unfortunately it does not help either.
in my case it returns 15884 vertices, but a mouse selection returns 15855 vertices.. i guess there is something seriously messed up with the geometry.
by mouse selecting i get these values:
C5_126813.vtx[0:131] C5_126813.vtx[135:765] C5_126813.vtx[767:2327].........
but if i select vertex #132 i really get a selection..
thanks so far
edit: omg.. now i see it. those vertices are not connected to any edge or face. hence the mouse selection fails on them!
thanks for the help.. guess a cleanup on the geometry will help
12-08-2011, 01:11 PM
It does sound like you have some bad geometry, but the merge vertex code should still handle it. Can you share the model with me? Would make it easier to get the crash fixed...
12-08-2011, 01:33 PM
alexx, what I would do in your case would be:
1. Use python - because you can easily append arrays on it.
2. Run a for loop with "id" variable as the driver from 0 to maximal vert id. (for id in range(0,maxIdNum): )
3. In the run for loop I would check if the id exists if id does append it to a tempIds array (this is why use python).
4. Then run the merge on the tempIds array.
12-08-2011, 01:39 PM
unfortunately this is no geo i can share.
since i have to make sure the geometry is not altered in any way, i have to use a merge distance of 0.0 for the polyMergeVertex command.
and exactely that kills maya. (2009 and 2011 tested)
the stray vertices can not be deleted using "delete" or "delete edge/vertex".
selecting them and converting selection to edges or fasces does not work as well. so they are quite sure not connected to anything else in the mesh.
only using mesh->cleanup... and one of the three "zero ..." switches at the bottom can help get rid of them.
but i fear i might be killing geometry/normals that i should not..
thanks benio33 (http://forums.cgsociety.org/member.php?u=195339)
as i found out in a post before, all the ids really exist. maya only does not mouse-select them, if they are not connected to any other edge/face.
the vertices are connected to some faces somehow. strange :)
edit edit edit:
if i delete ANY face in the mesh (really any - no matter which one or where or how far away), the wrong vertices dissapear as well...
what a serious ***** up geometry ;)
12-08-2011, 02:13 PM
final solution - kind of a bad hack:
before running the polyMergeVertex on the complete object, i run it only für the very first vertex.
that cleans the geometry and the *real* merge works without crashing then.
thanks to all
12-08-2011, 02:34 PM
Damn, nice solution :argh: I wish you no changes to the geometry :)
12-08-2011, 02:34 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-2015, Jelsoft Enterprises Ltd.