DXF layers are reflected as Blender groups. This importer uses a general purpose DXF library called «dxfgrabber».
DXF Type Mapping
To be as non-destructive as possible the importer aims to map as many DXF types to Blender curves as possible.
DXF to Curves
POLYLINEcurve (with the option to merge connecting lines).
POLYLINEcurve if they have no bulges else as
HELIXes (3D) as
DXF to Meshes
MESHis mapped to a mesh object with a Subdivision Surface modifier, including the edge crease.
POLYMESHes are imported to a mesh object.
POINTs are imported into one combined mesh object per layer called
Missing DXF Types
- Blocks As
DXF Blocks can be imported as linked objects or group instances. Linked objects use parenting for DXF sub-blocks (blocks in blocks).
- Parent Blocks to Bounding Boxes
Draw a bounding box around blocks.
- Merged Objects
Since Blender (v2.71) is pretty slow at adding objects the user might want to merge similar DXF geometry to one object.
- By Layer
Produces one object per layer; if there is mesh, curve, lamp, text data on one layer one object per layer and per Blender object.
- By Layer and DXF Type
The second not only differentiates between Blender data types but also DXF types, such as
- By Layer and Closed No-bulge Polygons
Closed polylines with no bulge, that is no curved edges, can be merged to one single mesh. This makes sense when the DXF polylines have an extrusion and/or an elevation attribute, which basically describes a location/rotation/scale transformation. If this merge option is chosen, line thickness settings will be ignored/disabled.
- By Layer and DXF-Type and Blocks
For DXF files with a block being referenced many times, this option allows to insert the same block many times with one instanced-face object instead of with one object for each time the block needs to be inserted. Unfortunately this works only for block inserts that are uniformly scaled. Non-uniformly scaled block inserts are being imported as defined in Blocks As.
LINEEntities to Polygons
Separated lines in DXF might be merged to one consecutive Blender poly curve. Similar to Remove Doubles but for curves.
Line Thickness and Width
- Represent Line Thickness/Width
DXF line attributes thickness and width have an effect on line in Z and X/Y direction respectively. A straight line might be turned to a cube by its attributes for instance. Therefore, in Blender these attributes are represented with curve extrusion, bevel and taper objects.
- Merge by Attributes
If both Merged Objects and Represent Line Thickness/Width are activated the object merging needs to be extended to separate all lines width different thickness and width. With Merge by Attributes this separation option is also available without the actual representation of line thickness and width.
Including support for AutoCAD colors.
Export NURBS 3D geometry (
3DSOLID) to ACIS-Sat files, since this is the format AutoCAD stores NURBS to DXF. You are going to be notified about the amount of stored
- Display Groups in Outliner(s)
Switch the Outliner display mode to
GROUPS(DXF layers are mapped to groups).
- Import DXF File to a New Scene
A ser feito.
- Center Geometry to Scene
Center the imported geometry to the center of the scene; the offset information is stored as a custom property to the scene.
Important: DXF files do not store any information about the coordinate system / spherical projection of its coordinates. Best practice is to know the coordinate system for your specific DXF file and enter this information in the DXF importer interface as follows:
In case you need to compile your own binary refer to this post on Blender Artists.
Pyproj is a Python wrapper to the PROJ library, a well-known C library used to convert coordinates between different coordinate systems. Open source GIS libraries such as PROJ are used directly or indirectly by many authorities and therefore can be considered well-maintained.
If Pyproj is available the DXF importer shows a selection of national coordinate systems but lets the user also to enter a custom EPSG / SRID code. It also stores the SRID as a custom property to the Blender scene. If a scene has already such an SRID property the coordinates are being converted from your DXF file to target coordinate system and therefore you must specify an SRID for the DXF file. If no SRID custom property is available the scene SRID is by default the same as the DXF SRID.
- No Pyproj
In case Pyproj is not available the DXF importer will only use its built-in lat/lon to X/Y converter. For conversion the «transverse Mercator» projection is applied that inputs a lat/lon coordinate to be used as the center of the projection. The lat/lon coordinate is being added to your scene as a custom property. Subsequent imports will convert any lat/lon coordinates to the same georeference.
Important: So far only lat/lon to X/Y conversion is supported. If you have a DXF file with Euclidean coordinates that refer to another lat/lon center the conversion is not (yet) supported.
- Rules of thumb for choosing an SRID
if you have your data from OpenStreetMap or some similar GIS service website and exported it with QGIS or ArcGIS the coordinates are most likely in lat/lon then use WGS84 as your SRID with Pyproj or «spherical» if Pyproj is not available. For other DXF vector maps it’s very likely that they use local / national coordinate systems.
Open the DXF with a text editor (it has many thousands of lines) and make an educated guess looking at some coordinates. DXF works with «group codes», a name Autodesk invented for «key» as in key/value pairs. X has group code 10, Y has 20, Z has 30. If you find a pattern like:
10, newline, whitespace, whitespace, NUMBER, newline, 20, newline, whitespace, whitespace, NUMBER, newline, 30, newline, whitespace, whitespace, NUMBER
NUMBERwill be most likely your coordinates. You can probably tell from the format and/or the range of the coordinates which coordinate system it should be.
Object matrix: extrusion (
210-group), rotation, elevation
3D Viewport: (wip:
Instancing vert: auto-instanced or (wip:
Instancing frame: auto-instanced or (wip:
Instancing group: auto-instanced or (wip: