Skip to content

Instantly share code, notes, and snippets.

@PierrickKoch
Created March 8, 2013 14:38
Show Gist options
  • Select an option

  • Save PierrickKoch/5116845 to your computer and use it in GitHub Desktop.

Select an option

Save PierrickKoch/5116845 to your computer and use it in GitHub Desktop.
import *.stl scale and pack in one total.blend
import os
import bpy
def process(filepath):
print("import %s"%filepath)
bpy.ops.import_mesh.stl(filepath=filepath)
for obj in bpy.context.selected_objects:
obj.scale = (.01, .01, .01)
print("done")
bpy.ops.object.select_all(action='SELECT')
bpy.ops.object.delete()
for directory, dirnames, filenames in os.walk("."):
for filename in filenames:
if filename.lower().endswith(".stl"):
process(filename)
bpy.ops.wm.save_mainfile(filepath="total.blend", compress=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment