Reload Xrefs
From AutoCAD ActiveX
If someone modifies an externally referenced drawing while you are working on the host drawing to which that xref is attached, you can update that xref drawing using the Reload method. When you reload, the selected xref drawing is updated in your host drawing. Also, if you have unloaded an xref, you can choose to reload that externally referenced drawing at any time.
This example attaches an external reference and then reloads the external reference. 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.
Sub Ch10_ReloadingExternalReference()
On Error GoTo ERRORHANDLER
' Define external reference to be insertedDim xrefHome As AcadBlockDim xrefInserted As AcadExternalReferenceDim insertionPnt(0 To 2) As DoubleDim PathName As StringinsertionPnt(0) = 1insertionPnt(1) = 1insertionPnt(2) = 0PathName = "c:/AutoCAD 2009/sample/3D House.dwg"' Add the external reference to the blockSet xrefInserted = ThisDrawing.ModelSpace. _AttachExternalReference(PathName, "XREF_IMAGE", _insertionPnt, 1, 1, 1, 0, False)ZoomAllMsgBox "The external reference is attached."' Reload the external reference definitionThisDrawing.Blocks.Item(xrefInserted.name).ReloadMsgBox "The external reference is reloaded."Exit SubERRORHANDLER:MsgBox Err.DescriptionEnd Sub