Detachs an external reference (xref) from a drawing.
Syntax
XRef.Detach()
Where:
XRef is the name of the external reference to detach.
Detach method example
Private Sub Detach_Example()
' This example adds and detaches an external reference using the MAP.DWG ' file found in the Samples folder. You may need to change the path and filename for your system.
Dim insPt As CADopia.Point
Dim insertedXRef As CADopia.ExternalReference
Dim msg As String, PathName As String, XrefName As String
XrefName = InputBox("Type an XRef name")
Set insPt = Library.CreatePoint(1, 1, 0)
PathName = "c:\program files\CADopia\Samples\map.dwg"
' Add the external reference to the drawing
Set insertedXRef = ThisDocument.ModelSpace.AttachExternalReference(PathName, XrefName, insPt, 1, 1, 1, 0, False)
MsgBox "The external reference '" & insertedXRef.name & "' is attached."
' Detach the external reference definition
Dim name As String
name = insertedXRef.name
ThisDocument.Blocks.Item(name).Detach
MsgBox "The external reference '" & XrefName & "' is detached."
End Sub
Comments