Table of Contents

Method AttachXref

Namespace
GeometryHelper.Dxf
Assembly
GeometryHelper.dll

AttachXref(string, string)

Attaches another drawing as an external reference, as AutoCAD's AttachXref: a block of the name given whose BLOCK is flagged an external reference (70 of 4) and names the drawing's path (its 1), with its BLOCK_RECORD from R13 on, and no entities: AutoCAD reads the drawing into it when it opens this one. An INSERT of the block places it, as new DxfBlockReference(position, xref) appended to model space; until then the block is Unreferenced.

public DxfBlockTableRecord AttachXref(string fileName, string blockName)

Parameters

fileName string

The path of the drawing, as it is to be written: absolute, or from the folder of this one.

blockName string

The name of the block.

Returns

DxfBlockTableRecord

The block.

Remarks

The drawing is not read: the block's origin is the origin, and its XrefStatus says whether the path names a file. db.AttachXref("column.dwg", "COLUMN") writes the BLOCK 2 COLUMN, 70 4, 3 COLUMN, 1 column.dwg.

Exceptions

ArgumentNullException

Thrown when the path or the name is null.

ArgumentException

Thrown when the path is empty or has a line break in it, or the name is one AutoCAD does not take or that of a block of the drawing already, letters of either case the same.

InvalidOperationException

Thrown when the drawing has no BLOCKS section.