- UID
- 795411
- 积分
- 3
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2019-12-26
- 最后登录
- 1970-1-1
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
本帖最后由 luq1979 于 2019-12-27 09:40 编辑
我初学CAD VBA,在选择集上遇到了问题,特向大家请教:
我用sSet.Select acSelectionSetCrossing, pt1, pt2,或者sset.Select acSelectionSetWindow , pt1, pt2,总是选不到任何东西,这是怎么回事呢?acSelectionSetAll才能选到东西。从网上复制的示例代码也一样,不知道问题出在哪?
这是一个简化的代码,画了3个圆,然后选择,查看选择集内实体数,显示为0:
Public Sub Test1()
Dim pt1(0 To 2) As Double
Dim pt2(0 To 2) As Double
Dim pt3(0 To 2) As Double
Dim pt4(0 To 2) As Double
Dim pt5(0 To 2) As Double
Dim obj As AcadObject
pt1(0) = 20: pt1(1) = 20: pt1(2) = 0
pt2(0) = 30: pt2(1) = 30: pt2(2) = 0
pt3(0) = 40: pt3(1) = 40: pt3(2) = 0
pt4(0) = 0: pt4(1) = 0: pt4(2) = 0
pt5(0) = 100: pt5(1) = 100: pt5(2) = 0
Call ThisDrawing.ModelSpace.AddCircle(pt1, 10)
Call ThisDrawing.ModelSpace.AddCircle(pt2, 15)
Call ThisDrawing.ModelSpace.AddCircle(pt3, 10)
On Error Resume Next
Dim sSet As AcadSelectionSet
If Not IsNull(ThisDrawing.SelectionSets.Item("mySelect")) Then
Set sSet = ThisDrawing.SelectionSets.Item("mySelect")
sSet.Delete
End If
Set sSet = ThisDrawing.SelectionSets.Add("mySelect")
sSet.Select acSelectionSetCrossing, pt4, pt5
MsgBox "选择集内实体数:" & sSet.Count
sSet.Delete
End Sub
这个问题已经困扰我几天了,哪位能指点一下?不胜感激!
|
|