I think the request is to batch process a collection of drawings and extract block attributes.
Refer here for code to open drawings:
http://forums.autodesk.com/t5/net/readdwgfile-side-database-correct-useage/td-p/5444657
And this may help for returning attributes and other block information:
<code>
// return csv string to write out to file
// specifically block name, attribute value and insert point (x,y,z)
public static string GetBlockInfo(Database pDb, Entity pEnt, string pstrAttTag)
{
string lstrReturnValue = string.Empty;
using (Transaction tr = pDb.TransactionManager.StartTransaction())
{
if (pEnt.GetType() == typeof(BlockReference))
{
// cast entity to a block reference
BlockReference br = pEnt as BlockReference;
// if successful, continue
if (br != null)
{
BlockTableRecord btr = tr.GetObject(br.BlockTableRecord, OpenMode.ForRead, false) as BlockTableRecord;
// get block name
string lstrBlockName = btr.Name;
// get attribute
string lstrAttValue = string.Empty;
Autodesk.AutoCAD.DatabaseServices.AttributeCollection attcol = br.AttributeCollection;
foreach (ObjectId attId in attcol)
{
AttributeReference attRef = tr.GetObject(attId, OpenMode.ForWrite) as AttributeReference;
if (pstrAttTag.Equals(attRef.Tag))
{
lstrAttValue = attRef.TextString;
}
}
// get insert point
Point3d lpntInsertPoint = br.Position;
// csv version
string lstrInsertPoint = lpntInsertPoint.X.ToString() + "," + lpntInsertPoint.Y.ToString() + "," + lpntInsertPoint.Z.ToString();
// assemble return string
lstrReturnValue = lstrInsertPoint + "," + lstrBlockName + "," + lstrAttValue;
}
}
tr.Commit();
}
return lstrReturnValue;
}
</code>
Dale
______________
Yes, I'm Satoshi.