VBA sample

HomeHome BlogBlog TwitterTwitter YouTubeYouTube ContactContact
 
 
 

Blog Headlines


Subscribe to the blog


 
 

xref_test.dvb sample code for AutoCAD

XREF_test.dvb sample code determine if an Xref is Attached or Overlay

Sub xref_test()
    Dim ps_str As String
    Dim po_blk As AcadBlock
    Dim po_blkref As AcadBlockReference
    Dim pi_dxf70 As Integer
    Dim pv_1 As Variant
    Dim userr1 As Integer
    
    ThisDrawing.Utility.GetEntity po_blkref, pv_1
    
    userr1 = ThisDrawing.GetVariable("USERR1")
    Set po_blk = ThisDrawing.Blocks(po_blkref.Name)
    ps_str = "(SETVAR ""USERR1"" (cdr (assoc 70 (tblsearch ""BLOCK"" """ & po_blkref.Name & """)))) "
    ThisDrawing.SendCommand ps_str
    pi_dxf70 = ThisDrawing.GetVariable("USERR1")
    
    ps_str = "(SETVAR ""USERR1"" " & userr1 & ") "
    ThisDrawing.SendCommand ps_str
    
    If pi_dxf70 = 44 Then MsgBox "XREF " & po_blk.Name & " is Overlaid."
    If pi_dxf70 = 36 Then MsgBox "XREF " & po_blk.Name & " is Attached."
End Sub
 
© 2001-2014 JTB World. All rights reserved.