Table of Contents

Method BindXref

Namespace
GeometryHelper.Dxf
Assembly
GeometryHelper.dll

BindXref(DxfBlockTableRecord, DxfDatabase, bool)

Binds an external reference, as AutoCAD's BindXrefs binds one: its block made an ordinary block, its origin the base point of its drawing ($INSBASE) and its path kept, holding a copy of every entity of that drawing's model space, its INSERTs placing it as they placed the reference; and the records that drawing's entities draw by brought with them. Bound (insertBind false), each layer, linetype, text style, dimension style and named block of the drawing comes under the reference's name, \(0\) and its own, the 0 raised past a name the drawing has (GRID$1$WALL where GRID$0$WALL is taken), as AutoCAD 2021's -XREF Bind names them; layer 0, Defpoints, ByBlock, ByLayer and Continuous are this drawing's. Inserted (true), each keeps its own name and is merged by name, this drawing's own kept, as Insert(string, DxfDatabase, bool) merges them.

public void BindXref(DxfBlockTableRecord xrefBlock, DxfDatabase xrefDatabase, bool insertBind)

Parameters

xrefBlock DxfBlockTableRecord

The block of the external reference, of this drawing.

xrefDatabase DxfDatabase

The drawing it references, as read from its file; another than this one.

insertBind bool

Whether the records keep their own names (Insert) rather than coming under the reference's (Bind).

Remarks

The records the reference brought into this drawing (the layer GRID|WALL and the like, of the layer, linetype, text style and dimension style tables) take the new names in their places, with what this drawing set on them, as AutoCAD keeps a layer's colour changed in the drawing: GRID|WALL made red here becomes the red layer GRID$0$WALL, no longer of a reference, its AcXRefLayerPropertyOverride data taken out. Inserted, GRID|WALL becomes WALL, or goes where the drawing has a WALL of its own, what drew on it drawing on that. Blocks named after the reference are taken out, and come again from its drawing.

A drawing of a line on WALL, its base point (100, 50, 0), bound as GRID gives the block GRID drawn about (100, 50, 0) with the line on GRID$0$WALL. An external reference of the drawing an INSERT of its model space places comes with the INSERT, an external reference still, as Insert(string, DxfDatabase, bool) brings one, to be bound in its turn; one overlaid is left out, as a drawing that references this one does not see it. The drawing given is left as it is: it is copied, and the copy renamed. Every entity is checked before anything is written, as Insert checks it.

Exceptions

ArgumentNullException

Thrown when the block or the drawing is null.

ArgumentException

Thrown when the block is of another drawing or is no external reference; when the drawing is this one, or, inserted, has a block of the reference's name; or when this drawing cannot hold an entity of it, or a block of it inserts itself, as Insert refuses them. Nothing is written then.

InvalidOperationException

Thrown when the block is erased.