Message 1 of 6
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
This may seem like a stupid question but I found no solution in the research I did.
I can associate a Block with a leader like:
var doc = Application.DocumentManager.MdiActiveDocument;
var db = doc.Database;
using (Transaction tr = db.TransactionManager.StartTransaction())
{
var bt = (BlockTable)tr.GetObject(db.BlockTableId, OpenMode.ForRead);
var blkId = bt["Circle"];
var blkref = new BlockReference(new Point3d(0.5, 4, 0), blkId);
var ms = (BlockTableRecord)tr.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite);
ms.AppendEntity(blkref);
tr.AddNewlyCreatedDBObject(blkref, true);
var ldr = new Leader();
ldr.AppendVertex(new Point3d(0, 0, 0));
ldr.AppendVertex(new Point3d(0, 4, 0));
ms.AppendEntity(ldr);
tr.AddNewlyCreatedDBObject(ldr, true);
// associate the block to the leader
ldr.Annotation = blkref.ObjectId;
tr.Commit()
}
As I get the opposite? I have the block reference and want the leader associated with it.
Thanks in advance.
Solved! Go to Solution.