Home Technical Talk

maxscript: is there an elegant way to identify the edges bordering a face selection in editable mesh

poopipe
grand marshal polycounter
Offline / Send Message
poopipe grand marshal polycounter
In an editable mesh, each face appears to have a unique set of edges. This is a pain in the back bottom if you want to do something like collect a list of all the edges that border a face selection.

In an editable poly you can store your face selection in A, invert it and store that in B , convert both A and B to edge selections, perform an AND operation on the resultant bitarrays and voila : nice, fast border selection. 

Because of the above, this technique isn't viable in a simpleMeshMod scripted modifier.  What I'm wondering is whether anyone else has run into this previously and what they did to get around it. 

ta 

Replies

  • Swordslayer
    Options
    Offline / Send Message
    Swordslayer interpolator
    Yes, in editable mesh, each face has it's own set of three edges, when you want to get the matching edge of the neighbor face, there's meshop.getEdgesReverseEdge (there's also a code example in the mxs reference). So one way to get the border you wanted (this depends on the use case, of course):

    selEdges = meshop.getEdgesUsingFace $ #selection
    revEdges = meshop.getEdgesReverseEdge $ selEdges
    selEdges - revEdges


    Btw. I'd be cautious in calling the poly method method you mentioned nice&fast, getting face edges is proportionally slower the bigger the mesh is. And it will fail when one of the selected edges lies on the border, as well. If you are only dealing with watertight meshes, that might not bother you that much, but still the smaller the number of selected faces is compared to the remaining number of faces, the more it might make sense to use polyop.getVertsUsedOnlyByFaces and subtract the verts edges from face edges instead.
  • poopipe
    Options
    Offline / Send Message
    poopipe grand marshal polycounter
    I had a feeling you'd be the one to answer this  - thanks :)  

    I tend to drink when I code so often miss the examples through a mix of impatience and blurred vision. 

    I'd not hit any performance issues with the polyop method but generally I've only been working on a few thousand faces - what you say makes sense though (I think, I'll have to try it to be sure if I've understood ;)
  • monster
    Options
    Offline / Send Message
    monster polycounter
    For EditablePoly and EditPoly you can use the Ribbon function:

    PolyToolsSelect.Outline()

Sign In or Register to comment.