This is documentation for Mathematica 6, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)
Mathematica Import/Export Format

DXF (.dxf)

MIME types: image/vnd.dxf, image/x-dxf
AutoCAD DXF format.
3D geometry format.
Commonly used for the exchange of CAD data.
Plain text ASCII or binary format.
DXF is an acronym derived from Drawing Exchange Format.
Stores a 3D object as a collection of line and polygon primitives and their properties.
Introduced in 1982.
  • Import["file.dxf", elem] imports the specified element from a DXF file.
  • Import["file.dxf", {elem, suba, subb, ...}] imports a subelement.
  • Import["file.dxf", {{elem1, elem2, ...}}] imports multiple elements.
  • The import format can be specified with Import["file","DXF"] or Import["file", {"DXF", elem, ...}].
  • Export["file.dxf", expr, elem] creates a DXF file by treating expr as specifying element elem.
  • Export["file.dxf", {expr1, expr2, ...}, {{elem1, elem2, ...}}] treats each expri as specifying the corresponding elemi.
  • Export["file.dxf", expr, opt1->val1, ...] exports expr with the specified option elements taken to have the specified values.
  • Export["file.dxf", {elem1->expr1, elem2->expr2, ...}, "Rules"] uses rules to specify the elements to be exported.
  • See the reference pages for full general information on Import and Export.
"Elements"list of elements and options available in this file
"Rules"full list of rules for each element and option
"Options"list of rules for options, properties and settings
  • Data representation elements:
"Graphics3D"DXF file represented as a Graphics3D object
"GraphicsComplex"list of GraphicsComplex objects, each representing a geometry stored in the file
"LineData"lines represented as lists of indices, referencing the vertices as given by the "VertexData" element
"LineObjects"list of Line primitives given in absolute coordinates
"PointData"point data in indexed form
"PointObjects"list of Point primitives given in absolute coordinates
"PolygonData"polygon data in indexed form
"PolygonObjects"list of Polygon primitives given in absolute coordinates
"VertexColors"colors associated with each vertex, given as a list of color primitives (Import only)
"VertexData"list of vertex coordinates
  • Import and Export use the "Graphics3D" element by default for DXF files.
  • Meta-information elements:
"PlotRange"specifies what range of coordinates to include in the graphics
"ViewPoint"coordinates of the view point
  • When rendering a DXF color model, Import automatically uses the setting Lighting->"Neutral".
BackgroundAutomaticwhat background color to use
ImageSizeAutomaticoverall size of the graphics to display
LightingAutomaticwhat simulated lighting to use in coloring 3D surfaces
This imports a DXF example file, rendering it as a Graphics3D object:
Click for copyable input
Import a 3D model that does not store color information:
Click for copyable input
Use SphericalPlot3D to generate a 3D geometry:
Click for copyable input
Export it to a DXF file:
Click for copyable input