commit cf93d9154290c534bc7bd6ad19455999346dbb34
parent ced502c0ad29af6da4244031c18ba0679dcb07d2
Author: rbckman <robinbackman@gmail.com>
Date: Sat, 18 Aug 2018 11:31:18 +0300
Merge branch 'master' of https://github.com/rbckman/tarina
Diffstat:
1 file changed, 102 insertions(+), 0 deletions(-)
diff --git a/3d/tarina_stl_export.py b/3d/tarina_stl_export.py
@@ -0,0 +1,101 @@
+# exports each selected object into its own file
+
+import bpy
+import os
+
+# export to blend file location
+basedir = os.path.dirname(bpy.data.filepath)
+
+if not basedir:
+ raise Exception("Blend file is not saved")
+
+scene = bpy.context.scene
+
+obj_active = scene.objects.active
+selection = bpy.context.selected_objects
+
+bpy.ops.object.select_all(action='DESELECT')
+o = bpy.data.objects['Body']
+o.select = True
+o = bpy.data.objects['supportmaterial body']
+o.select = True
+bpy.context.scene.objects.active = o
+bpy.ops.export_mesh.stl(filepath=basedir + "/stl/tarina-body.stl", check_existing=True, axis_forward='-Z', axis_up='-Y', filter_glob="*.stl", use_selection=True, global_scale=1.0, use_scene_unit=False, ascii=False, use_mesh_modifiers=True, batch_mode='OFF')
+bpy.ops.object.select_all(action='DESELECT')
+
+bpy.ops.object.select_all(action='DESELECT')
+o = bpy.data.objects['Left-Side']
+o.select = True
+bpy.context.scene.objects.active = o
+bpy.ops.export_mesh.stl(filepath=basedir + "/stl/tarina-left-side.stl", check_existing=True, axis_forward='-Y', axis_up='X', filter_glob="*.stl", use_selection=True, global_scale=1.0, use_scene_unit=False, ascii=False, use_mesh_modifiers=True, batch_mode='OFF')
+bpy.ops.object.select_all(action='DESELECT')
+
+bpy.ops.object.select_all(action='DESELECT')
+o = bpy.data.objects['Right-Side']
+o.select = True
+bpy.context.scene.objects.active = o
+bpy.ops.export_mesh.stl(filepath=basedir + "/stl/tarina-right-side.stl", check_existing=True, axis_forward='-Y', axis_up='-X', filter_glob="*.stl", use_selection=True, global_scale=1.0, use_scene_unit=False, ascii=False, use_mesh_modifiers=True, batch_mode='OFF')
+bpy.ops.object.select_all(action='DESELECT')
+
+bpy.ops.object.select_all(action='DESELECT')
+o = bpy.data.objects['Hdmi-Cap']
+o.select = True
+bpy.context.scene.objects.active = o
+bpy.ops.export_mesh.stl(filepath=basedir + "/stl/tarina-hdmi-cap.stl", check_existing=True, axis_forward='X', axis_up='Z', filter_glob="*.stl", use_selection=True, global_scale=1.0, use_scene_unit=False, ascii=False, use_mesh_modifiers=True, batch_mode='OFF')
+bpy.ops.object.select_all(action='DESELECT')
+
+bpy.ops.object.select_all(action='DESELECT')
+o = bpy.data.objects['Button-Plate-Bottom']
+o.select = True
+bpy.context.scene.objects.active = o
+bpy.ops.export_mesh.stl(filepath=basedir + "/stl/tarina-button-plate-bottom.stl", check_existing=True, axis_forward='X', axis_up='Z', filter_glob="*.stl", use_selection=True, global_scale=1.0, use_scene_unit=False, ascii=False, use_mesh_modifiers=True, batch_mode='OFF')
+bpy.ops.object.select_all(action='DESELECT')
+
+bpy.ops.object.select_all(action='DESELECT')
+o = bpy.data.objects['Button-Plate-Upper']
+o.select = True
+bpy.context.scene.objects.active = o
+bpy.ops.export_mesh.stl(filepath=basedir + "/stl/tarina-button-plate-upper.stl", check_existing=True, axis_forward='-X', axis_up='-Z', filter_glob="*.stl", use_selection=True, global_scale=1.0, use_scene_unit=False, ascii=False, use_mesh_modifiers=True, batch_mode='OFF')
+bpy.ops.object.select_all(action='DESELECT')
+
+bpy.ops.object.select_all(action='DESELECT')
+o = bpy.data.objects['Screen-Lid']
+o.select = True
+bpy.context.scene.objects.active = o
+bpy.ops.export_mesh.stl(filepath=basedir + "/stl/tarina-button-screen-lid.stl", check_existing=True, axis_forward='Z', axis_up='Y', filter_glob="*.stl", use_selection=True, global_scale=1.0, use_scene_unit=False, ascii=False, use_mesh_modifiers=True, batch_mode='OFF')
+bpy.ops.object.select_all(action='DESELECT')
+
+bpy.ops.object.select_all(action='DESELECT')
+o = bpy.data.objects['Picamera-Bridge']
+o.select = True
+bpy.context.scene.objects.active = o
+bpy.ops.export_mesh.stl(filepath=basedir + "/stl/tarina-picamera-bridge.stl", check_existing=True, axis_forward='Y', axis_up='X', filter_glob="*.stl", use_selection=True, global_scale=1.0, use_scene_unit=False, ascii=False, use_mesh_modifiers=True, batch_mode='OFF')
+bpy.ops.object.select_all(action='DESELECT')
+
+bpy.ops.object.select_all(action='DESELECT')
+o = bpy.data.objects['Picamera-Body']
+o.select = True
+bpy.context.scene.objects.active = o
+bpy.ops.export_mesh.stl(filepath=basedir + "/stl/tarina-picamera-body.stl", check_existing=True, axis_forward='Z', axis_up='Y', filter_glob="*.stl", use_selection=True, global_scale=1.0, use_scene_unit=False, ascii=False, use_mesh_modifiers=True, batch_mode='OFF')
+bpy.ops.object.select_all(action='DESELECT')
+
+bpy.ops.object.select_all(action='DESELECT')
+o = bpy.data.objects['Picamera-Body-Lid']
+o.select = True
+bpy.context.scene.objects.active = o
+bpy.ops.export_mesh.stl(filepath=basedir + "/stl/tarina-picamera-body-lid.stl", check_existing=True, axis_forward='-Z', axis_up='-Y', filter_glob="*.stl", use_selection=True, global_scale=1.0, use_scene_unit=False, ascii=False, use_mesh_modifiers=True, batch_mode='OFF')
+bpy.ops.object.select_all(action='DESELECT')
+
+bpy.ops.object.select_all(action='DESELECT')
+o = bpy.data.objects['Mic-Body']
+o.select = True
+bpy.context.scene.objects.active = o
+bpy.ops.export_mesh.stl(filepath=basedir + "/stl/tarina-mic-body.stl", check_existing=True, axis_forward='-Z', axis_up='-Y', filter_glob="*.stl", use_selection=True, global_scale=1.0, use_scene_unit=False, ascii=False, use_mesh_modifiers=True, batch_mode='OFF')
+bpy.ops.object.select_all(action='DESELECT')
+
+bpy.ops.object.select_all(action='DESELECT')
+o = bpy.data.objects['Mic-Lid']
+o.select = True
+bpy.context.scene.objects.active = o
+bpy.ops.export_mesh.stl(filepath=basedir + "/stl/tarina-mic-lid.stl", check_existing=True, axis_forward='-Z', axis_up='-Y', filter_glob="*.stl", use_selection=True, global_scale=1.0, use_scene_unit=False, ascii=False, use_mesh_modifiers=True, batch_mode='OFF')
+bpy.ops.object.select_all(action='DESELECT')+
\ No newline at end of file