PDA

View Full Version : If A Vertex Exists On An Object


scottiedoo
02-20-2007, 12:43 AM
Did some searching around and couldn't find exactly what I wanted and couldn't find a command to query.

I want to see if a specific vertex number exists on an object or not. I need it to work for polys, nurbs, and sub-d's

I tried the objExists command and that doesn't work.

I'm kind of tired so I dont' know if I missed something simple or maybe another command that I could get. I thought about the polyEvaluate command and getting the number of vertices, but then I would still be stuck with nurbs and sub-d's.

Any ideas?

sparaig
02-20-2007, 01:30 AM
Did some searching around and couldn't find exactly what I wanted and couldn't find a command to query.

I want to see if a specific vertex number exists on an object or not. I need it to work for polys, nurbs, and sub-d's

I tried the objExists command and that doesn't work.

I'm kind of tired so I dont' know if I missed something simple or maybe another command that I could get. I thought about the polyEvaluate command and getting the number of vertices, but then I would still be stuck with nurbs and sub-d's.

Any ideas?

It's one of those top secrets that everyone knows...

SELECT the object first. Until then, the internal representation of certain objects is hidden from MEL. Once the object is selected, you get access to such things via MEL.

scottiedoo
02-20-2007, 01:56 AM
umm ok, that was odd, umm ..

you have to be a little more clear. I understood your "select" the object first, but what does that have to do with finding out if a vertex actually exists on that object for example if I have the vertex number 43, and the other object I want to check only goes up to 40, then vertex 43 does not exist.

can you help a little more next time?

YourDaftPunk
02-20-2007, 02:14 AM
The number of vertices on a nurbs object is not determined until it is tesselated. Ask that question in a better context: does this vert #X exist with this nurbs object tesselated to render quality? Or do you wan't the CV/EP stuff?

If you have a poly sphere with verts (0-24) and delete vert #8, you'll have a list (0-23). 9 is now vert 8. You were kind of making it sound as if 8 would no longer exist like (0-7 & 9-24)?

You were right at first with the polyEvaluate command and getting the total number of vertices. If the vert number being tested is greater than that, it obviously doesn't exist. Sub-D should work the same assuming there is not a multi-resolution mesh.

-shawn

sparaig
02-20-2007, 02:26 AM
umm ok, that was odd, umm ..

you have to be a little more clear. I understood your "select" the object first, but what does that have to do with finding out if a vertex actually exists on that object for example if I have the vertex number 43, and the other object I want to check only goes up to 40, then vertex 43 does not exist.

can you help a little more next time?

Well, sorry. After I posted that I realized I wasn't any help at all.

The easiest way to do this is to use the following line of code, where $mask can be "editPoint", "controlVertex" or "hull" for NURBS.

doMenuNURBComponentSelection($object, $mask);

subds are bit tricker, but using a mask of "subdivMeshPoint" should give you the same equivalent info as "controlVertex" for NURBS when you use this line of code, as long as you start out with no selection or the subd object selected at the standard/object level:

doMenuComponentSelection($object, $mask);



THEN you can check for the existence of whatever you want.

underneath it all, is a call to selectType, but if you look at how these markup menu commands actually work, it's a LOT easier to let them do all the housekeeping for you.


The relevant mel code is found in the others/dagMenuProc.mel file

sparaig
02-20-2007, 02:30 AM
Well, sorry. After I posted that I realized I wasn't any help at all.
[...]

THEN you can check for the existence of whatever you want.
[...]



I just realized you wanted to know how to check AFTER you selected the object at the component level. I thought you wanted to know how to select those components from MEL, sorry. IF you need to check an arbitrary, non-selected object using MEL, do what I said, THEN do what he said... ;-)

scottiedoo
02-20-2007, 06:08 AM
Thanks both of you guys,

Shawn is closer to what I want. I wanted to check if a vertex number, or a nurbs CV, or if its even a sub-d point.

I figured the polygon would be easiest, but with about nurbs if i was given the CV number such as [4][2] how would you check if that cv exists?

I haven't worked much with Sub-D's in maya so I don't know exactly how getting points work since there are different levels.

Any help in direction with the nurbs and sub-d query would be great.

Thanks for your help both of you so far.

CGTalk Moderation
02-20-2007, 06:08 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.