DXF Importer

NEW RELEASE 0.8.4

Check it out at https://bitbucket.org/treyerl/io_import_scene_dxf/overview

  • Blocks are being imported and are reflected in Blender as linked objects or optionally as group instances. For linked objects sub-blocks get parented to the main block. If a block contains mixed curve / mesh / surface / text / light entities, the different types are being imported to different objects that are being parented to the main block.
  • Layers are being reflected with “Blender-groups”. Select an object and type Shift-G to select all objects within the same “Blender-Group” (they should call it category, because that’s what it is). Anyhow as Blender supports “only” 20 layers and DXF files can have virtually an infinite amount of layers I think it’s best users would select grouped objects as described and move them themselves to layers as they wish.
  • Speed: Using as many generators instead of lists as possible minimizes memory consumption. Parts of the the underlying dxf library “dxfgrabber” are written in cython and can be compiled to platform specific modules.
  • DXF Attributes: DXF specific attributes (e.g. thickness, width and extrusion) are taken into account to import geometry as precise as possible.
  • Geo Referencing: If the pyproj library is available, the scene center will be converted to lat/lon taking into account re-centering of geometry. The origin/DXF coordinate system (SRID) must be specified. If you have a DXF file from QGIS or ArcGIS this option should be most likely set to WGS84. The destination/scene SRID is by default the same as the DXF SRID, but of course you can set it to your local coordinate system. If a scene has a SRID already, this option is not available and the DXF SRID MUST be specified, so that the DXF geometry can be aligned to the scene geometry. For the installation of pyproj see “Installation”.

wow nice, I’ll test it right away !
Thanks for sharing.

Hi CND,

You’re a little discouraging about bugs but it should not be so!
Thank you for your sharing as the current importer is not as conplexe than yours, indeed.
Congratulation.

Thank you. Don’t worry about the bugs. That was kind of a joke :slight_smile:

Fantastic one! Thank you =)
Btw, what about backward export? Is it in your plans?

Well, I discovered the work of somebody who wrote a freestyle module. Download.
But if you are looking for a way to export a 2D Blender curve to DXF as a spline, you might need to wait for my next christmas holydays :wink: I just tried it with the DXF export addon that ships with Blender, but neither nurbs nor bezier curves get exported apparently. Did you make the same experience?

Honestly, I don’t like DXF much. I don’t respect it.

I’m an architect, and I had a lot of troubles with this file format during using it.
It tooks a lot of time to prepare entire files, or make a part from it, it constantly gives an errors during imports, that usually are providen without flexible preferences, and, as a result, gives huge lagging files with damned high-densed splines, that in 99% cases are needed to be converted to mesh for further extrusions. =)
For exaple, we working with millimetric drawings (1 meter = 1000 units), that are far from scene origin (World UCS), and converting that drawings via DXF to Blender brings to Blender pain.

That’s why I made exporter in my way, that allows to export desired selection to opened plain text file format, to get pure flexible mesh, we love so much.
(Blender’s mesh is awesomeness - most of software, including 3dsmax and meshlab are not allowed to build wire mesh loop, so my converter is not applyable to them. God bless Blender.)
Most troubles gave me 3DSolids, Regions, and other ACIS SAT 3D objects - they are too complex for parsing, so they are not supported even for Bricscad, where their DXF structure is not encrypted.

Anyway, than more bridges between Blender and Acad, then better.
You’ve made an awesome work, and thank you for it!
I will wait for next cristmass holidays))

Btw, what dwfgrabber is?

Very good. I really was needing this. Thank you so much.

I’m a complete AutoCAD noob, but sometimes I get AutoCAD files I need to work with. I managed to get your script to work, but I’m having a hard time selecting what I want for export. Is there a way to simply select everything? Then I can dump the unnecessary parts in Blender itself.

It works very well! Thank you. I will talk about this addon during a conference tomorrow.

What kind of conference is that? I and the person who developed the dxf library are working on it to make it 3D ready as well, so that it can replace the old addon.

Version 0.8: https://bitbucket.org/treyerl/io_import_scene_dxf/overview

Awesome! I just trying your addons. It works great and it is very fast. You did good job!
The idea to transform dxf layers into group really facilitates manipulating layers.

Thank you! :wink:

Hey Matali,

Can you post or send me an example dxf file with longitude and latitude coordinates? Or does your DXF have any georeference information. As far as I know coordinates in DXF are XYZ not lat/lon. Therefore there is no lat/lon to XYZ projection possible and therefore I also cannot tell you at which lat/lon position your DXF drawing is. But if you have a DXF that has a geo reference stored, I can surely try to get that information and shift objects around and add custom properties to the scene.

I did lat/lon projection before. A post of mine: http://www.ia.arch.ethz.ch/lat-lon-to-ch-coordinates/
There I explain how to do the projection with pyproj, that lets you use different kind of projection models (not only the mercator one that Blender GIS uses).

But if you are just asking for moving a drawing to the center of the scene: I could probably write an addon that would do this and then add it as an option to the DXF importer. But why is your drawing not centered in the first place? I mean why is it not centered in the drawing app where you get the DXF from?

Thanks! Looked promising… but I can’t download it. :frowning:
Seems the downloads section is now empty?
Is this a mistake or has development stopped and the project been taken down?

Hey CND,

Actually, I don’t think it has georeferencing in the way other format like shape understand it, but when you open a dxf/dwg file and then import georeferenced images and shp datas, it’s all well aligned. So autocad knows where the datas of the DXF are on earth.
The fact is other importers do conversion from lat/long to xyz, then store the georefs infos as lat/long. In your case, you already have xyz datas if I’m correct, if you center the datas you can create 2 scene custom properties with offsets on x,y and z. For compatibility with other addons, I think you should then convert those x,y values to lat/long by doing the invert conversion of the shp/hgt/osm addons.

Kind regards

no. development hasn’t stopped. Just realized I can’t call it a 1.0 and needed to do some bug fixing.

Hi CND,

Any news on your project?

Kind regards

Hey Matali,

Well I am not AutoCAD, and this seems to be an undocumented feature. Apparently your version of AutoCAD stores geo reference information in its DXF file. Therefore again: please send me a sample dxf file with geo reference information! What I can do is re-center the DXF if you want this as a feature. But this will not help with aligning different geo referenced data sets.

For updates on the importer it’s best to have a look at my bitbucket page: https://bitbucket.org/treyerl/io_import_scene_dxf
Soonish version 0.8.3 will be available (probably today).