5
$\begingroup$

I am doing some research work on anatomy of human body, for which I want to use this project: http://dbarchive.biosciencedbc.jp/en/bodyparts3d/download.html

This project is a 3D Model of human anatomy, containing hundreds of .obj files. Each .obj file is actually a model of a part of human body. I want to import all the .obj files in such a way that the overall anatomy of the figure is intact, i.e. all the structures are in their right place (so that I don't have to manually correct their position).

Edit:

Thanks @poor and @zeffii for your input. After a couple of hours of head-banging, everything seems to work now. Here is what I did:

  • Used the script given in the post mentioned by @poor.
  • Modified the directory structure given in the script (which is for windows) to work with linux.
  • Imported the .obj files using the script

successful batch import

The script now looks like this:

#Script to import multiple .obj files into blender
import os
import bpy

# put the location to the folder where the objs are located here in this fashion
path_to_obj_dir = '/home/user/Desktop/brainstem/'

# get list of all files in directory
file_list = sorted(os.listdir(path_to_obj_dir))

# get a list of files ending in 'obj'
obj_list = [item for item in file_list if item.endswith('.obj')]

# loop through the strings in obj_list and add the files to the scene
for item in obj_list:
    path_to_file = os.path.join(path_to_obj_dir, item)
    bpy.ops.import_scene.obj(filepath = path_to_file)

Note:

There is something specific to this Human Anatomy project (link given above) that I want to share (hoping that it might help someone).

As mentioned by @zeffii, this project is huge. If yout try to import all the files at once, your system may crash.

The project contains some reference files, which have information about the file names and anatomical structures covered in them. This is very useful information because in this way you can divide the whole project into regions/systems and work with one region/system at a particular time.

The image given above is of "Brain Stem" which is made up of 11 .obj files.

brainstem

Edit # 2:

@poor has written an add-on for blender in order to import multiple .obj files simultaneously in a more user friendly way. I am now using this addon and it works flawlessly.

Here is the link: How to batch import Wavefront OBJ files?

How to add this Addon:

Step # 1:

First of all copy the code of the plugin and create a file named io_import_multiple_objs.py io_import_multiple_objs.py

Step # 2:

In blender, goto "User Preferences" > "Addons" > "Install from file" and select the "io_import_multiple_objs.py" file you created in step # 1.

install from file

Step # 3:

Enable the addon

Enable the addon

Now you can batch-import multiple .obj files. :D batch import

Thanks @poor for this great addon :D

$\endgroup$
8
  • $\begingroup$ just tried. works flawlessly if you give it the correct Path. $\endgroup$
    – zeffii
    Jun 1, 2015 at 11:55
  • 1
    $\begingroup$ I have no experience with python. But based on common sense, I need to edit this line: "path_to_obj_dir = os.path.join('C:\\', 'objects')". What should be the syntax? I am on ubuntu linux and the files are on my desktop. $\endgroup$ Jun 1, 2015 at 11:58
  • $\begingroup$ but.. it's a rather large folder, the import might take a while...or fail because it's too much geometry. $\endgroup$
    – zeffii
    Jun 1, 2015 at 12:02
  • $\begingroup$ It works.. I have added all the details to the original question above. Thanks $\endgroup$ Jun 1, 2015 at 14:57
  • $\begingroup$ @AhsanIqbal I've wrote a small addon: blender.stackexchange.com/a/31825/3710 to import multiple files. Hope this makes your life easier :) $\endgroup$
    – p2or
    Jun 1, 2015 at 22:12

0

Browse other questions tagged .