Message 1 of 2
GetXData for all ACADPoints inside a block.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi All,
I have some data I want to extract from a dwg - I do it by creating a block, then adding an ACADPoint for each datapoint and then using the SetXdata method to add 8 len array to each ACAD point.
Now, I want to get the data out by using GetXData method on each ACAD point for the block, but am not able to access the ACAD points inside the block. I have tried a few things I found on this forum and others, but in vain.
Below is the example code, any help is appreciated.
Sub myFunc()
Dim blockRef As Object
Dim blockName As String
Dim blockFound As Boolean
' Set the block name you want to retrieve
blockName = "my-block"
blockFound = False
' Loop through the ModelSpace to find the block
For Each blockRef In ThisDrawing.ModelSpace
If blockRef.ObjectName = "AcDbBlockReference" Then
If blockRef.Name = blockName Then
' Block found, you can access its properties here
MsgBox "Block found: " & blockRef.Name
For Each obj In blockRef.Name
If Not IsNull(obj.GetXData) Then
xData = obj.GetXData
' Process the Xdata as needed
For i = LBound(xData) To UBound(xData)
Debug.Print xData(i)
Next i
End If
Next obj
blockFound = True
Exit For
End If
End If
Next blockRef
End Sub
I know that the easier solution is to store it as block attributes, but unfortunately I have to use AUTOCAD 2006 (for legacy reasons) for this task. And storing block attributes doesn't work in that version.
Thanks in advance!