明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1617|回复: 3

[符号表] 如何获得属性块的TAG不是value

[复制链接]
发表于 2013-10-14 23:04 | 显示全部楼层 |阅读模式
模型中已有属性块 blockId
我想获得该块属性的TAG 的字符串应该怎么写?
 楼主| 发表于 2013-10-15 08:54 | 显示全部楼层
                    BlockTableRecord btr = trans.GetObject(blockId, OpenMode.ForRead) as BlockTableRecord;
                    string tag = string.Empty;
                    if (btr.HasAttributeDefinitions)
                    {
                        foreach (ObjectId id in btr)
                        {
                            DBObject ent = trans.GetObject(id, OpenMode.ForRead) as DBObject;
                            if (ent is AttributeDefinition)
                            {
                                AttributeDefinition attdef = ent as AttributeDefinition;
                                tag = attdef.Tag;
                            }
                        }
                    }

自己解决了。。 留给后来人参考下   如果有更好的方法也请指导。。
发表于 2019-6-7 21:21 | 显示全部楼层
正好需要,参考一下
发表于 2021-4-30 08:14 | 显示全部楼层
正好需要,参考一下
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-4-20 10:49 , Processed in 0.286058 second(s), 27 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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