代码如下,手机打的,可能略有错误,麻烦各位帮忙看一下,感觉这个功能应该实现起来很简单啊,为什么取不到呢,谢谢大家了
我的想法是通过SelectionAtPoint方法把图块加进选择集
然后通过GetAttributes获取属性名称
现在ObjectName已经明确是BlockReference了
HasAttributes也是True
但是名称就是取不进varAttributes里
这是为什么呢…?
Private Sub CommandButton1_Click()
Me.Hide
inputp=ThisDrawing.Utility.Getpoint(,"getpoint")
Dim ssetObj As AcadSelectionSet
Dim ent as Object
Dim varAttributes As Variant
Dim I As Integer
Set ssetObj = ThisDrawing.SelectionSets.Add("temp")
ssetObj.SelectionAtPoint inputp
For Each ent In ssetObj
Msgbox ent.ObjectName
Msgbox ent.HasAttributes
varAttributes = ent.GetAttributes
For I = LBound(varAttributes) To UBound(varAttributes)
Msgbox varAttributes(I)
Next
Next
End Sub