Table of Contents

Method Read

Namespace
GeometryHelper.Dxf
Assembly
GeometryHelper.dll

Read(string, DxfReadOptions)

Reads a DXF file from a path.

public static DxfDocument Read(string path, DxfReadOptions options = null)

Parameters

path string

The path of the file.

options DxfReadOptions

How to read it; null reads it with the defaults of DxfReadOptions.

Returns

DxfDocument

The entities of the file and what it says of itself.

Remarks

The text of a file from R2007 on is UTF-8; that of an older one is in the code page its header names ($DWGCODEPAGE, ANSI_1252 when it names none), where the runtime has it: Windows-1252 always, and the others on .NET Framework, or on .NET (Core) once the caller has registered CodePagesEncodingProvider.Instance with RegisterProvider(EncodingProvider); without it such a file is read as Latin-1 with a warning. Letters beyond ASCII written as escapes, \U+00E9 for an e acute as DxfWriter writes them, are read as the letters.

Exceptions

ArgumentNullException

Thrown when the path is null.

FormatException

Thrown when the file is not a DXF, is binary, or is cut short, the message naming the line; or when its header names a code page that does not read each byte of ASCII as itself, such as UTF-16 or ISO-2022, the message naming the page.

IOException

Thrown when the file cannot be read.

Read(Stream, DxfReadOptions)

Reads a DXF file from a stream, from where the stream stands to its end.

public static DxfDocument Read(Stream stream, DxfReadOptions options = null)

Parameters

stream Stream

The stream; it is read to its end and left open.

options DxfReadOptions

How to read it; null reads it with the defaults of DxfReadOptions.

Returns

DxfDocument

The entities of the file and what it says of itself.

Remarks

The text is decoded as Read(string, DxfReadOptions) decodes a file's.

Exceptions

ArgumentNullException

Thrown when the stream is null.

FormatException

Thrown when the file is not a DXF, is binary, or is cut short, the message naming the line; or when its header names a code page that does not read each byte of ASCII as itself, such as UTF-16 or ISO-2022, the message naming the page.