Table of Contents

Class DwgDocument

Namespace
DwgIO
Assembly
DwgIO.dll

An opened Autodesk DWG file parsed without AutoCAD installed. Exposes version info, the named-section catalog and per-section decompressed reads.

public sealed class DwgDocument

Inheritance

Inherited Members

Properties

AppInfo

Producer information from AcDb:AppInfo, when present.

public DwgAppInfo? AppInfo { get; }

Property Value

DwgAppInfo?

ContainerHeader

The decrypted file header (R2004-family files only).

public DwgContainerHeader? ContainerHeader { get; }

Property Value

DwgContainerHeader?

Diagnostics

Best-effort parse failures collected while opening (section name → message).

public IReadOnlyList<string> Diagnostics { get; }

Property Value

IReadOnlyList<string>

Entities

Decoded entities with geometry (LINE/CIRCLE/ARC/POINT) — requires ReadObjects.

public IReadOnlyList<DwgEntity> Entities { get; }

Property Value

IReadOnlyList<DwgEntity>

FileDepList

External file dependencies from AcDb:FileDepList, when present.

public DwgFileDepList? FileDepList { get; }

Property Value

DwgFileDepList?

FileHeader

The parsed 128-byte shared file prefix (version, maintenance version, codepage).

public DwgFileHeader FileHeader { get; }

Property Value

DwgFileHeader

FileSize

Size of the file in bytes.

public long FileSize { get; }

Property Value

long

HandleMap

Handle→offset index from AcDb:Handles (R2004-family files, ReadObjects on).

public DwgHandleMap? HandleMap { get; }

Property Value

DwgHandleMap?

Objects

Object inventory from AcDb:AcDbObjects (framing + identity, bodies decode later).

public IReadOnlyList<DwgObjectInfo> Objects { get; }

Property Value

IReadOnlyList<DwgObjectInfo>

PageCount

Number of pages in the global page map (R2004-family files only).

public int? PageCount { get; }

Property Value

int?

Path

Absolute or relative path the document was opened from.

public string Path { get; }

Property Value

string

Preview

Embedded thumbnail from AcDb:Preview, when present.

public DwgPreview? Preview { get; }

Property Value

DwgPreview?

Sections

Named sections of the container, in section-map order (R2004-family files).

public IReadOnlyList<DwgSectionInfo> Sections { get; }

Property Value

IReadOnlyList<DwgSectionInfo>

SummaryInfo

Drawing metadata from AcDb:SummaryInfo, when the section exists (R2004-family files).

public DwgSummaryInfo? SummaryInfo { get; }

Property Value

DwgSummaryInfo?

Version

The DWG release identified from the file's version magic.

public DwgVersionInfo Version { get; }

Property Value

DwgVersionInfo

Methods

Open(string, DwgReaderOptions?)

Opens and parses a DWG file.

public static DwgDocument Open(string path, DwgReaderOptions? options = null)

Parameters

path string
options DwgReaderOptions?

Returns

DwgDocument

Exceptions

FileNotFoundException

The file does not exist.

DwgUnsupportedVersionException

The file's container is not implemented yet (R13-R2000, R2007).

DwgException

The file is corrupt or truncated.

ReadSection(string)

Reads and decompresses a named section (e.g. "AcDb:Header", "AcDb:SummaryInfo").

public byte[] ReadSection(string name)

Parameters

name string

Returns

byte[]