明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 2376|回复: 3

求救:关于SelectAtPoint。多谢

[复制链接]
发表于 2003-5-8 10:15 | 显示全部楼层 |阅读模式
我在编程中有这样一个问题:选择通过一个点的所有实体
然后将这些实体放到选择集中
(图中有几条通过(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
百思不得原因,希望斑竹帮忙。多谢!!!
发表于 2003-5-8 12:52 | 显示全部楼层

变量有错

声明的选择集的变量是sp,而后面使用的变量却是myss。因为myss没有声明也不是有效的选择集对象,所以在过一点选择时就出错了。
发表于 2003-5-10 11:48 | 显示全部楼层

[原创]

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

可以,我刚才试过!

发表于 2019-11-1 10:54 | 显示全部楼层
本帖最后由 sunny_8848 于 2019-11-1 10:55 编辑
天罡 发表于 2003-5-10 11:48
Sub select()

Dim sp As AcadSelectionSet

不知道什么回事,我只能选择通过这点的一个对象,比如同一位置画的两个同样大小圆或者通过这点的圆和线
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-4-20 18:58 , Processed in 0.295249 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表