2
$\begingroup$

I exported a model from Solidworks into .wrl files - each piece being it's own .wrl. I can import them into Blender just fine, but there's hundreds of .wrl files. It'd be a terrible waste of time importing them one by one.

Is there a way I can do a batch import of .wrl files into Blender?

$\endgroup$
  • $\begingroup$ @MrZak, unfortunately, no. When multiple files are selected with Shift+click, the last one selected is the one that opens. $\endgroup$ – Jesse Mar 10 '16 at 23:53
2
$\begingroup$

Script is probably going to be your best bet? This should be safe to tinker with in the scripting screen. Paste, edit dir and run script to check output in the terminal, then uncomment (remove the #) to run and import the files.

import bpy
import os

dir = 'C:\Temp'

for file in os.listdir(os.path.normpath(dir)):
    if file.endswith('.wrl'):
        path = os.path.normpath(os.path.join(dir,file))
        print(path)
        #bpy.ops.import_scene.x3d(filepath=path, axis_forward='Z', axis_up='Y')
$\endgroup$
  • 1
    $\begingroup$ may I suggest one small modification to your proposed script? Change the line "if file.endswith('wrl'):" by adding a dot before the ".wrl". This would find files with a file extension "wrl", but ignore a file with a name such as "snowrl" and no file extension. $\endgroup$ – brasshat Mar 11 '16 at 5:35
  • $\begingroup$ noted and edited :) $\endgroup$ – Shiprex Mar 14 '16 at 21:28
  • $\begingroup$ I can't say I'm very programmer-esque, but I'll assume that this is the best method. I found another way to accomplish my task, but I appreciate the suggestions. :) $\endgroup$ – Jesse Mar 23 '16 at 19:08

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.