乐筑天下

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

正在检查块是否存在。。

[复制链接]

154

主题

1274

帖子

8

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1936
发表于 2008-3-10 10:10:38 | 显示全部楼层
Paul…让我看看我是否正确理解了你…a)你想知道一个块是否插入到图形中,b)你想填充一组文本框,如果是这样,使用Hendie提供的代码,sset1是保存AcadBlockReference的选择集。请记住,除非您绝对确定每个图形中只有一个该块的实例,否则该选择集中将有多个块
假设sset1中的图形中只有1个块
  1. If sset1.Count > 0 Then
  2.    Set BlockX = sset1.Item(0)
  3.    If BlockX.HasAttributes Then
  4.       attribX = BlockX.GetAttributes
  5.        For countz = LBound(attribX) To UBound(attribX)
  6.            Select Case attribX(countz).TagString
  7.                Case "FIX1"
  8.                    fx1descTXT.text = attribX(countz).TextString
  9.                Case "FIX2"
  10.                    fx2descTXT.text = attribX(countz).TextString
  11.                Case "FIX3"
  12.                    fx3descTXT.text = attribX(countz).TextString
  13.                Case "FIX4"
  14.                    fx4descTXT.text = attribX(countz).TextString
  15.                Case "FIX5"
  16.                    fx5descTXT.text = attribX(countz).TextString
  17.                Case "FIX6"
  18.                    fx6descTXT.text = attribX(countz).TextString
  19.                Case "FIX7"
  20.                    fx7descTXT.text = attribX(countz).TextString
  21.                Case "FIX8"
  22.                    fx8descTXT.text = attribX(countz).TextString
  23.                Case "FIX9"
  24.                    fx9descTXT.text = attribX(countz).TextString
  25.                Case "FIX10"
  26.                    fx10descTXT.text = attribX(countz).TextString
  27.                End Select
  28.        Next 'End countx HasAttributes check loop..
  29.    End If
  30. End If
我希望这能把事情弄清楚
回复

使用道具 举报

154

主题

1274

帖子

8

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1936
发表于 2008-3-10 11:02:47 | 显示全部楼层
如果有#039;一个图形中有多个'我需要将set BlockX和属性代码放入for next循环中。
回复

使用道具 举报

154

主题

1274

帖子

8

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1936
发表于 2008-3-10 13:34:11 | 显示全部楼层
大家干杯,让它像做梦一样工作。使用Hendie和039的组合;s和Keith#039;s代码,它的工作方式我需要它,但有#039;选择集总是有一件事,我陷入其中,永远记不起如何为其编码;检查集合是否首先存在的最佳方法和最简单方法;t完全不使用选择集,最后一个是很久以前的,所以可以'我不记得我用过什么,但是,我'我肯定我只是用了sset1。删除,但我可以#039;我不能让它工作,或者我把它放错地方了。。
回复

使用道具 举报

85

主题

404

帖子

7

银币

中流砥柱

Rank: 25

铜币
751
发表于 2008-3-10 14:07:16 | 显示全部楼层
我是这样做的。可能有更好和/或更优雅的方式…
  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
回复

使用道具 举报

85

主题

404

帖子

7

银币

中流砥柱

Rank: 25

铜币
751
发表于 2008-3-10 16:15:08 | 显示全部楼层
我可以'我不记得我从哪里得到这个,它可能是来自另一个有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 06:10 , Processed in 1.593926 second(s), 71 queries .

© 2020-2025 乐筑天下

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