求救:关于SelectAtPoint。多谢
我在编程中有这样一个问题:选择通过一个点的所有实体然后将这些实体放到选择集中
(图中有几条通过(10,10,0)的直线)
程序如下
Sub slectatp()
Dim sp As AcadSelectionSet
Set sp = ThisDrawing.SelectionSets.Add("myss")
Dim pointat(0 To 2) As Double
pointat(0) = 10: pointat(1) = 10: pointat(2) = 0#
myss.SelectAtPoint pointat
MsgBox "select: " & nl & CStr(myss.Count)
myss.hightlight (True)
End Sub
可是程序的运行结果却是
myss.SelectAtPoint pointat 一行有错object required
百思不得原因,希望斑竹帮忙。多谢!!! 声明的选择集的变量是sp,而后面使用的变量却是myss。因为myss没有声明也不是有效的选择集对象,所以在过一点选择时就出错了。 Sub select()
Dim sp As AcadSelectionSet
Set sp = ThisDrawing.SelectionSets.Add("myss")
Dim pointat(0 To 2) As Double
pointat(0) = 10: pointat(1) = 10: pointat(2) = 0#
sp.SelectAtPoint pointat
MsgBox "select: " & nl & CStr(sp.Count)Dim Entry As AcadEntity
i = 10 'red color
For Each Entry In sp
Entry.Color = i
Entry.Update
i = i + 1
Next Entry
sp.Delete' del select
End Sub
可以,我刚才试过!
不知道什么回事,我只能选择通过这点的一个对象,比如同一位置画的两个同样大小圆或者通过这点的圆和线
页:
[1]