find attribute definition value in one shot

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
hi,
I have a block definition which has 15 attribute definitions in my drawing. I need to know one of the attribute definition value of a block reference. In order to do that I have to loop all the attrribute collection of my block reference and load the object by its ID . this way, I have a performance problem. is there an easy way to find a block's attdef in one shot?
----------------------------------
here is my method:
public String GetAttDefOfABlock(BlockReference br,String attributeName)
{
String returnValue = "";
foreach (ObjectId id in br.AttributeCollection)
{
AttributeReference attRef = (AttributeReference)HandleToBlockReference(id.Handle.ToString()); // this line loads the object to get its value
if (attRef.Tag.ToString() == attributeName)
{
returnValue = attRef.TextString;
break;
}
}
return returnValue;
}