Not sure offhand if there's a better way, but you can create the 'polyUnite' node, then link up the correct meshes to it's inputPoly / inputMat attributes (see http://download.autodesk.com/us/maya/2010help/Nodes/polyUnite.html). If you're doing this within a plugin, it's probably easiest to use an MDagModifier's createNode / connect methods, to make it easier to implement undo.
However, if you're just doing this within a normal script - which it sounds like you are - I'd recommend just sticking with maya.cmds.polyUnite. It's clearly easier, it'll handle undo for you, and connect everything up the "proper" way (ie, setting intermediateObject and history flags, etc). Plus, despite the fact that you're having to grab string names, it's likely faster - the overhead introduced by the swig api-python bindings is not insignificant, and the underlying built-in maya.cmds method is likely implemented in c/c++, whereas a manual python-api approach would require spending more time in python-land. - Paul On Wed, Nov 11, 2009 at 10:40 PM, Ling <[email protected]> wrote: > > Hi guys: > > I've been reading here for a while, but it's my first time post. > > Is there any api equivalent of "polyUnite" command? > > Right now, when I have a bounch of MObjects, I need to use > MObjects.fullPathName() to obtain their readable string names, then > combine all the nodes using MEl command "polyUnite" with the string > names. > > So if possible, it would be great to do it with API functions > directly. > > Thanks a lot in advance > > > -ling > > > > --~--~---------~--~----~------------~-------~--~----~ http://groups.google.com/group/python_inside_maya -~----------~----~----~----~------~----~------~--~---
