Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
b13d5d1
Bump Microsoft.NET.Test.Sdk from 18.11.1 to 18.12.0
dependabot[bot] Nov 18, 2026
c3899c6
Bump Microsoft.SourceLink.GitHub from 10.0.403 to 10.0.404
dependabot[bot] Nov 18, 2026
d3d1ada
Draw model space to SVG
mahach666 Nov 19, 2026
946d20c
Write a standalone HTML viewer of the drawing
mahach666 Nov 19, 2026
9dee879
Fix the entity colour index, invariant CLI numbers and inspect diagno…
mahach666 Nov 19, 2026
163ec6f
Resync the object walk at handle-map offsets and report gaps (#13)
mahach666 Nov 19, 2026
6d66bf5
Report skipped encrypted sections in Diagnostics and inspect (#38)
mahach666 Nov 19, 2026
ca4b62c
Give dwgio preview its own exit code for a missing thumbnail (#14)
mahach666 Nov 19, 2026
45288b7
Add --version/--help, an entities command and JSON to stdout
mahach666 Nov 19, 2026
970e93a
Fill DwgAppInfo.Product from the product XML's name attribute (#35)
mahach666 Nov 19, 2026
cf6967e
Parse the history and template sections (#36)
mahach666 Nov 20, 2026
f0b5bbd
Add DwgDocument.Open(Stream) (#37, first step)
mahach666 Nov 20, 2026
c0acbc5
Run the tests in CI on Linux and macOS; add the public fixture folder…
mahach666 Nov 20, 2026
2820153
Complete the fixed object type table (#20) and temper the AC1018 clai…
mahach666 Nov 20, 2026
025619d
Link the public fixture README through its GitHub URL
mahach666 Nov 20, 2026
f30167d
Link the public fixture README through its GitHub URL
mahach666 Nov 20, 2026
23c0847
Merge commit 'ce18d898f02a57e18a74ad14f60eaf511fd0b7aa' into codex/fi…
mahach666 Nov 20, 2026
6485730
Correct DWG export, metadata and fixture regressions
mahach666 Nov 20, 2026
bcddcab
Merge commit 'b13d5d13227d514e36c814b2cdf5c96b8240bb2d'; commit 'c389…
mahach666 Nov 20, 2026
22b3cfc
Apply protected ACL fixtures to both OBJ output files
mahach666 Nov 20, 2026
c3347cc
Merge pull request #63 from IOExtend/feat/20-39-type-table
mahach666 Nov 20, 2026
e7d26ef
Merge pull request #62 from IOExtend/feat/33-34-ci-and-public-fixtures
mahach666 Nov 20, 2026
d7562a5
Merge pull request #61 from IOExtend/feat/37-open-stream
mahach666 Nov 20, 2026
3bc5f00
Merge pull request #60 from IOExtend/feat/36-history-sections
mahach666 Nov 20, 2026
819a4ca
Merge pull request #59 from IOExtend/fix/35-appinfo-product
mahach666 Nov 20, 2026
a0fe8ea
Merge pull request #58 from IOExtend/feat/18-19-cli-entities-stdout
mahach666 Nov 20, 2026
c29a4db
Merge pull request #57 from IOExtend/fix/14-preview-exit-code
mahach666 Nov 20, 2026
fc4a34b
Merge pull request #56 from IOExtend/fix/38-encrypted-section-diagnos…
mahach666 Nov 20, 2026
060be4c
Merge pull request #55 from IOExtend/fix/13-object-stream-gaps
mahach666 Nov 20, 2026
df8d874
Merge pull request #54 from IOExtend/fix/entity-colour-locale-diagnos…
mahach666 Nov 20, 2026
ffafa58
Merge pull request #53 from IOExtend/feat/html-viewer
mahach666 Nov 20, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 1 addition & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [windows-latest]
os: [windows-latest, ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v7
Expand All @@ -31,14 +31,3 @@ jobs:
name: packages-${{ matrix.os }}
path: artifacts/*.nupkg
if-no-files-found: error

build-linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-dotnet@v6
with:
dotnet-version: |
8.0.x
10.0.x
- run: dotnet build src/DwgIO.Cli/DwgIO.Cli.csproj -c Release
45 changes: 45 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,25 @@ API between minor releases.
## [Unreleased]

### Added
- CI runs the tests on Linux and macOS as well as Windows (both target frameworks), replacing the Linux
build-only job (#34).
- `test-files/public`: the folder for committed redistributable test drawings, with the origin and licence
recorded next to each file; the fixture search includes it, so a committed drawing turns the skipped
fixture tests into real runs in CI (#33, infrastructure — the drawings themselves follow).
- `DwgDocument.Open(Stream, documentName?, options?)`: a drawing can now come from a stream (a network
handle, an archive entry, an already-open file). The stream is read to memory once, so the results are
identical to `Open(path)` on the same bytes; the unsupported-version message names the source (#37, first
step — reading data pages on demand remains open).
- `AcDb:RevHistory`, `AcDb:AuxHeader` and `AcDb:Template` parsing exposes the revision values, auxiliary
header and template description on `DwgDocument`, in JSON and in `dwgio inspect`. The undecoded
`AcDb:AppInfoHistory` section is exposed as decompressed bytes, with its size in JSON and CLI output (#36).
- Fixed object type names are available in `DwgObjectInfo.TypeName`, `dwgio inspect` and the JSON
`objects.byTypeName` field. Existing `objects.byType` keys are preserved (#20, fixed types only).
- `dwgio --version` and `--help` (and `-v`/`-h`) print the version and the usage with exit code 0; an unknown
option still exits 1 (#18).
- `dwgio entities <file.dwg> [--type LINE,CIRCLE] [--json]` lists decoded entities one line each or as a JSON
array, with the type filter validated against the known type names (#19). The JSON export writes to standard
output when the target is `-` (#19).
- `DwgIO.Scene` package: converts a drawing into a neutral [IOScene](https://www.nuget.org/packages/IOScene) scene
document, the shared scene model of the IOExtend tools. One element per decoded entity with the handle as
`SourceId`, line and point geometries scaled to metres (`DwgSceneOptions.LengthUnit`), ACI colours on the
Expand All @@ -16,8 +35,34 @@ API between minor releases.
- `DwgSceneExport.SaveObj`/`SaveGlb` write a drawing to Wavefront OBJ (with an adjacent MTL colour library,
written as a pair) and binary glTF (GLB) through the IOScene writers; `dwgio drawing.dwg out.obj` and
`dwgio drawing.dwg out.glb` dispatch by extension.
- `DwgSvgExporter` and `dwgio svg <file.dwg> <out.svg> [--scale n]` draw model space to SVG (#32): LINE,
CIRCLE, ARC and POINT in the top view with the y axis up, in their ACI colours, inside a view box that
contains every exported entity. Polylines, curves and text follow as the core decodes them.
- `DwgViewerExport.SaveViewer` and `dwgio drawing.dwg out.html` write a standalone interactive 3D HTML viewer
(the IOViewer WebGL runtime embedded with the IOScene scene document; no server, no external scripts).
- `dwgio inspect` is written through a `TextWriter`, so the report is testable directly.

### Fixed
- `DwgAppInfo.Product` is filled from the product XML's `name` attribute ("AutoCAD", "AutoCAD LT",
"Teigha(R)", ...), so `dwgio inspect` and the JSON export name the product instead of an empty string (#35).
- `dwgio preview` exits with code 5 when the drawing has no thumbnail, distinct from the parse-error code, and
reports a mismatch between the requested output extension and the image kind on standard error instead of
keeping both silent (#14).
- Encrypted sections (encryption flag 1) are reported in `Diagnostics` and by `dwgio inspect` (the section
table marks them) instead of being skipped silently; decrypting them remains out of scope (#38).
- Object stream: after a gap (a zero run or a broken record) the object walk resynchronises at the next
handle-map offset instead of stopping, and every early stop or skipped gap is reported in `Diagnostics`; the
inventory-versus-handle-map difference is reported as well, and `DwgHandleMap.Parse` reports truncated blocks
and drops negative offsets with a diagnostic (#13).
- Fixture tests skip drawings of an unsupported version and count them in the skip reason, so one AC1021 file
in the fixture folder does not fail every test (#17).
- Entity colour: the DXF 62 index takes the low 9 bits of the stored colour value, so BYLAYER (256) is reported
as 256 and not as 0 (which also means BYBLOCK) (#40). The JSON export writes `colorIndex` for BYBLOCK and
BYLAYER so they are distinguishable.
- `dwgio` formats counts and byte sizes invariantly; the output no longer follows the machine's digit grouping
(#15).
- `dwgio inspect` always prints the diagnostic total and the first diagnostics, whether or not any entity was
decoded (#16).
- Packed 16-bit and 32-bit integers in their full-width form are read little-endian. They were read with their bytes
reversed, so entity records that store a colour, extended data size or reactor count in that form were decoded from
the wrong bit position and failed or gave NaN or absurd coordinates (#7).
Expand Down
7 changes: 4 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@ facts as they are observed in DWG files, in your own words, in code comments,
documentation and commit messages.

Do not add vendor code, SDKs, SDK internals, headers or binaries, decompiled or
leaked source, or anything taken from analysing vendor binaries. Do not add DWG
or DXF drawings, customer data, or names, paths, sizes or other details of
leaked source, or anything taken from analysing vendor binaries.
Add DWG fixtures only under `test-files/public` and only when they meet its origin and licence rules.
Do not add other drawings, customer data, or names, paths, sizes or other details of
private sample drawings to the repository, including tests, comments and
documentation. Test inputs are built synthetically in the tests; tests that
need private drawings read them from the folder named by `DWGIO_TEST_FILES` and
Expand Down Expand Up @@ -87,7 +88,7 @@ Include:
- The build and test commands run, their results, and any skipped checks.
- Before and after output comparison results when the output is affected.

Do not add drawings, customer data, vendor code or binaries to the
Do not add private drawings, customer data, vendor code or binaries to the
repository. Keep private test drawings outside version control.

Write commit messages in the imperative mood, for example,
Expand Down
6 changes: 4 additions & 2 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,21 @@

<ItemGroup>
<!-- Build-time only. -->
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="10.0.403" />
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="10.0.404" />
</ItemGroup>

<ItemGroup>
<!-- Neutral scene model, referenced by DwgIO.Scene with a range whose upper bound is a prerelease.
IOScene.Formats (GLB and OBJ writers) ships as a preview and needs IOScene 0.1.1 or later. -->
<PackageVersion Include="IOScene" Version="[0.1.1, 0.2.0-0.0)" />
<PackageVersion Include="IOScene.Formats" Version="[0.1.0-preview.1]" />
<!-- Standalone WebGL HTML viewer generator; accepts IOScene scene documents directly. -->
<PackageVersion Include="IOViewer" Version="[0.3.1]" />
</ItemGroup>

<ItemGroup>
<!-- Test-only packages, pinned to exact versions (no floating ranges). -->
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="18.11.1" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="18.12.0" />
<PackageVersion Include="xunit" Version="2.9.3" />
<PackageVersion Include="xunit.runner.visualstudio" Version="4.0.1" />
</ItemGroup>
Expand Down
47 changes: 40 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ DwgIO is a .NET library and command line tool that reads Autodesk AutoCAD drawin
- Writes a JSON export of the metadata, the section catalog and the decoded entities.
- Converts a drawing into a neutral [IOScene](https://www.nuget.org/packages/IOScene) scene document (`DwgIO.Scene` package): geometry in metres, ACI entity colours, one element per entity with its handle.
- Exports the scene to Wavefront OBJ (with an MTL colour library) and binary glTF (GLB).
- Draws model space to SVG (`dwgio svg`): LINE, CIRCLE, ARC and POINT in the top view, in their ACI colours.
- Writes a standalone interactive 3D HTML viewer (`.html`): the WebGL viewer of [IOViewer](https://github.com/IOExtend/IOViewer) embedded with the scene, no server or external scripts.

## Install

Expand All @@ -30,7 +32,7 @@ dotnet add package DwgIO
dotnet add package DwgIO.Scene
```

The libraries target .NET 8 and .NET 10. They use managed code without native dependencies or Windows-only APIs and support Windows, Linux and macOS. Tests currently run on Windows.
The libraries target .NET 8 and .NET 10. They use managed code without native dependencies or Windows-only APIs and support Windows, Linux and macOS. Tests run on Windows, Linux and macOS.

## Command line

Expand All @@ -52,7 +54,7 @@ Write the decompressed bytes of one named section:
dwgio extract drawing.dwg AcDb:Header header.bin
```

Save the embedded thumbnail preview. Without an extension, `.png`, `.wmf` or `.bmp` is added to match the image:
Save the embedded thumbnail preview. Without an extension, `.png`, `.wmf` or `.bmp` is added to match the image; a mismatching extension is reported on standard error, and a drawing without a thumbnail exits with code 5:

```sh
dwgio preview drawing.dwg thumbnail
Expand All @@ -71,7 +73,32 @@ dwgio drawing.dwg drawing.obj # Wavefront OBJ + drawing.mtl with the ACI colou
dwgio drawing.dwg drawing.glb # binary glTF for viewers and web scenes
```

Errors go to standard error.
Draw model space to SVG (X to the right, Y up, ACI colours; `--scale` sets pixels per drawing unit):

```sh
dwgio svg drawing.dwg drawing.svg --scale 2
```

Open the drawing in a standalone interactive 3D HTML viewer:

```sh
dwgio drawing.dwg drawing.html
```

List the decoded entities, one line each, optionally filtered by type and as JSON:

```sh
dwgio entities drawing.dwg --type LINE,CIRCLE
dwgio entities drawing.dwg --json
```

The JSON export also writes to standard output when the target is `-`:

```sh
dwgio drawing.dwg - | jq .summaryInfo
```

`dwgio --version` prints the package version, `dwgio --help` the usage. Errors go to standard error.

### Exit codes

Expand All @@ -81,11 +108,12 @@ Errors go to standard error.
| 1 | The command line is wrong. |
| 2 | The input file does not exist. |
| 3 | The DWG version is not supported yet (R13 to R2000, R2007) or not recognised. |
| 4 | The file could not be parsed, the drawing has no thumbnail preview (`preview`), or an unexpected error occurred. |
| 4 | The file could not be parsed, or an unexpected error occurred. |
| 5 | The drawing has no thumbnail preview (`preview`). |

## Library

Open a drawing, list its sections and read one of them:
Open a drawing (from a path or from a stream — a network handle, an archive entry, an already-open file; the stream is read to memory once and `Open(Stream)` gives the same results as `Open(path)`), list its sections and read one of them:

```csharp
using System;
Expand All @@ -95,6 +123,9 @@ var doc = DwgDocument.Open("drawing.dwg");

Console.WriteLine($"{doc.Version.Release} ({doc.Version.Magic})");

// or from a stream:
// var doc = DwgDocument.Open(httpResponse.Content.ReadAsStream(), "remote.dwg");

foreach (var section in doc.Sections)
{
Console.WriteLine($"{section.Name,-24} {section.Size,12} bytes pages={section.PageCount}");
Expand Down Expand Up @@ -123,7 +154,7 @@ IOScene.SceneJson.Save(scene.Document, "drawing.scene.json");

Every coordinate is scaled to metres by `LengthUnit` (a DWG stores plain numbers, so the unit is a caller decision and `UnitAssumed` records it), each entity becomes an element with its handle as `SourceId`, and LINE, CIRCLE, ARC and POINT become line and point geometries with their ACI colour.

`DwgSceneExport` writes that scene out in the exchange formats: `SaveObj(document, "drawing.obj", options)` produces an OBJ with an adjacent MTL colour library (written as a pair, atomically), `SaveGlb(document, "drawing.glb", options)` produces binary glTF. Both return the same `DwgSceneResult` report.
`DwgSceneExport` writes that scene out in the exchange formats: `SaveObj(document, "drawing.obj", options)` produces an OBJ with an adjacent MTL colour library (with rollback if replacement fails), `SaveGlb(document, "drawing.glb", options)` produces binary glTF. Both return the same `DwgSceneResult` report.

The documentation site with the API reference is at <https://ioextend.github.io/DwgIO/>. [![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/IOExtend/DwgIO) offers an automatically generated overview of the repository.

Expand All @@ -142,6 +173,8 @@ The documentation site with the API reference is at <https://ioextend.github.io/
| Entity decoding: LINE, CIRCLE, ARC and POINT geometry | done (partial) |
| IOScene scene export (`DwgIO.Scene`): entities, geometry, ACI colours | done (partial) |
| OBJ and GLB export through the scene | done (partial) |
| SVG export of model space (`dwgio svg`) | done (partial) |
| Standalone HTML viewer export through IOViewer | done (partial) |
| AutoCAD 2007 container (AC1021) | planned |
| R13 to R2000 container (AC1012 to AC1015) | planned |

Expand All @@ -152,7 +185,7 @@ The documentation site with the API reference is at <https://ioextend.github.io/
| AC1012 | R13 | flat section locators | planned |
| AC1014 | R14 | flat section locators | planned |
| AC1015 | R2000 | flat section locators | planned |
| AC1018 | R2004 | paged, compressed sections | done |
| AC1018 | R2004 | paged, compressed sections | verified locally on real drawings |
| AC1021 | R2007 | Reed-Solomon coded pages | planned |
| AC1024 | R2010 | paged, compressed sections | done |
| AC1027 | R2013 | paged, compressed sections | done |
Expand Down
3 changes: 2 additions & 1 deletion docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ Sections are named as stored in the drawing, for example `AcDb:Header`, `AcDb:Cl
| 1 | The command line is wrong. |
| 2 | The input file does not exist. |
| 3 | The DWG version is not supported yet or not recognised. |
| 4 | The file could not be parsed, the drawing has no thumbnail preview (`preview`), or an unexpected error occurred. |
| 4 | The file could not be parsed, or an unexpected error occurred. |
| 5 | The drawing has no thumbnail preview (`preview`). |

## Library

Expand Down
Loading
Loading