My goal is to select a number of objects in my scene and save those as a individual obj files in a specific folder. But I’m a bit confuse, “obj” exporter is and addon and I would like to use it form my own script. Can I “call” and addon from my script? :spin:
Hi,
I’ve searched for this a year ago and found this script. I couldn’t find the original web page so I’m pasting the code here.
Hope that helps
import bpy
# get the path where the blend file is located
path = bpy.path.abspath('//')
# deselect all objects
bpy.ops.object.select_all(action='DESELECT')
# loop through all the objects in the scene
scene = bpy.context.scene
for ob in scene.objects:
# make the current object active and select it
scene.objects.active = ob
ob.select = True
# make sure that we only export meshes
if ob.type == 'MESH':
# export the currently selected object to its own file based on its name
bpy.ops.export_scene.obj(filepath=str(path + ob.name + '.obj'), use_selection=True)
# deselect the object and move on to another if any more are left
ob.select = False