# domcr/acadsharp architecture

> Architecture diagram of the GitHub repository domcr/acadsharp, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/domcr/acadsharp
- Repository: https://github.com/domcr/acadsharp

## Overview

ACadSharp is a .NET library for reading and writing DXF/DWG drawings and for creating or modifying drawing content. A typical workflow reads a file into a CadDocument, works with its entities and drawing tables, then writes a supported format. The README documents DXF ASCII/binary support, DWG reading and writing, geometry editing, and table control. The graph reflects those capabilities and the sampled document/entity/table structure; implementation details beyond the excerpts are not asserted.

Main entry points: [`src/ACadSharp/CadDocument.cs`](https://github.com/domcr/acadsharp/blob/master/src/ACadSharp/CadDocument.cs) (CAD document), [`src/ACadSharp/Entities/Entity.cs`](https://github.com/domcr/acadsharp/blob/master/src/ACadSharp/Entities/Entity.cs) (CAD entities), [`src/ACadSharp/IO/DwgReader.cs`](https://github.com/domcr/acadsharp/blob/master/src/ACadSharp/IO/DwgReader.cs) (DWG reader), [`src/ACadSharp/IO/DXF`](https://github.com/domcr/acadsharp/tree/master/src/ACadSharp/IO/DXF) (DXF reader)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_io["File I/O"]
  node_dxfread["DXF reader"]
  node_dwgread["DWG reader<br/>[DwgReader.cs]"]
  node_dxfwrite["DXF writer"]
  node_dwgwrite["DWG writer"]
end

subgraph group_model["Drawing Model"]
  node_document["CAD document<br/>[CadDocument.cs]"]
  node_blocks["Blocks and layouts<br/>[BlockRecord.cs]"]
end

subgraph group_geometry["Geometry"]
  node_entities["CAD entities<br/>[Entity.cs]"]
  node_line["Line entity<br/>[Line.cs]"]
end

subgraph group_settings["Drawing Settings"]
  node_layers["Layers<br/>[Layer.cs]"]
  node_linetypes["Line types<br/>[LineType.cs]"]
  node_textstyles["Text styles<br/>[TextStyle.cs]"]
  node_dimstyles["Dimension styles<br/>[DimensionStyle.cs]"]
  node_colors["Color values<br/>[Color.cs]"]
end

node_user(("CAD user"))

node_user -->|"reads DXF"| node_dxfread
node_user -->|"reads DWG"| node_dwgread
node_dwgread -->|"returns document"| node_document
node_user -->|"creates or edits"| node_document
node_document -->|"contains geometry"| node_entities
node_entities -->|"includes entities"| node_line
node_user -->|"modifies geometry"| node_entities
node_user -->|"controls tables"| node_blocks
node_user -->|"controls tables"| node_layers
node_user -->|"controls tables"| node_linetypes
node_user -->|"controls tables"| node_textstyles
node_user -->|"controls tables"| node_dimstyles
node_user -.->|"sets appearance"| node_colors
node_document -->|"writes DXF"| node_dxfwrite
node_document -->|"writes DWG"| node_dwgwrite

click node_dxfread "https://github.com/domcr/acadsharp/tree/master/src/ACadSharp/IO/DXF"
click node_dwgread "https://github.com/domcr/acadsharp/blob/master/src/ACadSharp/IO/DwgReader.cs"
click node_document "https://github.com/domcr/acadsharp/blob/master/src/ACadSharp/CadDocument.cs"
click node_entities "https://github.com/domcr/acadsharp/blob/master/src/ACadSharp/Entities/Entity.cs"
click node_line "https://github.com/domcr/acadsharp/blob/master/src/ACadSharp/Entities/Line.cs"
click node_blocks "https://github.com/domcr/acadsharp/blob/master/src/ACadSharp/Tables/BlockRecord.cs"
click node_layers "https://github.com/domcr/acadsharp/blob/master/src/ACadSharp/Tables/Layer.cs"
click node_linetypes "https://github.com/domcr/acadsharp/blob/master/src/ACadSharp/Tables/LineType.cs"
click node_textstyles "https://github.com/domcr/acadsharp/blob/master/src/ACadSharp/Tables/TextStyle.cs"
click node_dimstyles "https://github.com/domcr/acadsharp/blob/master/src/ACadSharp/Tables/DimensionStyle.cs"
click node_colors "https://github.com/domcr/acadsharp/blob/master/src/ACadSharp/Color.cs"
click node_dxfwrite "https://github.com/domcr/acadsharp/tree/master/src/ACadSharp/IO/DXF"
click node_dwgwrite "https://github.com/domcr/acadsharp/tree/master/src/ACadSharp/IO/DWG/DwgStreamWriters"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_dxfread,node_dwgread,node_dxfwrite,node_dwgwrite,node_user toneBlue
class node_document,node_blocks toneAmber
class node_entities,node_line toneMint
class node_layers,node_linetypes,node_textstyles,node_dimstyles,node_colors toneRose
```

## Components

### File I/O

- [DXF reader](https://github.com/domcr/acadsharp/tree/master/src/ACadSharp/IO/DXF): `src/ACadSharp/IO/DXF`
- [DWG reader](https://github.com/domcr/acadsharp/blob/master/src/ACadSharp/IO/DwgReader.cs): `src/ACadSharp/IO/DwgReader.cs`
- [DXF writer](https://github.com/domcr/acadsharp/tree/master/src/ACadSharp/IO/DXF): `src/ACadSharp/IO/DXF`
- [DWG writer](https://github.com/domcr/acadsharp/tree/master/src/ACadSharp/IO/DWG/DwgStreamWriters): `src/ACadSharp/IO/DWG/DwgStreamWriters`

### Drawing Model

- [CAD document](https://github.com/domcr/acadsharp/blob/master/src/ACadSharp/CadDocument.cs): `src/ACadSharp/CadDocument.cs`
- [Blocks and layouts](https://github.com/domcr/acadsharp/blob/master/src/ACadSharp/Tables/BlockRecord.cs): `src/ACadSharp/Tables/BlockRecord.cs`

### Geometry

- [CAD entities](https://github.com/domcr/acadsharp/blob/master/src/ACadSharp/Entities/Entity.cs): `src/ACadSharp/Entities/Entity.cs`
- [Line entity](https://github.com/domcr/acadsharp/blob/master/src/ACadSharp/Entities/Line.cs): `src/ACadSharp/Entities/Line.cs`

### Drawing Settings

- [Layers](https://github.com/domcr/acadsharp/blob/master/src/ACadSharp/Tables/Layer.cs): `src/ACadSharp/Tables/Layer.cs`
- [Line types](https://github.com/domcr/acadsharp/blob/master/src/ACadSharp/Tables/LineType.cs): `src/ACadSharp/Tables/LineType.cs`
- [Text styles](https://github.com/domcr/acadsharp/blob/master/src/ACadSharp/Tables/TextStyle.cs): `src/ACadSharp/Tables/TextStyle.cs`
- [Dimension styles](https://github.com/domcr/acadsharp/blob/master/src/ACadSharp/Tables/DimensionStyle.cs): `src/ACadSharp/Tables/DimensionStyle.cs`
- [Color values](https://github.com/domcr/acadsharp/blob/master/src/ACadSharp/Color.cs): `src/ACadSharp/Color.cs`

### Other components

- **CAD user**

## Connections

- CAD user → DXF reader: reads DXF (evidence: `README.md`)
- CAD user → DWG reader: reads DWG (evidence: `README.md`)
- DWG reader → CAD document: returns document (evidence: `README.md`)
- CAD user → CAD document: creates or edits (evidence: `README.md`)
- CAD document → CAD entities: contains geometry (evidence: `README.md`)
- CAD entities → Line entity: includes entities (evidence: `src/ACadSharp/Entities/Entity.cs`)
- CAD user → CAD entities: modifies geometry (evidence: `README.md`)
- CAD user → Blocks and layouts: controls tables (evidence: `README.md`)
- CAD user → Layers: controls tables (evidence: `README.md`)
- CAD user → Line types: controls tables (evidence: `README.md`)
- CAD user → Text styles: controls tables (evidence: `README.md`)
- CAD user → Dimension styles: controls tables (evidence: `README.md`)
- CAD user → Color values: sets appearance
- CAD document → DXF writer: writes DXF (evidence: `README.md`)
- CAD document → DWG writer: writes DWG (evidence: `README.md`)
