1. Products
  2.   CAD
  3.   .NET
  4.   netDxf
 
  

C# .NET Library for AutoCAD DXF Files Reading & Writing 

Open Source .NET CAD library that enables programmers to read and write AutoCAD DXF Files. It supports 3dFace, Arc, circle, image, line, mesh & so on.

netDxf is an open source AutoCAD DXF C# .NET Library that enables computer programmers to read and write AutoCAD DXF Files inside their own .NET applications. The DXF™ file format is a tagged data representation of all the information contained in an AutoCAD drawing file. Which means each data element in the file is led by an integer number that is called a group code. The library is very simple to use and have kept the procedures as straightforward as possible.

The library has included complete support for several important DXF entities such as 3dFace, Arc, circle, hatch, image, line, mesh, Insert, Leader, light weight polyline, MLine, MText, Point, Polyline2D, Polyline3D, PolyfaceMesh, and PolygonMesh, Shape, Ray, Solid, Text, Tolerance, Underlay, Wipeout, XLine and many more. It also support various dimensions such as aligned, linear, radial, diametric, 3 point angular, 2 line angular, and ordinate. Please remember that all the entities can be grouped and all DXF objects may contain extended data information.

The library also provides support for importing the AutoCad Table entities and both simple and complex line types are supported as well. The library has included complete support for AutoCad2000, AutoCad2004, AutoCad2007, AutoCad2010, AutoCad2013, and AutoCad2018 DXF database versions, in both text and binary format.

Previous Next

Getting Started with netDxf

The easiest way to install netDxf is by using Pip. Please use the following command for a smooth installation.

Install netDxf via Pip

pip install cadquery 

You can also install it manually; download the latest release files directly from GitHub repository.

Create AutoCAD DXF Files via .NET Library

The open source library Docxlib has included various functionalities for adding and managing text inside word DOCX documents using Go API. . The Docxlib library has included support for adding one or more paragraphs to the word documents inside Go applications. The library provides features for setting fonts, font colors, size, and alignment, etc. of your textual contents with ease.

Create & Read AutoCAD DXF Files via C# .NET

public static void Main()
{
	// 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);
}

Load & Read AutoCAD DXF File via C# .NET

The open source netDxf library gives computer programmers the capability to open and read .DXF files inside their .NET application with ease. You need to provide the address of an existing file and the library will check the version of the file before loading it. Please remember that netDxf is only compatible with AutoCad2000 and higher DXF versions. Please note that the library will never be able to read some entities like REGIONs, SURFACEs, and 3DSOLIDs, since they depend on undocumented proprietary data.

 English