乐筑天下

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

属性杂耍。。

[复制链接]

154

主题

1274

帖子

8

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1936
发表于 2008-4-3 09:51:39 | 显示全部楼层 |阅读模式
您好,
我有一个标题栏,有7个可能的修订数据属性-REV1到REV7(以及修订者的首字母的7个可能属性-REVBY1到REVBY7),当布局在第8次修订7次时,当然没有更多的空间来添加最新的修订细节,所以我想通过编程删除第一个实例REV1和'分流器#039;所有其他的都在列表中,为最后一个版本7中的新细节留出了空间…
…因此,当它正常工作时,版本1中的内容被删除并替换为版本2中的内容,然后版本3中的内容现在变成了版本2,等等等等,布拉·亚达……实现这一点的最佳方法是什么?我是否需要循环遍历块的属性,将这些属性的文本字符串传递到字符串数组,然后再次循环遍历并以我需要的方式用数组中的内容替换文本字符串,然后将新的细节放入REV7 textstring中。
这个程序是我上载的程序的一部分,用于处理'布局、列表框和其他L字;我最近发布的线程(见下面的附加程序和测试图)已经完成,但想添加这一点,以真正完善它。
我知道我的代码很不整洁,我的方式'我做的事情可能有点笨拙,但我'我对这件事比较陌生,我所知道的一切都是自学成才的,都是从你们扔给我的残羹剩饭中学来的,所以我向你们道歉

本帖以下内容被隐藏保护;需要你回复后,才能看到!

游客,如果您要查看本帖隐藏内容请回复
回复

使用道具 举报

0

主题

3

帖子

3

银币

初来乍到

Rank: 1

铜币
3
发表于 2008-4-3 10:06:09 | 显示全部楼层
我不会'我甚至不能把它放到一个数组中。我会把所有的东西都放在一根绳子里,然后在需要的时候把绳子分开
是的,你的方法就是我的方法
回复

使用道具 举报

0

主题

9

帖子

4

银币

初来乍到

Rank: 1

铜币
9
发表于 2008-4-3 10:32:27 | 显示全部楼层
好的,谢谢。那么如何分割阵列呢?本人'我看过/听说过Split(),但你能简单地给我解释一下吗。这就像是通过检查逗号来分隔一种逗号分隔的列表吗&#039'
问题是,我不知道你是否'我检查了程序,但当我点击这个#039;完整表格#039;程序的一部分,i'我已经在一个循环中循环属性了,我可以在第一个主循环中再次(两次)循环属性吗,还是程序会抛出一个spaz?
回复

使用道具 举报

0

主题

7

帖子

4

银币

初来乍到

Rank: 1

铜币
7
发表于 2008-4-3 10:45:03 | 显示全部楼层
是的,你可以任意多次嵌套循环。我会创建一个用唯一字符分隔的字符串,或者是在实践中永远不会使用的字符串
[代码这将把所有属性值连接在一起。然后,当需要返回值时
  1. dim MyVals as variant
  2. MyVals = split(MyString,"#:#",,vbTextCompare)
这将为您提供一个基于零的值数组,编辑以更正代码
回复

使用道具 举报

0

主题

9

帖子

5

银币

初来乍到

Rank: 1

铜币
9
发表于 2008-4-3 11:02:28 | 显示全部楼层
示例
  1. Dim MyString As String
  2. Dim X As Integer
  3.     For X = 0 To 10
  4.         MyString = MyString & X & "#:#"
  5.     Next X
  6. Dim MyValues As Variant
  7.     MyValues = Split(MyString, "#:#", , vbTextCompare)
&nbsp
MyString then="0#:#1 35;:#:2 35;:35;#3 35#::4 35;5 35;6 35难:35;; 7 35安:35安:9 35纳:35纳什:10 35纳:35纳什
分割后,它变为
  1. MyValues(0) : "0"
  2. MyValues(1) : "1"
  3. MyValues(2) : "2"
  4. MyValues(3) : "3"
  5. MyValues(4) : "4"
  6. MyValues(5) : "5"
  7. MyValues(6) : "6"
  8. MyValues(7) : "7"
  9. MyValues(8) : "8"
  10. MyValues(9) : "9"
  11. MyValues(10) : "10"
  12. MyValues(11) : ""
回复

使用道具 举报

5

主题

16

帖子

8

银币

初来乍到

Rank: 1

铜币
39
发表于 2008-4-7 06:00:02 | 显示全部楼层
您好,
哈文#039;我还没有试过分裂的方法,但谢谢你提醒我,这看起来是一个很好的方法。本人'我现在坚持使用字符串数组,但有一次我'我再仔细研究一下分裂的事情,我'我将使用它。无论哪种方式,我在循环块的属性时遇到了问题,但以相反的方式循环。当然,您必须能够以相反的顺序循环属性(即:从Ubound到Lbound)。本人'我正在尝试,但在Select Case Attrib分流(CountV)上出错。标记字符串行(见下面的代码),带有一个
&039;下标超出范围#039
错误
  1. Public Sub SHUNT_REVS()
  2. ' *******************************************************
  3. 'Loop through titleblock once to get attribute values..
  4. Dim EntSHUNT As AcadObject
  5. Dim AttribSHUNT As Variant
  6. Dim CountV as Integer
  7. Dim REV7shunt(0 To 6) As String
  8. Dim REVBY7shunt(0 To 6) As String
  9. For Each EntSHUNT In ThisDrawing.PaperSpace
  10.     If EntSHUNT.EntityName = "AcDbBlockReference" Then
  11.         AttribSHUNT = EntSHUNT.GetAttributes
  12.         For CountV = UBound(AttribSHUNT) To LBound(AttribSHUNT)
  13.             Select Case AttribSHUNT(CountV).TagString
  14.             Case "REVBY7"
  15.                 REVBY7shunt(6) = AttribSHUNT(CountV).TextString 'Add this rev detail to the string array for if titleblock is full..
  16.                 AttribSHUNT(CountV).TextString = revBY ' Add newest detail to the 7th rev detail..
  17.             Case "REVBY6"
  18.                 REVBY7shunt(5) = AttribSHUNT(CountV).TextString 'Add this rev detail to the string array for if titleblock is full..
  19.                 AttribSHUNT(CountV).TextString = REVBY7shunt(6)
  20.             Case "REVBY5"
  21.                 REVBY7shunt(4) = attribZ(CountV).TextString 'Add this rev detail to the string array for if titleblock is full..
  22.                 attribZ(CountV).TextString = REVBY7shunt(5)
  23.             Case "REVBY4"
  24.                 REVBY7shunt(3) = AttribSHUNT(CountV).TextString 'Add this rev detail to the string array for if titleblock is full..
  25.                 AttribSHUNT(CountV).TextString = REVBY7shunt(4)
  26.             Case "REVby3"
  27.                 REVBY7shunt(2) = AttribSHUNT(CountV).TextString 'Add this rev detail to the string array for if titleblock is full..
  28.                 AttribSHUNT(CountV).TextString = REVBY7shunt(3)
  29.             Case "REVBY2"
  30.                 REV7shunt(1) = AttribSHUNT(CountV).TextString 'Add this rev detail to the string array for if titleblock is full..
  31.                 AttribSHUNT(CountV).TextString = REVBY7shunt(2)
  32.             Case "REVBY1"
  33.                 REVBY7shunt(0) = AttribSHUNT(CountV).TextString 'Add this rev detail to the string array for if titleblock is full..
  34.                 AttribSHUNT(CountV).TextString = REVBY7shunt(1)
  35.             Case "REV7"
  36.                 REV7shunt(6) = AttribSHUNT(CountV).TextString 'Add this rev detail to the string array for if titleblock is full..
  37.                 AttribSHUNT(CountV).TextString = UCase(revnumber) & " - " & UCase(revdetails) & " - " & Date ' Add newest detail to the 7th rev detail..
  38.             Case "REV6"
  39.                 REV7shunt(5) = AttribSHUNT(CountV).TextString 'Add this rev detail to the string array for if titleblock is full..
  40.                 AttribSHUNT(CountV).TextString = REV7shunt(6)
  41.             Case "REV5"
  42.                 REV7shunt(4) = AttribSHUNT(CountV).TextString 'Add this rev detail to the string array for if titleblock is full..
  43.                 AttribSHUNT(CountV).TextString = REV7shunt(5)
  44.             Case "REV4"
  45.                 REV7shunt(3) = AttribSHUNT(CountV).TextString 'Add this rev detail to the string array for if titleblock is full..
  46.                 AttribSHUNT(CountV).TextString = REV7shunt(4)
  47.             Case "REV3"
  48.                 REV7shunt(2) = AttribSHUNT(CountV).TextString 'Add this rev detail to the string array for if titleblock is full..
  49.                 AttribSHUNT(CountV).TextString = REV7shunt(3)
  50.             Case "REV2"
  51.                 REV7shunt(1) = AttribSHUNT(CountV).TextString 'Add this rev detail to the string array for if titleblock is full..
  52.                 AttribSHUNT(CountV).TextString = REV7shunt(2)
  53.             Case "REV1"
  54.                 REV7shunt(0) = AttribSHUNT(CountV).TextString 'Add this rev detail to the string array for if titleblock is full..
  55.                 AttribSHUNT(CountV).TextString = REV7shunt(1)
  56.             End Select
  57.         Next CountV
  58.     End If 'If entx is block..
  59. Next EntSHUNT
  60. End Sub
有什么想法吗?有什么问题吗
回复

使用道具 举报

0

主题

4

帖子

2

银币

初来乍到

Rank: 1

铜币
5
发表于 2008-4-7 08:23:46 | 显示全部楼层
我有039;t深入研究了代码,但尝试一下…
  1. For CountV = UBound(AttribSHUNT) To LBound(AttribSHUNT) Step -1
回复

使用道具 举报

0

主题

13

帖子

5

银币

初来乍到

Rank: 1

铜币
15
发表于 2008-4-7 10:01:20 | 显示全部楼层
现在明白了,再次感谢基思,你'你是个救生员
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-7-5 00:29 , Processed in 1.352775 second(s), 74 queries .

© 2020-2025 乐筑天下

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