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”.
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 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))
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.
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.
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?
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.
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.