XM Magdalena 3D print, GGeorgy (3D)
LC #42 Pipers Alley

View Full Version : Select similar polygons

06-06-2012, 08:29 PM
Any expert to write the code?

06-06-2012, 09:28 PM
What do you mean by select similar polygons?
Take a look at Select Using Constraints under the Select Menu.
It's a bit overwhelming at first, but once you get the hang out of it, it is very powerful.

06-07-2012, 05:52 AM
What do you mean by select similar polygons?
Take a look at Select Using Constraints under the Select Menu.
It's a bit overwhelming at first, but once you get the hang out of it, it is very powerful.

Select Using Constraints is too slow to me.

Look at this:


06-07-2012, 11:28 AM

So basically you're asking for someone to write a script/plugin that can do that, when asked what exactly, you point out an existing (!) plugin that can do just that.

So I ask you: why not just buy NEX? You want someone else to code it so you get it for free?

06-07-2012, 02:38 PM
Selecting polygons with similar topological neighbors is not trivial, but if you want to select nodes of similar type to the current selection, that is fairly easy with a little bit of scripting.

import maya.cmds as cmds
selection = cmds.ls(sl=True)
nodeTypes = []
for x in selection:
similarNodes = cmds.ls(type=nodeTypes)
cmds.select(similarNodes, add=True)

Needs some validation and error checking, but there's the rough idea.

06-07-2012, 10:48 PM
Yeah...the devil is always in the details...in this case, it's the word "similar".

def FindSimilar():
someObj = selected()[0]
similarObj = FindSimilarObjs(someObj)

The fun part is defining 'FindSimilarObjs'. Definitely not trivial stuff...

06-08-2012, 12:32 AM
you could compare vert count associated with a face. surface area of a face (maybe with some buffer space) . maybe compare center of face.

not sure how much you would have to compare to get an accurate result.

06-08-2012, 06:01 AM
a little help: http://www.youtube.com/watch?v=QS0tSrkUtiY

06-08-2012, 06:13 AM
a little help: http://www.youtube.com/watch?v=QS0tSrkUtiY

very cool. i might just take a stab at this this weekend.

06-08-2012, 02:12 PM
Tha video is helpful, however polygons in Maya don't come with nice labels, A, B, C, D, E etc... to base comparisons on - figuring out how to map each vertex on 1 face to a vertex on the other face - that is tricky part (for me at least).

06-08-2012, 02:38 PM

Show your talent.

A question:
Need maya a new modern API to show the labels of each face?

06-08-2012, 03:31 PM
Show your talent.

ahah really? :shrug:

what we're talking about here is comparing topology of faces, relative distance and layout of components etc...
to make a proper computation for that will require many operations. To keep it at an interactive performance level this is probably not something you want to do with scripting except for the very most basic cases.

and this has nothing to do with maya needing a new api for that. Just people having the time to figure out how to do it efficiently, which is a very rare commodity.

06-08-2012, 03:49 PM
Thanks for the info.

What is the best solution for this? mel, python or c++

06-08-2012, 04:19 PM
there's no best solution, there's only the solution that you're comfortable with and which works for your context.
mel is perfectly capable of it, you'll just hit the performance wall much much sooner.

as was said earlier, the issue is the algorithm not necessarily the language (even if you're going to have easier/more elegant solutions with python or c++).

06-08-2012, 05:16 PM
Chris, you are not SMSing, so don't be shy to elaborate and talk freely.

If you need performance use C++, else python is enough (IMO don't touch mel).

If your only objective in life is to detect exact similar polygons (as opposed to differential shape operator, or minimizing the Dirichlet energy), then just use brute force (and I assume you refer to planar polys). Namely use two canonical loops - O(n^2) - and compare all the polys to all the polys. The comparison would start by the poly degree, and then ccw compare angles (use dot product) for each starting point (there are as many starting points as the poly degree).

Good luck.

06-15-2012, 10:31 AM

Thanks for the declaration.

I wish i understand all the programming languages. little mel is ok but I'm just a novice in complex programming like this. maybe i should learn to advance scripting. any good python book for this?

06-15-2012, 07:33 PM
If you have some mel background, then:


Start with a basic loop that goes over the mesh faces, and an inner loop that go over each face vertices, and I'll help you from there.

CGTalk Moderation
06-15-2012, 07:33 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.