|
本人选择一个物体,并对其set xdata,其中data为“螺丝”,现在想用get xdata方法得到
“螺丝”,但msgbox 后是空的 ,请问为什么,程序如下,多谢各位
Public Sub xd()
Dim i As Integer, ssetobj As AcadSelectionSet, selobj As AcadEntity
Dim i1 As Integer, datatype(0) As Integer, data(0) As Variant, getobj As Variant, dattype As Variant, dat As Variant
i = ThisDrawing.SelectionSets.Count
While (i > 0)
If ThisDrawing.SelectionSets.Item(i - 1).Name = "xd" Then
ThisDrawing.SelectionSets.Item(i - 1).Delete
End If
i = i - 1
Wend
Set ssetobj = ThisDrawing.SelectionSets.Add("xd")
datatype(0) = 1001: data(0) = "螺丝"
For i1 = 0 To ssetobj.Count - 1
Set selobj = ssetobj.Item(i1)
selobj.SetXData datatype, data
getobj = selobj.GetXData("", dattype, dat)
Next
MsgBox getobj
End Sub
|
|