static ObjectId GetArrowObjectId(string newArrName)
{
ObjectId arrObjId = ObjectId.Null;
Document doc =
Application.DocumentManager.MdiActiveDocument;
Database db = doc.Database;
// Get the current value of DIMBLK
string oldArrName =
Application.GetSystemVariable(
"DIMBLK"
) as string;
// Set DIMBLK to the new style
// (this action may create a new block)
Application.SetSystemVariable(
"DIMBLK",
newArrName
);
// Reset the previous value of DIMBLK
if (oldArrName.Length != 0)
Application.SetSystemVariable(
"DIMBLK",
oldArrName
);
// Now get the objectId of the block
Transaction tr =
db.TransactionManager.StartTransaction();
using(tr)
{
BlockTable bt =
(BlockTable)tr.GetObject(
db.BlockTableId,
OpenMode.ForRead
);
arrObjId = bt[newArrName];
tr.Commit();
}
return arrObjId;
}