Pages

Thursday, November 18, 2010

Remove vertices with 2 edges



Removing vertices that are shared by only 2 edges? As I see this question appear sequential. About two month ago I wrote a macro script (B-Vertex Eraser), also by user request, but recently asked my this again, so I'll post here (as reference) the last function I wrote for that purpose.
fn RemoveVertsWith2Edges epoly = (
    vList = for v=1 to epoly.GetNumVertices() where
    epoly.GetVertexEdgeCount v == 2 collect v
    epoly.SetSelection #Vertex (vList as BitArray)
    epoly.Remove selLevel:#Vertex
)

-- example usage:
RemoveVertsWith2Edges $
-- on multiple objects:
for obj in selection do RemoveVertsWith2Edges obj

This function work with Editable Poly and remove ALL vertices that are shared by only 2 edges. To remove SELECTED vertices with 2 edges, use my B-Vertex Eraser macro script, which works as with Editable Poly as with Edit Poly modifier.

Cheers.

1 comment:

  1. This is excellent, saved me a lot of time, thanks!
    Oz

    ReplyDelete

Thanks for your comment