乐筑天下

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

请教CAD屏幕选取一个块后,怎样获得它的属性,并存放在一个数组里.

[复制链接]

1

主题

2

帖子

1

银币

初来乍到

Rank: 1

铜币
6
发表于 2003-7-10 21:15:00 | 显示全部楼层 |阅读模式
回复

使用道具 举报

26

主题

3072

帖子

10

银币

社区元老

Rank: 75Rank: 75Rank: 75

铜币
3177
发表于 2003-7-11 12:31:00 | 显示全部楼层
你的数组指的是什么?
回复

举报

19

主题

143

帖子

8

银币

后起之秀

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

铜币
219
发表于 2003-7-11 13:10:00 | 显示全部楼层
什么意思?
回复

举报

1

主题

2

帖子

1

银币

初来乍到

Rank: 1

铜币
6
发表于 2003-7-11 20:23:00 | 显示全部楼层
Dim acadapp As AcadApplication                     '在屏幕上取块
    Set acadapp = GetObject(, "autocad.application")
    Dim acaddoc As AcadDocument
    Set acaddoc = acadapp.ActiveDocument
    Dim entityset As AcadSelectionSet
    'frm.hide
100    Set entityset = acaddoc.ActiveSelectionSet
    entityset.Clear
    entityset.SelectOnScreen
    If entityset.Count = 0 Or entityset.Count > 1 Then
    MsgBox "没有选择一个块或选择过多"
    GoTo 100
    End If                                          '下面是取所选择的块
    Dim obj As AcadEntity
    Dim varattributes As Variant
    Set obj = entityset.SelectOnScreen
    If obj.ObjectName = "VM" Then                  'VM是块的名称
    If .HasAttributes Then
    vaattributes = .GetAttributes
    End If
    End If
回复

举报

158

主题

2315

帖子

10

银币

顶梁支柱

Rank: 50Rank: 50

铜币
2951
发表于 2003-7-13 19:20:00 | 显示全部楼层
必须先定义一个二维数组
如:
Dim AttArray(1, UBound(vaattributes)) As Variant
然后在下面的循环中把属性填充到数组中:
       For J = 0 To UBound(vaattributes)
            AttArray(0,J)=vaattributes(J).TagString
            AttArray(1,J) = attvars(J).TextString
        Next
回复

举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-13 21:57 , Processed in 0.777820 second(s), 73 queries .

© 2020-2025 乐筑天下

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