Note If Merge is set to True and an entry is already present in the current drawing the method maps the external entry to the current drawing entry This is identical behavior to inserting block definitions that contain duplicate layers linetypes or text s

The following example binds the specified external reference using either style:

Public Sub TestBind() Dim strName As String Dim strOpt As String Dim objBlock As AcadBlock

On Error Resume Next

'' get input from user With ThisDrawing.Utility

'' get the block name .InitializeUserInput 1

strName = .GetString(True, vbCr & "External reference name: ") If Err Then Exit Sub

'' get the block definition

Set objBlock = ThisDrawing.Blocks.Item(strName)

'' exit if not found If Err Then

MsgBox "Unable to get block " & strName Exit Sub End If

'' exit if not an xref If Not objBlock.IsXRef Then

MsgBox "That is not an external reference" Exit Sub End If

'' get the option

.InitializeUserInput 1, "Prefix Merge"

strOpt = .GetKeyword(vbCr & "Dependent entries [Prefix/Merge]: ") If Err Then Exit Sub

'' perform the bind, using option entered objBlock.Bind ("Merge" = strOpt) End With End Sub

0 0

Post a comment