Binding an xref to a drawing using the Bind method makes the xref a permanent part of the drawing and no longer an externally referenced file. The externally referenced information becomes a block. When the externally referenced drawing is updated, the bound xref is not updated. This process binds the entire drawing's database, including all of its dependent symbols.
Dependent symbols are named objects such as blocks, dimension styles, layers, linetypes, and text styles. Binding the xref allows named objects from the xref to be used in the current drawing.
The Bind method requires only one parameter: bPrefixName. If bPrefixName is set to TRUE, the symbol names of the xref drawing are prefixed in the current drawing with <blockname>$x$, where x is an integer that is automatically incremented to avoid overriding existing block definitions. If the bPrefixName parameter is set to FALSE, the symbol names of the xref drawing are merged into the current drawing without the prefix. If duplicate names exist, AutoCAD uses the symbols already defined in the local drawing. If you are unsure whether your drawing contains duplicate symbol names, it is recommended that you set bPrefixName to TRUE.
For more information on binding xrefs, see ÔÇťArchive Drawings That Contain External References (Bind)ÔÇŁ in the User's Guide.
This example attaches an external reference and then binds the external -reference to the drawing. This example uses the 3D House.dwg file found in the sample directory. If you do not have this image, or if it is located in a different directory, insert a valid path and file name for the PathName variable.
On Error GoTo ERRORHANDLER
' Define external reference to be inserted
Dim xrefHome As AcadBlock
Dim xrefInserted As AcadExternalReference
Dim insertionPnt(0 To 2) As Double
Dim PathName As String
insertionPnt(0) = 1
insertionPnt(1) = 1
insertionPnt(2) = 0
PathName = "c:/AutoCAD 2008/sample/3D House.dwg"
' Add the external reference
Set xrefInserted = ThisDrawing.ModelSpace. _
AttachExternalReference(PathName, "XREF_IMAGE", _
insertionPnt, 1, 1, 1, 0, False)
MsgBox "The external reference is attached."
' Bind the external reference definition
MsgBox "The external reference is bound."