Coder Social home page Coder Social logo

netdxf's Introduction

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, and NET 5.0. Additionally the Net Standard 2.1 build requires a reference to the external library "System.Text.Encoding.CodePages".

Compiling

Visual Studio 2019.

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)
  • 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's People

Contributors

haplokuon avatar chr-schubert avatar djgosnell avatar dayi-wang avatar ricklove avatar stuyarrow avatar dyama avatar igor-smi avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.