Skip to content
This repository has been archived by the owner on Oct 11, 2023. It is now read-only.

Commit

Permalink
netDxf 2.1 Release. See Changelog.txt for more info.
Browse files Browse the repository at this point in the history
  • Loading branch information
haplokuon committed Jun 2, 2018
1 parent ed07980 commit 03c4586
Show file tree
Hide file tree
Showing 87 changed files with 8,053 additions and 2,168 deletions.
53 changes: 32 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,40 +1,49 @@
# netDxf
netDxf 2.0.3 Copyright(C) 2009-2017 Daniel Carvajal, Licensed under LGPL
netDxf 2.1.0 Copyright(C) 2009-2018 Daniel Carvajal, Licensed under LGPL
## 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.

I tried to keep the use as simple as posible, 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 everytime a new item is added and the load and save its done with just one line of code.
If you need more information, you can find the official dxf documentation in
[http://help.autodesk.com/view/ACD/2016/ENU/](http://help.autodesk.com/view/ACD/2016/ENU/)
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](https://help.autodesk.com/view/OARX/2019/ENU/?guid=GUID-235B22E0-A567-4CF6-92D3-38A2306D73F3)

Code example:

```c#
public static void Main()
{
// by default it will create an AutoCad2000 dxf version
DxfDocument dxf = new DxfDocument();
// add your entities here
dxf.AddEntity(entity);
// save to file
dxf.Save(filename);
{
// your dxf file name
string file = "sample.dxf";

// by default it will create an AutoCad2000 DXF version
DxfDocument dxf = new DxfDocument();
// an entity
Line entity = new Line(new Vector2(5, 5), new Vector2(10, 5));
// add your entities here
dxf.AddEntity(entity);
// save to file
dxf.Save(file);

// load file
DxfDocument dxfLoad = DxfDocument.Load(filename);
}
bool isBinary;
// this check is optional but recommended before loading a DXF file
DxfVersion dxfVersion = DxfDocument.CheckDxfFileVersion(file, out isBinary);
// netDxf is only compatible with AutoCad2000 and higher DXF version
if (dxfVersion < DxfVersion.AutoCad2000) return;
// load file
DxfDocument loaded = DxfDocument.Load(file);
}
```

### Samples and Demos
## 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
* .NET Framework 4.5
## Dependencies and distribution
* .NET Framework 4.5. netDxf only references the NET libraries System.dll and System.Drawing.dll
## Compiling
To compile the source code you will need Visual Studio 2015.

## Development Status
Stable.
### Supported entities
Stable. See [changelog.txt](https://github.com/haplokuon/netDxf/blob/master/doc/Changelog.txt) or the [wiki page](https://github.com/haplokuon/netDxf/wiki) for information on the latest changes.
## Supported entities
* 3dFace
* Arc
* Circle
Expand All @@ -53,6 +62,7 @@ Stable.
* PolyfaceMesh
* Polyline
* Ray
* Shape
* Solid
* Spline
* Text
Expand All @@ -64,4 +74,5 @@ Stable.

All entities can be grouped and may contain extended data information.
AutoCad Table entities will be imported as Inserts (block references).
The libray will never be able to read some entities like Regions and 3dSolids, since they depend on proprietary data.
Both simple and complex line types are supported.
The libray will never be able to read some entities like Regions and 3dSolids, since they depend on undocumented proprietary data.
156 changes: 138 additions & 18 deletions TestDxfDocument/Program.cs

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions TestDxfDocument/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("TestDxfDocument")]
[assembly: AssemblyCopyright("Daniel Carvajal © 2016")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

Expand Down
142 changes: 142 additions & 0 deletions TestDxfDocument/Support/acad.lin
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
;;
;; AutoCAD Linetype Definition file
;; Version 3.0

;; Copyright 2017 Autodesk, Inc. All rights reserved.
;;
;; Use of this software is subject to the terms of the Autodesk license
;; agreement provided at the time of installation or download, or which
;; otherwise accompanies this software in either electronic or hard copy form.
;;
;; Note: in order to ease migration of this file when upgrading
;; to a future version of AutoCAD, it is recommended that you add
;; your customizations to the User Defined Linetypes section at the
;; end of this file.
;;
*BORDER,Border __ __ . __ __ . __ __ . __ __ . __ __ .
A,.5,-.25,.5,-.25,0,-.25
*BORDER2,Border (.5x) __.__.__.__.__.__.__.__.__.__.__.
A,.25,-.125,.25,-.125,0,-.125
*BORDERX2,Border (2x) ____ ____ . ____ ____ . ___
A,1.0,-.5,1.0,-.5,0,-.5

*CENTER,Center ____ _ ____ _ ____ _ ____ _ ____ _ ____
A,1.25,-.25,.25,-.25
*CENTER2,Center (.5x) ___ _ ___ _ ___ _ ___ _ ___ _ ___
A,.75,-.125,.125,-.125
*CENTERX2,Center (2x) ________ __ ________ __ _____
A,2.5,-.5,.5,-.5

*DASHDOT,Dash dot __ . __ . __ . __ . __ . __ . __ . __
A,.5,-.25,0,-.25
*DASHDOT2,Dash dot (.5x) _._._._._._._._._._._._._._._.
A,.25,-.125,0,-.125
*DASHDOTX2,Dash dot (2x) ____ . ____ . ____ . ___
A,1.0,-.5,0,-.5

*DASHED,Dashed __ __ __ __ __ __ __ __ __ __ __ __ __ _
A,.5,-.25
*DASHED2,Dashed (.5x) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
A,.25,-.125
*DASHEDX2,Dashed (2x) ____ ____ ____ ____ ____ ___
A,1.0,-.5

*DIVIDE,Divide ____ . . ____ . . ____ . . ____ . . ____
A,.5,-.25,0,-.25,0,-.25
*DIVIDE2,Divide (.5x) __..__..__..__..__..__..__..__.._
A,.25,-.125,0,-.125,0,-.125
*DIVIDEX2,Divide (2x) ________ . . ________ . . _
A,1.0,-.5,0,-.5,0,-.5

*DOT,Dot . . . . . . . . . . . . . . . . . . . . . . . .
A,0,-.25
*DOT2,Dot (.5x) ........................................
A,0,-.125
*DOTX2,Dot (2x) . . . . . . . . . . . . . .
A,0,-.5

*HIDDEN,Hidden __ __ __ __ __ __ __ __ __ __ __ __ __ __
A,.25,-.125
*HIDDEN2,Hidden (.5x) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
A,.125,-.0625
*HIDDENX2,Hidden (2x) ____ ____ ____ ____ ____ ____ ____
A,.5,-.25

*PHANTOM,Phantom ______ __ __ ______ __ __ ______
A,1.25,-.25,.25,-.25,.25,-.25
*PHANTOM2,Phantom (.5x) ___ _ _ ___ _ _ ___ _ _ ___ _ _
A,.625,-.125,.125,-.125,.125,-.125
*PHANTOMX2,Phantom (2x) ____________ ____ ____ _
A,2.5,-.5,.5,-.5,.5,-.5

;;
;; ISO 128 (ISO/DIS 12011) linetypes
;;
;; The size of the line segments for each defined ISO line, is
;; defined for an usage with a pen width of 1 mm. To use them with
;; the other ISO predefined pen widths, the line has to be scaled
;; with the appropriate value (e.g. pen width 0,5 mm -> ltscale 0.5).
;;
*ACAD_ISO02W100,ISO dash __ __ __ __ __ __ __ __ __ __ __ __ __
A,12,-3
*ACAD_ISO03W100,ISO dash space __ __ __ __ __ __
A,12,-18
*ACAD_ISO04W100,ISO long-dash dot ____ . ____ . ____ . ____ . _
A,24,-3,0,-3
*ACAD_ISO05W100,ISO long-dash double-dot ____ .. ____ .. ____ .
A,24,-3,0,-3,0,-3
*ACAD_ISO06W100,ISO long-dash triple-dot ____ ... ____ ... ____
A,24,-3,0,-3,0,-3,0,-3
*ACAD_ISO07W100,ISO dot . . . . . . . . . . . . . . . . . . . .
A,0,-3
*ACAD_ISO08W100,ISO long-dash short-dash ____ __ ____ __ ____ _
A,24,-3,6,-3
*ACAD_ISO09W100,ISO long-dash double-short-dash ____ __ __ ____
A,24,-3,6,-3,6,-3
*ACAD_ISO10W100,ISO dash dot __ . __ . __ . __ . __ . __ . __ .
A,12,-3,0,-3
*ACAD_ISO11W100,ISO double-dash dot __ __ . __ __ . __ __ . __ _
A,12,-3,12,-3,0,-3
*ACAD_ISO12W100,ISO dash double-dot __ . . __ . . __ . . __ . .
A,12,-3,0,-3,0,-3
*ACAD_ISO13W100,ISO double-dash double-dot __ __ . . __ __ . . _
A,12,-3,12,-3,0,-3,0,-3
*ACAD_ISO14W100,ISO dash triple-dot __ . . . __ . . . __ . . . _
A,12,-3,0,-3,0,-3,0,-3
*ACAD_ISO15W100,ISO double-dash triple-dot __ __ . . . __ __ . .
A,12,-3,12,-3,0,-3,0,-3,0,-3

;; Complex linetypes
;;
;; Complex linetypes have been added to this file.
;; These linetypes were defined in LTYPESHP.LIN in
;; Release 13, and are incorporated in ACAD.LIN in
;; Release 14.
;;
;; These linetype definitions use LTYPESHP.SHX.
;;
*FENCELINE1,Fenceline circle ----0-----0----0-----0----0-----0--
A,.25,-.1,[CIRC1,ltypeshp.shx,x=-.1,s=.1],-.1,1
*FENCELINE2,Fenceline square ----[]-----[]----[]-----[]----[]---
A,.25,-.1,[BOX,ltypeshp.shx,x=-.1,s=.1],-.1,1
*TRACKS,Tracks -|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-
A,.15,[TRACK1,ltypeshp.shx,s=.25],.15
*BATTING,Batting SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS
A,.0001,-.1,[BAT,ltypeshp.shx,x=-.1,s=.1],-.2,[BAT,ltypeshp.shx,r=180,x=.1,s=.1],-.1
*HOT_WATER_SUPPLY,Hot water supply ---- HW ---- HW ---- HW ----
A,.5,-.2,["HW",STANDARD,S=.1,U=0.0,X=-0.1,Y=-.05],-.2
*GAS_LINE,Gas line ----GAS----GAS----GAS----GAS----GAS----GAS--
A,.5,-.2,["GAS",STANDARD,S=.1,U=0.0,X=-0.1,Y=-.05],-.25
*ZIGZAG,Zig zag /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
A,.0001,-.2,[ZIG,ltypeshp.shx,x=-.2,s=.2],-.4,[ZIG,ltypeshp.shx,r=180,x=.2,s=.2],-.2

;; User Defined Linetypes
;;
;; Add any linetypes that you define to this section of
;; the file to ensure that they migrate properly when
;; upgrading to a future AutoCAD version. If duplicate
;; linetype definitions are found in this file, items
;; in the User Defined Linetypes section take precedence
;; over definitions that appear earlier in the file.
;;

Loading

0 comments on commit 03c4586

Please sign in to comment.