Export multiple objects

Export multiple objects

Anonymous
Not applicable
5,241 Views
3 Replies
Message 1 of 4

Export multiple objects

Anonymous
Not applicable

Is there a way to export all of the objects in my object browser to separate STL files automatically, where each file is named the same as it is in the object browser?

0 Likes
5,242 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable

Another small thing that could be improved.

No, not possible any more (the old PRINT module based on 123D had this feature but had to be removed).

But there's mmapi. If you know little coding I recommend to set it up.

This Python snippet does what you want (simply using the current directory of the script to save the exports to):

import os
import mmapi
from mmRemote import *
import mm

r = mmRemote()
r.connect()

objectsList = mm.list_objects(r)

i = 0
while i < len(objectsList):
    mm.select_objects(r, [objectsList[i]])
    mm.export_mesh(r, os.path.join(os.getcwd(), mm.get_object_name(r, objectsList[i]) + ".stl"))
    i += 1

r.shutdown()
0 Likes
Message 3 of 4

Anonymous
Not applicable

Do you have a link to a page or site with more info about this? I'm interested in learning all the ways to extend MM's capabilities. I found this github page, but not a lot of hand holding there, which i would need I think.

thank you

0 Likes
Message 4 of 4

Anonymous
Not applicable

Yep, there 's the download but sorry, there's no further documentation (except the one shipping with the download > see below).

First you need to install Python 2.7 32bit (NOT a 3.x version) Think (I'm on macOS) that's it: Direct download from Python.org

 

Next is to download mmApi. Click the green CloneOrDownload button on Github and chose DownloadZip. Extract and store the mm-api-master directory somewhere on your HDD.

In this bundle is a distrib folder containing a python directory. Double click test.py to open it in the Python Idle.

Now start MM and load the bunny.

In Python Idle go to the Run menu and click RunModule. If everything is fine the bunny in MM is cut. If you receive an error message in Python copy the mm folder from mm-api-master/python to 

mm-api-master/distrib/python and try to run the script again.

Hopefully it works the same way on WIN as it does on MAC.

Note: That way all scripts need to be stored in mm-api-master/distrib/python.

E.g. if you want to run the script above you need to create a new file in Python and paste the code. To execute it you have to save it to mm-api-master/distrib/python first (at least I need to do that here).

In mm-api-master/distrib/documentation/python_html there's a index.html. Open it in your browser to get a glimpse (it isn't complete) of the functionality one can use.

In mm-api-master/python/examples you'll find several example scripts which might help yo to get started. 

0 Likes