Split polygon with PyMel

Hi, dev!
Trying to figure out the logic of polySplit() and have no luck…
Here is the geometry, I need to cut the top face (create an edge between 0 and 76 vertexes):

Here are hardcoded values which are working:

pm.polySplit(ip=[(150, 0), (132, 0)])
pm.polySplit(ip=[(388, 1), (1, 0)])

Where 150, 132 - edge index and 0,0 distance from vertexes where the split is beginning.
I can get the initial vertex object (number 0) as well as a top polygon. So I can get necessary edges. But I am totally confused with distance, sometimes 0 get me desired position, sometimes 1 and I can’t get any logic behind.

Geometry in *.ma

I don’t have Maya available at the moment, but I think PolySplit is cutting a new edge along edges? (Hence the 0 to 1 setting for relative distance along the edge)

If you’re trying to connect vtx 0 and vtx 76 I normally use the connect command
https://download.autodesk.com/us/maya/2011help/CommandsPython/polyConnectComponents.html

1 Like

Thanks! The polyConnectComponents() is exactly what I was looking for!

1 Like