Detach method example

Sub DetachXRef_Example()

' This example adds and detaches an external reference using the MAP.DWG file.

' You may need to change the path and filename for your system.

    Dim insPt(0 To 2) As Double

    Dim insertedXRef As AcadExternalReference

    Dim sFullPathName As String: sFullPathName = "c:\map.dwg"

    Dim sXrefName As String: sXrefName = "The Map"

    insPt(0) = 0: insPt(1) = 0: insPt(2) = 0

    ' Add the external reference to the drawing

    Set insertedXRef = ThisDrawing.ModelSpace.AttachExternalReference( _

       sFullPathName, sXrefName, insPt, 1, 1, 1, 0, False)

    MsgBox "The external reference '" & sFullPathName & "' is attached as '" & sXrefName & "'."

    ' Detach the external reference definition

    Dim name As String

    name = insertedXRef.name

    ThisDrawing.Blocks.Item(name).Detach

    MsgBox "The external reference '" & sXrefName & "' is detached."

End Sub

 


Bricscad™ is commercialized by Bricsys NV. Bricsys NV and Vondle NV are fully owned subsidiaries of Menhirs NV. © 2001- Menhirs NV - All rights reserved.