1

Is there a way to add/remove vertices, edges and faces from existing meshes with Python API? I found a few question around the web about this, but all without answer.

Jiloc
  • 3,338
  • 3
  • 24
  • 38

1 Answers1

2

In OpenMaya.MFnMesh there are some methods for this:

  • To delete:
    • deleteEdge(edgeId, modifier=None) -> self
    • deleteFace(faceId, modifier=None) -> self
    • deleteVertex(vertexId, modifier=None) -> self
  • To add:
    • addPolygon(vertices, mergeVertices=True, pointTolerance=kPointTolerance, loopCounts=None) -> faceId; Which merges vertices within a certain range (pointTolerance).

So it seems like you cannot just create single vertices and then properly connect them with edges and faces, but you have to define a complete polygon.

If there are other solutions I would be happy to know!

Jiloc
  • 3,338
  • 3
  • 24
  • 38