NetDxf is a .NET library programmed in C# to read and write AutoCAD DXF files. It supports AutoCad2000, AutoCad2004, AutoCad2007, AutoCad2010, AutoCad2013, and AutoCad2018 DXF database versions, in both text and binary format. The library is easy to use and the procedures should be straightforward, for example you will not need to fill up the table section with layers, styles or line type definitions. The DxfDocument will take care of that every time a new item is added.
This project is a fork of the original netDxf library by Daniel Carvajal, which is archived since 2023.
If you need more information, you can find the official DXF documentation here.
Add the AHe.NetDxf package to your application.
using netDxf;
using netDxf.Entities;
using netDxf.Header;
// your DXF file name
string file = "sample.dxf";
// create a new document, by default it will create an AutoCad2000 DXF version
DxfDocument doc = new DxfDocument();
// an entity
Line entity = new Line(new Vector2(5, 5), new Vector2(10, 5));
// add your entities here
doc.Entities.Add(entity);
// save to file
doc.Save(file);
// this check is optional but recommended before loading a DXF file
DxfVersion dxfVersion = DxfDocument.CheckDxfFileVersion(file);
// netDxf is only compatible with AutoCad2000 and higher DXF versions
if (dxfVersion < DxfVersion.AutoCad2000) return;
// load file
DxfDocument loaded = DxfDocument.Load(file);See the samples folder for usage examples.
The project targets .NET 10, .NET 8, and .NET Framework 4.8.
Visual Studio 2026 or other IDEs like Rider or Visual Studio Code.
See the changelog for information on the latest changes.
This fork of the original netDxf library is just some hobby project of mine, so I cannot promise to keep it updated with the latest DXF versions or timely bug fixes.
- 3dFace
- Arc
- Circle
- Dimensions (aligned, linear, radial, diametric, 3 point angular, 2 line angular, arc length, and ordinate)
- Ellipse
- Hatch (including Gradient patterns)
- Image
- Insert (block references and attributes, dynamic blocks are not supported)
- Leader
- Line
- LwPolyline (light weight polyline)
- Mesh
- MLine
- MText
- Point
- Polyline (Polyline2D, Polyline3D, PolyfaceMesh, and PolygonMesh)
- Ray
- Shape
- Solid
- Spline
- Text
- Tolerance
- Trace
- Underlay (DGN, DWF, and PDF underlays)
- Wipeout
- XLine (aka construction line)
All entities can be grouped. All DXF objects may contain extended data information. AutoCad Table entities will be imported as Inserts (block references). Both simple and complex line types are supported. The library will never be able to read some entities like REGIONs, SURFACEs, and 3DSOLIDs, since they depend on undocumented proprietary data.
NetDxf Copyright 2009-2023 Daniel Carvajal, 2026 Ansgar Hellwig, licensed under MIT License
AUTOCAD is a registered trademark of Autodesk, Inc. in the United States and other countries. This software is not affiliated with Autodesk, Inc. in any way.