Message 1 of 10
effective block of anonymous block
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi All
this function
public static string GetEffectiveName(BlockReference blkref)
{
string name;
using (Transaction acTrans = Autodesk.AutoCAD.ApplicationServices.Core.Application.DocumentManager.MdiActiveDocument.TransactionManager.StartTransaction())
{
BlockTableRecord btr = (BlockTableRecord)acTrans.GetObject(blkref.DynamicBlockTableRecord, OpenMode.ForRead);
name = btr.Name;
}
return name;
}return the name of effective name of anonymous block
iam trying to write this code
public static BlockReference GetEffectiveBlock(BlockReference blkref)
{
BlockReference blk;
using (Transaction acTrans = Autodesk.AutoCAD.ApplicationServices.Core.Application.DocumentManager.MdiActiveDocument.TransactionManager.StartTransaction())
{
Document doc = Application.DocumentManager.MdiActiveDocument;
Database db = doc.Database;
BlockTable bt = (BlockTable)acTrans.GetObject(db.BlockTableId, OpenMode.ForRead);
ObjectId idBTR = bt[GetEffectiveName(blkref)];
BlockTableRecord btr = acTrans.GetObject(idBTR, OpenMode.ForRead) as BlockTableRecord;
using (BlockReference brf = new BlockReference(new Point3d(0, 0, 0), idBTR))
{
blk = brf;
}
}
return blk;
}to return the refrence block of this block but it's doesn't work
any help ?