How import 3DS file with Python

(aske) #1


I am trying to load some 3DS files with Python, but I don’t have any
idea. I try with the Load method of Blender class, but it´s not possible,
becuase only can load .blend files.

Does anybody know how can load 3DS files with Python?

Thanks and sorry for my bad english.

(Michael W) #2

the 3ds importer is just another python script.

load it as a module using “import”…

it’s probably a good idea to read through the 3ds script and work out which function is the main one so you can call it without needing the ui!

(aske) #3

I have found the script “”, but I don’t know how can i use. I have done import, but I have an error.

Can anybody help me? Thanks.

(Michael W) #4

if i recall you use

import 3ds_import

ie no .py on the end…
then you can access functions within using a “.” and function name…

which will open a filebrowser to select the file to import


3ds_import.load_3ds(filename, context, IMPORT_CONSTRAIN_BOUNDS=10.0, IMAGE_SEARCH=True, APPLY_MATRIX=False)
which will need you to pass a filename to open and the context…

PS the filename will be a complete path to the file or a relative path from the working directory…

(aske) #5

This is my code, but I have a invalid syntax error in the 2nd line, on the import.

Thanks for your help and sorry for my bad english

(Michael W) #6

are you writing for 2.5 or 2.49?

in 2.5 you can:


I’ll have a look at 2.49 where you’d have to import the py script

(aske) #7

I am in 2.49…

(Michael W) #8

the “import” command doesn’t like the 3 at the start of the script name… also it seems to want it in the root of the scripts folder,(i had it in a symbollic-linked sub folder)

I suggest you copy it to the right place and rename it (eg “autodesk_import”) and then in your script you should be able to use

import autodesk_import as ai

filename = '/mypathto/myfile.3ds"
ai.load_3ds(filename, PREF_UI= True)

(aske) #9

Where I have to put the 3ds? In the same folder that i have the .blend file? Or all the path to the file (C:\…)

Thanks for your help!!

Edit: I have solve the problem!!

(ederhazael) #10

And what was the solution? can you show the code?

(jaspe) #11

try this…

import bpy
bpy.ops.import_scene.autodesk_3ds(filepath = 'path/to/your/file.3DS', axis_forward='-Y', axis_up='Z', constrain_size=10, use_image_search=True, use_apply_transform=True)

You can change “axis_forward” and “axis_up” values if the models appear rotated.