[MAYA] combine meshes via API

python
coding
maya

#1

I am working on a poly mesh project, it need combine lot of small poly meshes to one object,
I tried polyUnit command, but it is too slow (need to combine more than 30000 meshes), then I want to do meshes
combining task via API, checked MFnMesh Class, but did not find any meshes combine method, anyone
can give me a hint ?how to combine meshes via API?many thanks! !


#2

There is no combine function in the API. The polyUnite node implements all the code to combine meshes using the functions in the API. If you want to do a manual combination you would have to take the existing mesh data and use it in a single call to MfnMesh.create to actually create a new mesh from the old ones.


#3

Thanks Capper,
as you said, if there is no API for mesh combine I guess it’s not easy to get better speed than polyUnite via MfnMesh.

l will try to split task as small package , run with multiple process to speed up


#4

A bit of a hack-y solution, but when faced with a similar problem, I was able to get much faster results by batch exporting groups of .obj files and importing them back in instead of using combining methods in Maya. All I had were meshes and materials, so by exporting one .obj for each unique material, I was able to push things through and keep what I needed without waiting for hours or dealing with excessive crashes. Might be helpful


#5

you can definitely combine meshes using the API you just have to modify the mesh data arrays … and it’s simple