Is there a way to separate two polygon shells in Maya API (OpenMaya)? Just like the cmds.polySeparate function (which i cannot use because it returns the separate nodes in random order, so I cannot know which one to delete and which one to keep in my script. Moreover I’d like rely only on the API and don’t mix it with the cmds).
Reading the documentations I thought that OpenMaya.MFnMesh.extractFaces what was I was looking for, but (differently from what the docs seems to say) it just cuts the selected chunk but leaves it in the same node.
Thank you for the reply! I am trying to implement an adaptive Poisson sampling plugin for Maya. To accomplish this I iteratively identify group of faces (I have their IDs) and need to remove them from the Mesh. I tried using OpenMaya.MFnMesh.deleteFace() but it is EXTREMELY slow and it gets slower for every face i delete in a row (I need to delete thousands of faces per iteration). Searching on the web I followed the method suggested here
Extract the faces with MFnMesh.extractFaces, than use MFnMesh.collapseFaces on the extracted faces. After you collapsed them and do an Updatesurface maya “deletes” those faces.
It is a lot faster BUT it doesn’t work as expected: in every iteration the mesh is “regenerated” and the faces that where deleted in the previous iteration with this method re-appear.
So I thought to use the MFnMesh.extractFaces -> separate the extracted faces in a new node -> delete it. That’s all!