netDxf 2022.11.2

.NET 5.0 .NET Core 3.1 .NET Standard 2.1 .NET Framework 4.5
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 Versions
.NET net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows net7.0 net7.0-android net7.0-ios net7.0-maccatalyst net7.0-macos net7.0-tvos net7.0-windows
.NET Core netcoreapp3.0 netcoreapp3.1
.NET Standard netstandard2.1
.NET Framework net45 net451 net452 net46 net461 net462 net463 net47 net471 net472 net48 net481
MonoAndroid monoandroid
MonoMac monomac
MonoTouch monotouch
Tizen tizen60
Xamarin.iOS xamarinios
Xamarin.Mac xamarinmac
Xamarin.TVOS xamarintvos
Xamarin.WatchOS xamarinwatchos
Compatible target framework(s)
Additional computed target framework(s)
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

This package is not used by any NuGet packages.

GitHub repositories (1)

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

Repository Stars
ThisIsNotRocketScience/GerberTools
Tools to load/edit/create/panelizer sets of gerber files
Version Downloads Last updated
2022.11.2 3,250 12/21/2022
2.2.0.1 110,991 8/7/2018
2.2.0 3,234 8/3/2018
2.1.0 6,769 6/4/2018
2.0.2 44,822 1/9/2017
0.9.3 14,201 1/13/2015
0.6.1 3,117 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.