public static List<AttributeInfo> GetAttrRefs(BlockReference blRef) { List<AttributeInfo> resVal = new List<AttributeInfo>(); if (blRef?.AttributeCollection != null) { foreach (ObjectId idAttrRef in blRef.AttributeCollection) { if (idAttrRef.IsErased) continue; using (var atrRef = idAttrRef.Open(OpenMode.ForRead, false, true) as AttributeReference) { if (atrRef.Visible) { AttributeInfo ai = new AttributeInfo(atrRef); resVal.Add(ai); } } } } return resVal; }
public static List<AttributeInfo> GetAttrDefs(ObjectId idBtr) { List<AttributeInfo> resVal = new List<AttributeInfo>(); if (!idBtr.IsNull) { using (var btr = idBtr.Open(OpenMode.ForRead) as BlockTableRecord) { foreach (var idEnt in btr) { using (var attrDef = idEnt.Open(OpenMode.ForRead, false, true) as AttributeDefinition) { if (attrDef != null && attrDef.Visible) { var attrDefInfo = new AttributeInfo(attrDef); resVal.Add(attrDefInfo); } } } } } return resVal; }