Howdy fellas !
I'm working on a project that will need to extract faces (stored in a set)
from a combined object, the object has usually more than 500 groups of
faces that need to be extracted and separated in an individual mesh, the
vertex order need to be preserved.
I did a mockup with cmds, which works and keeps the vertex order for each
subelement by simply duplicating the whole object and deleting every face
that is not in its correspondent set, but it takes about and hour to
process.
duplicated = maya.cmds.duplicate(in_object)[0]
# I take the face start and face end from a selection set
_, face_start, face_end = re.findall(r"[\w.-]+", in_set)
face_start = int(face_start)
face_end = int(face_end)
# This probably is poorly written, but it works to delete every other face
that doesn't correspond to the set keeping the vertex order intact.
if face_start > 0 and face_end < max_face:
maya.cmds.delete(duplicated + ".f[0:%s]" % (face_start - 1),
duplicated + ".f[%s:%s]" % (face_end
+ 1, max_face))
elif face_start ==0:
maya.cmds.delete(duplicated + ".f[%s:%s]" % (face_end + `, max_face))
elif face_end == max_face:
maya.cmds.delete(duplicated + ".f[0:%s]" % (face_start -1))
Any thoughts on this?,
in the API I saw the extractFaces method but it won't separate it in a
different mesh.
Thank you guys !
--
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/095992d4-e67f-4640-a7aa-e6eeb8e8a423n%40googlegroups.com.