明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1998|回复: 2

救急啊!!!!

[复制链接]
发表于 2002-4-27 11:08:00 | 显示全部楼层 |阅读模式
请问各位大侠
    怎样用VBA把已经插入的块的属性提取出来?例如,提出出来,用msgbox显示。
    请各位指点迷津。谢谢
发表于 2002-4-27 16:03:00 | 显示全部楼层

试试这段程序

Sub ShowBlockAttrib()
    Dim N, M, b As Integer
    Dim AttStr As String
    Dim Attrefs As Variant
    AttStr = ""

'定义选择集   
    Dim sset As AcadSelectionSet
    Set sset = ThisDrawing.SelectionSets.Add("SS3")
    sset.SelectOnScreen

'在选择集中找属性
    Dim Entry As AcadEntity
    For Each Entry In sset
        If Entry.ObjectName = "AcDbBlockReference" and Entry.HasAttributes Then
            AttStr = AttStr + Entry.Name + "图块中的属性有:" + Chr(13)
            Attrefs = Entry.GetAttributes
            For M = LBound(Attrefs) To UBound(Attrefs)
                AttStr = AttStr + Attrefs(M).TagString + " = " + Attrefs(M).TextString + Chr(13)
            Next M
            AttStr = AttStr + Chr(13)
        End If
    Next Entry

'显示
    b = MsgBox(AttStr)
'删除选择集
    sset.Delete
End Sub
 楼主| 发表于 2002-4-27 16:15:00 | 显示全部楼层

Thanks!

多谢
让我试试
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-9-30 20:20 , Processed in 0.166808 second(s), 26 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表