Delete all faces that less than zero by x coordinate.


#1

I need to delete half of model using python. As far as I understand I can’t get absolute vertex position to filter it’s position using cmds module, because it always returning coordinates of the pivot point of selected object.

So I ended up using OpenMaya 2.0, and I get filtered MPoints (vertices) using following approach:

selection = OM.MGlobal.getActiveSelectionList()
if (selection.isEmpty):
    fnMesh = OM.MFnMesh(selection.getDagPath(0))
    vertices = fnMesh.getPoints(space=OM.MSpace.kObject)
    mVertices = OM.MPointArray()
    for vertex in vertices:
        if vertex.x > 0:
            mVertices.append(vertex)

but, to be able select those vertices I need somehow covert them to MDagPath and after spending some time on documentation I didn’t find method than can be used to achieve that.

What I missing?