See which faces are affected by polyChipOff?

129 views
Skip to first unread message

Erik Spellerberg

unread,
Nov 30, 2017, 5:06:44 AM11/30/17
to Python Programming for Autodesk Maya
I am extracting objects using mel.eval('performPolyChipOff 0 0;'), but I don't know which of the resulting meshes is the one belonging to the faces i selected previously. Maya does not always order them the same way. So I'm thinking I can check which faces are affected by the resulting polyChipOff node but I don't know how to dig out that information.

Erik Spellerberg

unread,
Nov 30, 2017, 5:07:59 AM11/30/17
to Python Programming for Autodesk Maya
Also I'm using pymel for this.

fruit...@gmail.com

unread,
Dec 22, 2017, 1:56:18 PM12/22/17
to Python Programming for Autodesk Maya
I'm not sure I understand what you want to achieve, but can't you use the python version instead of the mel one ?
a = cmds.polyChipOff(dup=False)
b = cmds.polySeparate(your_mesh)

this way, you get a proper return value in a and b that you can work with.
What do you need to do exactly ?

Erik.Spe...@starbreeze.com

unread,
Dec 24, 2017, 10:15:45 PM12/24/17
to Python Programming for Autodesk Maya
This is what I want to achieve: https://i.imgur.com/ZlZIe3t.jpg

Using polySeparate causes a bunch of problems. I get this result: https://i.imgur.com/917NFMA.jpg (and yes using the the mel command gives the exact same result)

As you can see, Maya gives me three objects and I do not know which one is the original sphere. Sometimes its the one named PolySurface1, on a different model it might be the last one. Maya is not consistent.

I did sort of solve it though by duplicating the entire mesh and deleting the inverted selection. However I do not really like this method as it can be slow. So I would like to be able to read the node data and just SEE what faces

Marcus Ottosson

unread,
Dec 25, 2017, 5:28:20 AM12/25/17
to python_in...@googlegroups.com

See the inputComponents attribute of the polyChip node.

cmds.getAttr("polyChip1.inputComponents")
# Result: [u'f[202]', u'f[239]', u'f[241]'] #

Example

sphere, _ = cmds.polySphere()
cmds.select(
    sphere + ".f[202]",
    sphere + ".f[239]",
    sphere + ".f[241]"
)

chip = cmds.polyChipOff()
faces = cmds.getAttr(chip[0] + ".inputComponents")
cmds.select(
  sphere + "." + faces[0],
  sphere + "." + faces[1],
  sphere + "." + faces[2]
)

Normally, components affected by polygon modifications - like soft modification, skinning, extrude etc - are stored in an invisible objectSet node, which I was looking for at first. But as it didn’t have any, I knew it must have been stored internally. In this case, it looks to be a compound string attribute.



--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/82dcc486-a108-40b0-9267-0aa1f5d6b2ea%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

fruit...@gmail.com

unread,
Dec 25, 2017, 11:44:46 AM12/25/17
to Python Programming for Autodesk Maya
Alternately, and especially since speed seems to be a concern, what you can do is to re-write your own extract/duplicate command with python api. This is what I use instead of maya commands, it takes about 50lines to can get all the infos you need to create a new polygon. And, surprisingly, re-creating the poly instead of using maya nodes give you a tremendous gain of speed, especially if you work on heavy meshs and extract many faces on the same object.
Reply all
Reply to author
Forward
0 new messages