DXF import script for Blender 2.5

My understanding of classes and inheritance in python has been very sketchy. Since it is very difficult for me to learn something without having a project to work on, I made a little script that imports DXF files into Blender 2.5. The script can be found at http://rapidshare.com/files/398433044/import_scene_dxf.py

Put it in your add-ons folder (.blender/scripts/addons) and enable it ( File > User preferences > Add-Ons tab > Import Autocad DXF (.dxf) ), or execute in the text editor windows. Then import the dxf file from File > Import > Autocad DXF (.dxf).

We have a lot of 2D drawings in DXF at work, and at least the scripts swallows those without complaining.

hi Thomas.
great job & thanks for sharing.

Hi Thomas,
some feedback here:
The script doesn’t register in official 2.5alpha2: missing Mathutils module,
but it runs on win32-build rev.29211 from graphicall.org. \o/

Sad to say, it fails on all standard DXF files i have here.

no time for more investigation now, but will diving into your code asap.
thanks for sharing,

not real problem, easy to solve: script accepts only “.dxf” not “.DXF” as file extension.

Hi Thomas, more feedback here:

  • script works well for simple 2d objects
  • limited support for complex entities like POLYLINE / POLYFACE / POLYMESH
  • erroneous rotated TEXT
  • no support for entity rotation in 3d (210 group ignored)
  • no support for hierarchies/BLOCK
  • supposedly more…
    though i like the structure of your code very much, it seems to be easy to extend.
    Do you plan to implement missing functionality?
    Porting my DXF-importer to 2.6 will take some time - the complexity of it’s UI is the most difficult part.
    Probably i will look at your code to speed up this process. Both scripts are GPL licensed. You are the only copyrighter, aren’t you?

Hi Migius,

A verification suite - cool! I knew that there had to be one out there.

I wasn’t aware of your script for 2.4x. Didn’t look further than to the hardcoded importer, which does about as poor a job as I do on 3D objects.

No, I don’t intend to push this much further. I spent less than a week on this project, and learned a lot about python classes in the process. But to bring it up to the same level as you have on the 2.4 importer would require a lot of work, and I see no reason why I should duplicate all the work that you have already done. Your interface code is messy, but that is rather a problem with the old api.

Hi Meta-Androcto,

I downloaded a fresh build from graphicall today, and noticed that my dxf importer already made it into the add-ons section. This seems a bit premature given the problems that my script has, so I would appreciate if you remove it again.

OTOH, the mhx importer is several weeks old. Shouldn’t it be updated automagically?

Yes, I am the only copy-writer.

Hi ThomasL
yeah, I did get excited about the dxf script.
in fact, my initial tests were quite successful, (i must have fluked some good files for it with my random dxf d/l’s. :wink:
then as i found bugs were reported I knew migius would arrive here soon.
already ideasman has made some api changes to the script in svn &
no doubt migius will use our svn to get through the bugs quickly,
so that & next release being 3 or 4 weeks away caused me to fast track this script.
I’ve found it encourages development & I considered this script is an important missing feature.
Sorry to surprise you like that. :slight_smile:
atm the bugs are acceptable so I would like to keep it in the graphicall builds for now if that’s ok.
https://svn.blender.org/svnroot/bf-extensions/trunk/py/scripts/addons/import_scene_dxf.py is the script in our svn.
I would really like to give the script the best chance possible but can remove it if you feel strongly about it.

slightly off topic.
The MH script has been very well received. Thanks so much.
Sorry again it’s out of date, I have to do things manually.
I’ll get moving on that & do testing tonight.
thanks again.

a small patch fixing this issue: in line 1430 replace

if ext!=".dxf":


 if ext.lower()!=".dxf":

I am not a programmer at all (I don’t even know how to use Blender propperly -I just started with it) so I won’t be of any use to you, but since I am an architect and I will be using it for architectonic visualization, this feature is of great importance to me. Just wanted to encourage you with your work, because it’s a feature I am missing from 2.49


is there any chance to export as dxf or dwg in Blender 2.5 ???

afaik no.
I am going to port the both scripts (DXF-importer and exporter) to 2.6 first. Maybe someone do it for 2.5x before this, who knows.

i have installed the dxf importer and tried to import dxf nothing happens, there are three instances of the in the
import drop down menu, i do not know why, and every time i enable import dxf addon a new instance appears in the drop down menu

hi Giridhar,
I have updated the script for 2.53beta, it should work for you now.
Eventually you have to delete all previous versions in addons folder.

the script is moved to new location: link

Place the script to Blender addons directory
(on Windows it is %Blender_directory%\2.53\scripts\addons)
You have to activate the script in the “Add-Ons” tab (user preferences).
Access from the File > Import menu.

hi migius
i have couple of things that i do not understand

a) the script is not in downloadable format.at the link
b) how to delete a any older version of the script from the add ons folder?
c) I am unable to find the add ons directory on my windows .I am looking in the blender sub folder in program files folder where i have installed blender.
d) how to execute the script in the text editor windows.

please clarify.

a) you have to navigate to the link with your webbrowser, from there load the script file: io_import_scene_dxf.py
b) you can skip this step
c) if you have the official Blender 2.53beta installed, the addons directory is placed here:
d) i would not do it this way - i am not sure if it is the correct way in 2.5x series

if a) doesnt work here the direct link: https://svn.blender.org/svnroot/bf-extensions/contrib/py/scripts/addons/io_import_scene_dxf.py

good luck

what do you mean by loading the script file, because i do not have a python compiler (i do not know how to use it ) and all i get to see at the given links is a python class. (all text ) can you upload it to rapidshare (in the format like Thomas did in the thread starter?)

“loading” means: right-clik on the upper link, from context-menu choose “target save to…” option
I hope this helps

edit: i will send you the script by email, just in case.


I have installed the script as an addon, following the guide,
but I cannot activate the addon.

I just cannot click (tick whatever is right) in the box to make it active.

I am using the 3.54 version of blender and the 3.5x version of the script.

Any ideas or advice?

thanx a lot!

Hi [pan], hi all,
always get the most newest version from here:

new link: