tarina

git clone https://git.tarina.org/tarina
Log | Files | Refs | README | LICENSE

commit ed6896343de2971fbf34c0d231f6ec1a93edad9b
parent b98e88466eb39d65135cb54fa711c07bee07884d
Author: rbckman <rbckman@localhost.localdomain>
Date:   Sat, 18 Aug 2018 03:22:22 +0300

blender stl export script

Diffstat:
A3d/tarina_stl_export.py | 102+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
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