netDxf 2022.11.2

dotnet add package netDxf --version 2022.11.2                
NuGet\Install-Package netDxf -Version 2022.11.2                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="netDxf" Version="2022.11.2" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add netDxf --version 2022.11.2                
#r "nuget: netDxf, 2022.11.2"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install netDxf as a Cake Addin
#addin nuget:?package=netDxf&version=2022.11.2

// Install netDxf as a Cake Tool
#tool nuget:?package=netDxf&version=2022.11.2                

netDxf

netDxf Copyright(C) 2009-2022 Daniel Carvajal, licensed under MIT License

Description

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 I tried to keep the procedures as straightforward as possible, 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.

If you need more information, you can find the official DXF documentation here.

Code example:

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);
}

Samples and Demos

Are contained in the source code. Well, at the moment they are just tests for the work in progress.

Dependencies and distribution

Multitarget project, predefined frameworks for Net Framework 4.5, Net Standard 2.1, Net Core 3.1, NET 5.0, and NET 6.0. Additionally the Net Standard 2.1 build requires a reference to the external library "System.Text.Encoding.CodePages".

Compiling

Visual Studio 2022. The solution file is still usable by Visual Studio 2019 but it does not support NET 6.0.

Development Status

See changelog.txt or the wiki page for information on the latest changes.

Supported DXF entities

  • 3dFace
  • Arc
  • Circle
  • Dimensions (aligned, linear, radial, diametric, 3 point angular, 2 line angular, 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.

Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 is compatible. 
.NET Standard netstandard2.1 is compatible. 
.NET Framework net45 is compatible.  net451 was computed.  net452 was computed.  net46 was computed.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETCoreApp 3.1

    • No dependencies.
  • .NETFramework 4.5

    • No dependencies.
  • .NETStandard 2.1

  • net5.0

    • No dependencies.
  • net6.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on netDxf:

Package Downloads
E3.Dxf

DXF 文件解析

GitHub repositories (3)

Showing the top 3 popular GitHub repositories that depend on netDxf:

Repository Stars
ThisIsNotRocketScience/GerberTools
Tools to load/edit/create/panelizer sets of gerber files
dsuarezv/GearSolver
A cycloid gear graphical calculator to design cycloidal drives.
FriendsOfCADability/CADability
CADability is a pure .net class library for modeling and analyzing 3d data, both with your code and interactively. It comes with an optional Windows.Forms user interface, which can be adopted to other environments. It does not refer to other 3d modeling libraries. For data exchange you can use STEP, STL or DXF files.
Version Downloads Last updated
2022.11.2 133,341 12/21/2022
2.2.0.1 156,013 8/7/2018
2.2.0 6,006 8/3/2018
2.1.0 7,437 6/4/2018
2.0.2 51,795 1/9/2017
0.9.3 16,095 1/13/2015
0.6.1 4,769 12/5/2013

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.