Paste Code
Paste Blends
Paste Images
import bpy
import sys
import os


def delete_all():
for item in bpy.context.scene.objects:
bpy.context.scene.objects.unlink(item)

for item in bpy.data.objects:
bpy.data.objects.remove(item)

for item in bpy.data.meshes:
bpy.data.meshes.remove(item)

for item in bpy.data.materials:
bpy.data.materials.remove(item)


def launch_file(filepath):
basename = filename = fileext = ext =''
basename = os.path.basename(filepath)
(filename,fileext) = os.path.splitext(basename)

ext = fileext.lower()

if os.path.isfile(filepath):

if ext =='.fbx':
bpy.ops.import_scene.fbx(filepath=filepath,automatic_bone_orientation=True)

elif ext =='.obj':
bpy.ops.import_scene.obj(filepath=filepath,axis_forward='-Z', axis_up='Y' )

else:
None


if __name__ == "__main__":
delete_all()
launch_file(filepath=sys.argv[-1])

  1. import bpy
  2. import sys
  3. import os
  4.  
  5.  
  6. def delete_all():
  7.     for item in bpy.context.scene.objects:
  8.         bpy.context.scene.objects.unlink(item)
  9.  
  10.     for item in bpy.data.objects:
  11.         bpy.data.objects.remove(item)
  12.  
  13.     for item in bpy.data.meshes:
  14.         bpy.data.meshes.remove(item)
  15.  
  16.     for item in bpy.data.materials:
  17.         bpy.data.materials.remove(item)
  18.  
  19.  
  20. def launch_file(filepath):
  21.     basename = filename = fileext = ext =''
  22.     basename = os.path.basename(filepath)
  23.     (filename,fileext) = os.path.splitext(basename)
  24.    
  25.     ext = fileext.lower()
  26.    
  27.     if os.path.isfile(filepath):
  28.  
  29.         if ext =='.fbx':
  30.             bpy.ops.import_scene.fbx(filepath=filepath,automatic_bone_orientation=True)
  31.  
  32.         elif ext =='.obj':
  33.             bpy.ops.import_scene.obj(filepath=filepath,axis_forward='-Z', axis_up='Y' )
  34.  
  35.         else:
  36.             None
  37.  
  38.  
  39. if __name__ == "__main__":
  40.     delete_all()
  41.     launch_file(filepath=sys.argv[-1])
  42.  
  43.  
go to heaven