怎样判断一个实体是不是在选择集里?
rt 可能要穷举。不知道是不是个好办法。
例如
dim a as acadEntity
dim s as acadSelectionset
set s="..."
For each Item in s
if a=item then msgbox "找到该实体"
Next
请大虾指教:能够直接实体间 用 a=item 么? 除非象在C中先将"="重载,否则不能用= Sub tt()
Dim ss As AcadSelectionSet
ThisDrawing.SelectionSets("Test").Delete
Set ss = ThisDrawing.SelectionSets.Add("Test")
ss.Select acSelectionSetAll
Dim a As AcadEntity, i As AcadEntity
Set a = ThisDrawing.ModelSpace(0)
For Each i In ss
If i Is a Then
MsgBox "OK"
Exit For
End If
Next i
End Sub 没有再简洁的方法了吗?
最好用一句语句来判断。 4楼已经很简洁,没有捷径,你可以把那些代码封装成一个函数。 可以遍历选择集,然后对比ID号进行判别! 谢谢各位提供这么多种方法。 终于找到二次开发的地方啦!小弟新来,大家多关照!
页:
[1]