Exporting multiple meshes to a single 3D file

Hey,

I would like to export multiple meshes as a single 3D file, and was wondering if there was a simple way of doing it.

Ideally, I’m looking for the equivalent of Nervous System’s OBJ Export library for Processing - https://n-e-r-v-o-u-s.com/tools/obj/ , and I wanted to know if there was any similar libraries for OF.

I have a sketch that has a lot of spheres, and I want to export them all to one 3D file on each frame. I’ve tried to use the ofMesh append function, but I believe there’s too many meshes for it to work, unless I’m doing something wrong.

Any help would be appreciated!

To export multiple meshes as a single file you have to merge all your meshes in a single mesh, and then export that mesh.

Let’s say that in your header you have a container mesh.

ofMesh container;

Your method that exports your meshes in a single mesh, could look more or less like this:

for(auto &m : myMeshes) {
    container.append(m);
}
string randomFilename = ofGetTimestampString() + ".ply";
container.save(randomFilename);

Awesome! Thanks @edapx , that worked perfectly.