通过AcadBlock读取TagString、TextString引用
各位大侠,小弟遇到一个问题,在C#、autocad 2011环境下,读取到AxDbDocument下的Blocks,但是如何取得块的引用属性呢(TagString、TextString)代码如下:
AxDbDocument dbxFile
AxDbDocument dbxFile;
AcadBlockReference cadRef;
object[] atts;
AcadAttributeReference att;
if(dbxFile != null)
{
dbxFile.Open(openDialog.FileName, null);
foreach(AcadBlock elem in dbxFile.Blocks)
{
{
//cadRef = (AcadBlockReference)elem;
MessageBox.Show(elem.Name + "__" + elem.Name + "__" + elem.Count.ToString());
for(int i = 0; i < elem.Count; i++)
{
if (elem.Item(i).EntityName == "AcDbBlockReference")
{
cadRef = (AcadBlockReference)elem.Item(i);
atts = (object[])cadRef.GetAttributes();
foreach (AcadObject o in atts)
{
att = (AcadAttributeReference)o;
if (att.TagString == "名称")
{
clsObjBlock theBlock = new clsObjBlock();
theBlock.Value = att.TextString; //显示块参照属性的tag和text的值
theList.add(theBlock); //添加到theList
break;
}
}
}
}
} 想取的是块的增强属性编辑器中的属性内容,谢谢大家帮忙 人家不是告诉你了吗!还要怎么帮忙啊! e688w 发表于 2011-6-6 12:53 static/image/common/back.gif
人家不是告诉你了吗!还要怎么帮忙啊!
???谁告诉我了
页:
[1]