Hey Justin, I gave exactWorldBoundingBox a try and it is working so far on
all my tests, thanks! Here is what I came up with:
import maya.cmds as cmds
#Get current selection
curSel=cmds.ls(sl=1)[0]
#Create list of all faces in object
faceIndex=cmds.polyEvaluate(curSel,face=1)
#Empty list
negativeFaces=[]
#loop through faces
for i in xrange(faceIndex):
curFace = curSel + '.f[%d]' % i
#If the exactWorldBoundingBox is negative in X append that face to the
empty list
if cmds.exactWorldBoundingBox (curSel + ".f [%d]" %i)[0] < 0 :
negativeFaces.append(curFace)
#Delete the faces that were put into the empty list
cmds.delete(negativeFaces)
cmds.delete(curSel, ch=1)
One thing I noticed while working on this (which gave me some serious
confusion) is that when you create a default sphere, some of the
edges/verts that you would think are exactly in the center of the world,
actually aren't. So when testing this sort of thing on a sphere, I'd
recommend snapping all the center verts to the center of the world first,
to avoid getting super annoyed, like me ;)
Ævar, that sounds like that might be a good way of doing this too - I'll
definitely give it a try, thanks!
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/python_inside_maya/49d6179d-cd71-461d-860a-4a075a18f892%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.