Hello All, When I use the code as posted I get the attributes repeated for every instance of the block. I only want them once. I tried changing the way I retrieve the instance to btr by indexing into the blockTable as such; bt[blockName], however that approach never gets me an AcDbBlockReference. I have years of c# under my belt, but I'm new to AutoCAD.NET. Thanks in advance.
string BName = lstBlockName.SelectedItem.ToString();
BlockTable bt = (BlockTable)tr.GetObject(db.BlockTableId, OpenMode.ForRead);
//using the following with a foreach repeats the attributes for each instance of the block
// BlockTableRecord btr = (BlockTableRecord)tr.GetObject(bt[BlockTableRecord
BlockTableRecord btr = GetBtr(tr, BName, bt);
foreach (ObjectId bId in btr)
using (Entity ent = (Entity)tr.GetObject(bId, OpenMode.ForRead, false))
if (ent.GetRXClass().Name.ToString() == "AcDbBlockReference")
BlockReference br = (BlockReference)ent;
BlockTableRecord blkObj = (BlockTableRecord)tr.GetObject(br.BlockTableRecord
if ((blkObj.HasAttributeDefinitions) && (blkObj.Name == BName))
Access a broad range of knowledge to help get the most out of your products and services.