乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
楼主: hardwired

检查块是否存在..

[复制链接]

46

主题

118

帖子

23

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
291
发表于 2008-3-10 10:10:38 | 显示全部楼层
我是这样做的。可能有更好和/或更优雅的方式…
  1. On Error Resume Next
  2. Dim ss As AcadSelectionSet
  3. Set ss = ThisDrawing.SelectionSets.Item("abcd")
  4. If Err.Number  0 Then
  5.     Set ss = ThisDrawing.SelectionSets.Add("abcd")
  6.     Err.Clear
  7. Else
  8.     ss.Clear
  9. End If

回复

使用道具 举报

24

主题

1265

帖子

1028

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
362
发表于 2008-3-10 11:02:47 | 显示全部楼层
我不记得我从哪里得到这个,它可能来自前一阵子与RR的其他网站......或者它可能在其他地方
  1. Dim Mycollection As AcadSelectionSets
  2. Dim SSet1 As AcadSelectionSet
  3. ' first check if any ss exist and if they do, delete them
  4.         Set Mycollection = ThisDrawing.SelectionSets
  5.              For Each SSet1 In Mycollection
  6.                  If SSet1.Name = "MySS" Then
  7.                      ThisDrawing.SelectionSets.Item("MySS").Delete
  8.                      Exit For
  9.                  End If
  10.              Next

我通常将其放在我创建新选择集的部分之前
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-7-6 05:34 , Processed in 0.432905 second(s), 55 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表