乐筑天下

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

[编程交流] 选择集属性

[复制链接]

9

主题

19

帖子

10

银币

初来乍到

Rank: 1

铜币
45
发表于 2022-7-6 12:01:17 | 显示全部楼层 |阅读模式
你好
 
希望有人能帮忙。
 
我创建了一个选择集,将属性块分组,并将数据存储在一个数组中。
 
我为实现两件事感到震惊,即:
 
1.textstring(0)所在的层
2、此文本字符串的颜色设置
 
这些值都出现在属性编辑器中,但我需要在我的用户表单中使用它们,以便进一步编辑。
 
希望有人能帮忙,希望我能充分解释我的问题。
 
到目前为止,我的代码是
 
  1. Option Explicit
  2. Dim intCode(1)              As Integer
  3. Dim varData(1)              As Variant
  4. Dim elem                    As AcadEntity
  5. Dim Array1                  As Variant
  6. Dim aCount                  As Long
  7. Dim RefNum                  As Long
  8. Dim RefEdit() As String
  9. Dim iNo As Integer
  10. Dim TotalRef As Long
  11. Dim x As Long
  12. Dim PrefixArray() As String
  13. Dim i As Long
  14. Dim count As Long
  15. Dim IsItThere As Boolean
  16. Dim MyLayer As AcadLayer
  17. Private Sub UserForm_Initialize()
  18. 'Gathers together all reference blocks
  19. intCode(0) = 0: varData(0) = "Insert"
  20. intCode(1) = 2: varData(1) = "REF1_50"
  21. TotalRef = AllSS(intCode, varData)
  22. ReDim RefEdit(0 To TotalRef, 0 To 6)
  23. For Each elem In ThisDrawing.SelectionSets.Item("TempSSet")
  24.        'Using IsItThere to eliminate duplicates from end result - This creates a new 2d array called prefixarray
  25.        IsItThere = False
  26.        Array1 = elem.GetAttributes
  27.        RefEdit(x, 0) = (Array1(0).TextString)
  28.        RefEdit(x, 1) = (Array1(1).TextString)
  29.        RefEdit(x, 2) = (Array1(2).TextString)
  30.        RefEdit(x, 3) = elem.Layer
  31.        [color=red]'RefEdit(x,4) = layer of textstring0 within elem block[/color]
  32. [color=red]       'RefEdit(x,5) = colour of textstring0 within elem block[/color]
  33. Next elem
  34. End Sub
  35. Sub SSClear()
  36. Dim SSS As AcadSelectionSets
  37.   On Error Resume Next
  38.   Set SSS = ThisDrawing.SelectionSets
  39.      If SSS.count > 0 Then
  40.         SSS.Item("TempSSet").Delete
  41.      End If
  42. End Sub
  43. Function AllSS(Optional grpCode As Variant, Optional dataVal As Variant) As Integer
  44.   Dim TempObjSS As AcadSelectionSet
  45.   SSClear
  46.   Set TempObjSS = ThisDrawing.SelectionSets.Add("TempSSet")
  47.         'pick selection set
  48.   If IsMissing(grpCode) Then
  49.      TempObjSS.Select acSelectionSetAll
  50.   Else
  51.      TempObjSS.Select acSelectionSetAll, , , grpCode, dataVal
  52.   End If
  53.   AllSS = TempObjSS.count
  54. End Function
回复

使用道具 举报

9

主题

19

帖子

10

银币

初来乍到

Rank: 1

铜币
45
发表于 2022-7-6 13:41:06 | 显示全部楼层
已经整理好了
 
轻松的时候你知道怎么做,应该先想到这一点!!
 
  1. RefEdit(x, 4) = (Array1(0).Layer)
  2.                                  RefEdit(x, 5) = (Array1(0).color)
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-5 10:18 , Processed in 0.597040 second(s), 56 queries .

© 2020-2025 乐筑天下

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