|
| 1 | +# ACadSharp |
| 2 | + |
| 3 | +ACadSharp is a pure C# library to read/write cad files like dxf/dwg. |
| 4 | + |
| 5 | +## Quick Start |
| 6 | + |
| 7 | +### Read |
| 8 | + |
| 9 | +If you want to read a cad file you just need to pick the reader that matches the format, for dwg files you can use [`ACadSharp.IO.DwgReader`](https://github.com/DomCR/ACadSharp/wiki/ACadSharp.IO.DwgReader) or [`ACadSharp.IO.DxfReader`](https://github.com/DomCR/ACadSharp/wiki/ACadSharp.IO.DxfReader) for a dxf file. |
| 10 | + |
| 11 | +The following example shows how to use the `DwgReader` using the static `Read()` method, the `DxfReader` has the equivalent method as well. |
| 12 | + |
| 13 | +```C# |
| 14 | +CadDocument doc = DwgReader.Read(file); |
| 15 | +``` |
| 16 | + |
| 17 | +Both readers have a parameter to configure the reader behaviour and a notification system to log information about possible issues that may occur during the read operation, for more information check [CadReader](./CadReaderDocs.md). |
| 18 | + |
| 19 | +### Document operations |
| 20 | + |
| 21 | +Once you have read the [``CadDocument``](https://github.com/DomCR/ACadSharp/wiki/ACadSharp.CadDocument) or created a new one, you can perform any operation that you may need: |
| 22 | + |
| 23 | +- Check or modify the existing entities and extract any information like geometry, color, layer, lineType... |
| 24 | +- Create new entities in the model. |
| 25 | +- Create new table entries like Layers, LineTypes, Blocks... |
| 26 | +- Add, read or remove ``XData`` in any object in the document. |
| 27 | + |
| 28 | +For more information about how the CadDocument is structured check [CadDocument](./CadDocumentDocs.md). |
| 29 | + |
| 30 | +To understand the common properties of the different elements in the document check the documentation for the different types of objects: |
| 31 | +- [CadObject](./CadObjectDocs.md) |
| 32 | + - [Entity](./EntityDocs.md) |
| 33 | + - [NonGraphicalObject](./NonGraphicalObjectDocs.md) |
| 34 | + - [TableEntry](./TableEntryDocs.md) |
| 35 | + |
| 36 | +### Write |
| 37 | + |
| 38 | +Save your file using the [``DwgWriter``](https://github.com/DomCR/ACadSharp/wiki/ACadSharp.IO.DwgWriter) or [``DxfWriter``](https://github.com/DomCR/ACadSharp/wiki/ACadSharp.IO.DxfWriter) depending on the format that you want to use. |
| 39 | + |
| 40 | +```C# |
| 41 | +string file = "your file path"; |
| 42 | +DwgWriter.Write(file, doc); |
| 43 | +``` |
| 44 | + |
| 45 | +Similar as with the `CadReader` the `CadWriter` have a configuration and a notification system, for more information check [CadReader](./CadWriterDocs.md). |
0 commit comments