急~如何提取块属性值~
大侠们,谁能教一下如何在C#中提取图纸中块属性的值~~~~ 是不是用 Autodesk.AutoCAD.ApplicationServices.Application这些API,谁能帮忙写个详细的句子~~ 多谢了!!!<br/> 最好自己先看看手册public void test24()
{
Document doc = Application.DocumentManager.MdiActiveDocument;
Editor ed = doc.Editor;
Database db = doc.Database;
PromptEntityOptions opts = new PromptEntityOptions("\n选择一个块参照:");
opts.SetRejectMessage("错误的选择!");
opts.AddAllowedClass(typeof(BlockReference), false);
PromptEntityResult res = ed.GetEntity(opts);
if (res.Status != PromptStatus.OK)
return;
using (Transaction tr = db.TransactionManager.StartTransaction())
{
BlockReference bref = tr.GetObject(res.ObjectId, OpenMode.ForRead) as BlockReference;
foreach (ObjectId id in bref.AttributeCollection)
{
AttributeReference attref = tr.GetObject(id, OpenMode.ForRead) as AttributeReference;
ed.WriteMessage( "\n" + attref.TextString);
}
}
}
还是狐哥牛人一个. 发现狐哥最近很少上论坛了 这个东西好。
页:
[1]