明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1506|回复: 3

如何向集合里面加东西亚???

[复制链接]
发表于 2004-1-29 20:17:00 | 显示全部楼层 |阅读模式
提示: 作者被禁止或删除 内容自动屏蔽
发表于 2004-1-29 20:51:00 | 显示全部楼层
aaa是选择集的名称,第二次是因为aaa已经存在了,所以会出错!
发表于 2004-1-29 21:27:00 | 显示全部楼层
这样写代码,第一种方法:
  1. Sub a()
  2. Dim n As Integer
  3. n = ThisDrawing.SelectionSets.Count
  4. While (n > 0)
  5. If ThisDrawing.SelectionSets.Item(n - 1).Name = "aaa" Then
  6. ThisDrawing.SelectionSets.Item(n - 1).Delete
  7. n = n - 1
  8. End If
  9. Wend
  10. Dim aa As AcadSelectionSet
  11. Set longSelectionSet = ThisDrawing.SelectionSets.Add("aaa")
  12. longSelectionSet.SelectOnScreen
  13. End Sub
第二种方法:
  1. Sub a()
  2. On Error Resume Next
  3. Dim longSelectionSet As AcadSelectionSet
  4. ThisDrawing.SelectionSets("aaa").Delete
  5. If Error Then
  6. Err.Clear
  7. End If
  8. Set longSelectionSet = ThisDrawing.SelectionSets.Add("aaa")
  9. longSelectionSet.SelectOnScreen
  10. End Sub
发表于 2004-2-2 20:59:00 | 显示全部楼层
明经函数里有创建空的选择集的函数 已经有出错处理 你可以看看
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2025-2-22 05:27 , Processed in 0.159175 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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