0
$\begingroup$

I would like to automate the process of modifying a .fbx file but I'm not quite sure why my code isn't working. All I'm doing is importing a .fbx file, separating the mesh by "Loose Parts", and then exporting it back out. Any thoughts?

import bpy

bpy.ops.import_scene.fbx(filepath="C:/Users/'user'/Downloads/Futuristic_ghetto_building/Futuristic ghetto building_one_Mesh_fbx.fbx")
bpy.ops.object.select_all(action='DESELECT')

buildings = bpy.data.objects['Plane']
buildings.select = True
bpy.ops.object.mode_set(mode='EDIT')
bpy.ops.mesh.separate(type='LOOSE')

Note: The code isn't exporting anything right now for testing purposes

$\endgroup$
  • $\begingroup$ You want to separate objects['Plane'] only? Did the imported fbx named 'Plane'? And are you use version 2.79 and below? $\endgroup$ – HikariTW Jul 22 at 1:33
  • $\begingroup$ Yes I would like to separate the “Plane” mesh as it shows in the objects tab. The fbx file itself is not named planes but the house mesh imported into the scene is called “Plane”. I’m using version 2.83 $\endgroup$ – BassoftheC Jul 22 at 12:21
  • $\begingroup$ If you're using newer Blender (2.80 and above) I don't think buildings.select = True will be able to run. You should use buildings.select_set(True) instead $\endgroup$ – HikariTW Jul 22 at 14:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.