[Closed] Best way to get neighbouring faces?
I need to return a list of the faces joined to the selected face. Ones that are contacted by 2 verts, so a tri would have 3 results, a square would have 4…
I wrote a long complicated function that goes through all the other faces comparing verts, collecting matches, but this compares every vert against every vert and is quite slow on over 1000 faces.
Trying to use polyop, but i’m getting all the faces in the mesh return not just the ones I want.
theFace = 7
theEdges = polyop.getEdgesUsingFace $ #{theFace}
theFaces = polyop.getFacesUsingEdge $ theedges
theFaces.count
polyop.getFacesUsingEdge returns a bitarray, that is why theFaces.count is the size of number of faces… the faces you are after should be flagged correctly… it handles a bit differently from normal arrays. (pun totally unintended)
Thanks for the pointer…
For those interested… Here’s a good little read…
http://knol.google.com/k/koen-samyn/maxscript-bitarray/2lijysgth48w1/47#
I only needed to add one more line to get the list of faces.
theFace = 7
theEdges = polyop.getEdgesUsingFace $ #{theFace}
theFaces = polyop.getFacesUsingEdge $ theedges
--theFaces.count
for i in theFaces where i != theface do print i