I have many .fbx files that I need convert to .ifc files by using the BlenderBIM addon.
I am trying to do this as part of a regular workflow which is initiated from a .bat file. (the bat file will do other things before and afterwards but that part is not included)
"C:\Program Files\Blender Foundation\Blender 2.90\blender.exe" --background "C:\Users\Joshua\Documents\_BatchProcessing\ProcessTemplate.blend" --python "C:\Users\Joshua\Documents\_BatchProcessing\FBXimportScript.py"
Which calls the python script
import bpy
import os
import glob
directory_im = 'C:/Users/Joshua/Documents/_BatchProcessing/max/fbx/test/'
files = glob.glob(directory_im + "*.fbx")
for f in files:
head, tail = os.path.split(f)
bpy.ops.import_scene.fbx(filepath=f)
bpy.ops.object.select_all(action='SELECT')
bpy.ops.object.parent_clear(type='CLEAR_KEEP_TRANSFORM')
bpy.ops.object.select_all(action='SELECT')
bpy.ops.export_ifc.bim(
filepath=directory_im + tail.replace('.fbx', '') + '.ifc')
I have 2 FBX files to test which different geometry in each which can be seen by the different file size. the above python script exports 2 files with correct names however the same geometry is being exported to each file.
If someone could point me in the right direction it would be very much appreciated!!!
bpy.ops.object.select_all(action='SELECT') ; bpy.ops.object.delete(use_global=False)
to clear the scene. But it might be better to do the loop in the .bat file and pass just one file to be converted to the .py script at a time. $\endgroup$