Table of Contents

CadDrawingFile

from OpenCAD2D import CadDrawingFile

class CadDrawingFile(System.Object) ยท CadDrawingFile in the .NET reference

The drawing files the presenter opens, attaches and inserts: a DWG, read by DwgReader, of AutoCAD 2000 to 2018, and a DXF. A file is read as a DWG where its first bytes say so ("AC1032" for AutoCAD 2018), whatever its name; a drawing saved to a name ending in .dwg is written by DwgWriter as a DWG of AutoCAD 2018, or of the older version asked for (2013, 2010, 2007, 2004 or 2000), any other name as a DXF.

Properties and fields

OpenFilter

.NET

OpenFilter: ClassVar[str]

The filter of the file dialogs that pick a drawing, DWG first as in AutoCAD 2021's Select File: Drawing (*.dwg), DXF (*.dxf), All files (*.*).

Methods

IsDrawingName

.NET

@staticmethod
def IsDrawingName(path: str) -> bool

Gets whether a file's name ends in .dwg or .dxf, of either case: plan.dwg and PLAN.DXF, not plan.dwt.

IsDwg

.NET

@staticmethod
def IsDwg(path: str) -> bool

Gets whether a file is a DWG: its first six bytes AC1 and three more digits, as "AC1015" of AutoCAD 2000 and "AC1032" of AutoCAD 2018 are. A DXF, of text or binary, never starts so.

Open

.NET

@staticmethod
def Open(path: str) -> DxfDatabase

Reads a drawing file as a database: a DWG by DwgReader.Open, any other file by DxfDatabase.Open.

@staticmethod
def Open(path: str, progress: System.IProgress[float]) -> DxfDatabase

Reads a drawing file as a database, as CadDrawingFile.Open does, telling how far it has got as a share from 0 to 1: in thousandths, never going back, 0 first and 1 once read. A DWG of 100 000 lines tells it some 1 000 times as its objects are read and its DXF made; a DXF, read at once from its bytes, tells 0 and 1.