Skip to content

Instantly share code, notes, and snippets.

@ajshort
Created November 12, 2019 01:03
Show Gist options
  • Save ajshort/a512012257aad5f3f24a0d049f15a2f9 to your computer and use it in GitHub Desktop.
Save ajshort/a512012257aad5f3f24a0d049f15a2f9 to your computer and use it in GitHub Desktop.
import bpy
selection = bpy.context.selected_objects
# Export each object.
for object in selection:
if object.type != 'MESH':
continue
bpy.ops.object.select_all(action='DESELECT')
object.select_set(True)
print('Exporting {}'.format(object.name))
bpy.ops.export_mesh.stl(filepath='/home/ajshort/export/{}.stl'.format(object.name),
use_selection=True)
# Reset the selection to original.
bpy.ops.object.select_all(action='DESELECT')
for object in selection:
object.select_set(True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment