Table of Contents

Class DxfDataLink

Namespace
GeometryHelper.Dxf
Assembly
GeometryHelper.dll

A DATALINK of a DXF file, as AutoCAD's DataLink: the link of a table's cells to the data of another file, a spreadsheet as a rule, kept under its name in the dictionary of data links (DataLinkDictionary, ACAD_DATALINK) and named by the cells of the tables it fills (GetDataLink(int, int)).

public sealed class DxfDataLink : DxfDBObject
Inheritance
DxfDataLink
Inherited Members

A link is read from the file, from R2007 (AC1021) on, which brought DATALINK: db.DataLinkDictionary["Parts"] is the link Parts. Only its name, the dictionary's entry, is set; the library makes no new link and changes no group of one, as no link it wrote has yet been opened in AutoCAD.

The DXF reference does not describe a DATALINK, and ezdxf keeps one as it reads it. The groups read are those LibreDWG gives AcDbDataLink: the data adapter (1), the description (300), the tooltip (301), the connection string (302), the options (90) and the update options (91); a 92 LibreDWG names no further, read here as which way the link was last updated; when (170 to 176: year, month, day, hour, minute, second, millisecond); a 177 LibreDWG calls the option of the paths; a 93 it names no further, read here as how the update went; and its status (304). AutoCAD 2021 writes them so, with no 70, and then the count (94) of the objects the link is tied to, each a 330: the table it fills and that table's TABLECONTENT, 94 2, 330 F6, 330 149; then what the link owns (360, 0 for nothing), and its custom data between 305 CUSTOMDATA, 1 DATAMAP_BEGIN, a count (90) and 309 DATAMAP_END. A table's link taken away (RemoveDataLink()) takes the table and what it owns out of that list, as AutoCAD's RemoveDataLink does.

The library does not read the source: updating a link, its source files and their paths, AutoCAD's Update, GetSourceFiles and RepathSourceFiles, are AutoCAD's data adapters' work, and are not here.

Properties

ConnectionString

Gets where the data is (group 302), as AutoCAD's ConnectionString: for a spreadsheet its file, its sheet and its cells, parts.xlsx!Sheet1!A1:B3; empty where the record gives none.

DataAdapterId

Gets the data adapter that reads the link's source (group 1), as AutoCAD's DataAdapterId: AcExcel for a spreadsheet; empty where the record gives none.

DataLinkOption

Gets how the link is kept (group 90), as AutoCAD's DataLinkOption: 3 for Anonymous and PersistCache; None where the record gives none.

Description

Gets the description of the link (group 300), as AutoCAD's Description; empty where the record gives none.

IsValid

Gets whether the link can be updated, as AutoCAD's IsValid tells it: it names a data adapter (DataAdapterId) and where its data is (ConnectionString), and is not erased. Whether the source is there is not looked at.

Name

Gets or sets the name of the link, as AutoCAD's Name: the name of its entry in the dictionary that holds it, such as Parts; null for a link in no dictionary.

ToolTip

Gets the tooltip the linked cells show (group 301), as AutoCAD's ToolTip, such as Data source file: parts.xlsx; empty where the record gives none.

UpdateOption

Gets how the link is updated (group 91), as AutoCAD's UpdateOption, the flags as one number; nought where the record gives none. LibreDWG's example gives 1 179 649: AutoCAD's SkipFormat (0x20000) and AllowSourceUpdate (0x100000) make 1 179 648, and the 0x1 left over is no flag of AutoCAD's UpdateOption.

Methods

GetTargets()

Gets the tables the link fills, as AutoCAD's GetTargets gives their ids: every table of the drawing, in model space, paper space or a block, a range of whose cells names the link, in the order of the blocks and of their entities; none for a link erased. The drawing is walked once.

GetUpdateStatus(out DxfUpdateDirection, out DateTime, out string)

Gets how the link was last updated, as AutoCAD's GetUpdateStatus: which way (group 92), when (170 to 176), how it went (93, nought for one that went well, as AutoCAD's ErrorStatus numbers it) and the message of that (the 304 before the count 94). LibreDWG names the 92 and the 93 no further, so which way and how it went are the library's reading of them. A link never updated, its year nought, gives MinValue.

ToString()

Gives the link as a line for debugging: its type, its handle and its name.