I have a scene with multiple objects and I want to export them individually as .stl meshes.
Right now, it is just a cube and a plane, for simplicity. The cube is resting on the plane.
I've tried the following script to loop through the objects in the scene and export them individually as .stls:
cube.select=True
plane.select=True
names = [ob.name for ob in bpy.context.selected_objects]
bpy.ops.object.select_all(action='DESELECT')
for name in names:
obj = bpy.data.objects[name]
bpy.context.scene.objects.active = obj
stl_path = os.path.join('C://Users/deden/Desktop/', name + '.stl')
bpy.ops.export_mesh.stl(filepath=stl_path)
However, when I do this, both .stl files contain both the cube and the the plane. I am trying to have a separate .stl file for both the cube and the plane.
Can anybody help me with this?
I've seen a couple other stack posts but keep getting the same problem..