<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Get the Associated Leader from BlockReference in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/get-the-associated-leader-from-blockreference/m-p/10244455#M20202</link>
    <description>&lt;P&gt;Since using the .NET API it is not possible to get Leader associated with BlockReference, I am looking for alternatives.&lt;/P&gt;&lt;P&gt;It looks like the Leader is stored with a soft pointer in some dictionary.&lt;/P&gt;&lt;P&gt;How is it possible to obtain the Leader ObjectId associated with the BlockReference directly, without having to go through the entire database?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="BlockRefrence with Leader Associated" style="width: 632px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/907722iD7F77B0312651CDD/image-size/large?v=v2&amp;amp;px=999" role="button" title="Block with Leader Associated.JPG" alt="BlockRefrence with Leader Associated" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;BlockRefrence with Leader Associated&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;If anyone can help I am grateful.&lt;/P&gt;</description>
    <pubDate>Fri, 16 Apr 2021 14:22:15 GMT</pubDate>
    <dc:creator>Gepaha</dc:creator>
    <dc:date>2021-04-16T14:22:15Z</dc:date>
    <item>
      <title>Get the Associated Leader from BlockReference</title>
      <link>https://forums.autodesk.com/t5/net-forum/get-the-associated-leader-from-blockreference/m-p/9356194#M20199</link>
      <description>&lt;P&gt;This may seem like a stupid question but I found no solution in the research I did.&lt;BR /&gt;I can associate a Block with a leader like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;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()
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As I get the opposite? I have the block reference and want the leader associated with it.&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Mar 2020 19:21:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/get-the-associated-leader-from-blockreference/m-p/9356194#M20199</guid>
      <dc:creator>Gepaha</dc:creator>
      <dc:date>2020-03-03T19:21:53Z</dc:date>
    </item>
    <item>
      <title>Re: Get the Associated Leader from BlockReference</title>
      <link>https://forums.autodesk.com/t5/net-forum/get-the-associated-leader-from-blockreference/m-p/9357105#M20200</link>
      <description>&lt;P&gt;Since block references do not store information about objects that reference them the only way you can do that is by searching all leaders in the same space for the one whose Annotation property contains the ObjectId of the block reference.&lt;/P&gt;</description>
      <pubDate>Wed, 04 Mar 2020 08:31:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/get-the-associated-leader-from-blockreference/m-p/9357105#M20200</guid>
      <dc:creator>ActivistInvestor</dc:creator>
      <dc:date>2020-03-04T08:31:43Z</dc:date>
    </item>
    <item>
      <title>Re: Get the Associated Leader from BlockReference</title>
      <link>https://forums.autodesk.com/t5/net-forum/get-the-associated-leader-from-blockreference/m-p/9357382#M20201</link>
      <description>&lt;P&gt;Thank you very much for that answer.&lt;BR /&gt;I thought there might be a hidden method or property that I didn't know about.&lt;/P&gt;</description>
      <pubDate>Wed, 04 Mar 2020 11:00:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/get-the-associated-leader-from-blockreference/m-p/9357382#M20201</guid>
      <dc:creator>Gepaha</dc:creator>
      <dc:date>2020-03-04T11:00:59Z</dc:date>
    </item>
    <item>
      <title>Re: Get the Associated Leader from BlockReference</title>
      <link>https://forums.autodesk.com/t5/net-forum/get-the-associated-leader-from-blockreference/m-p/10244455#M20202</link>
      <description>&lt;P&gt;Since using the .NET API it is not possible to get Leader associated with BlockReference, I am looking for alternatives.&lt;/P&gt;&lt;P&gt;It looks like the Leader is stored with a soft pointer in some dictionary.&lt;/P&gt;&lt;P&gt;How is it possible to obtain the Leader ObjectId associated with the BlockReference directly, without having to go through the entire database?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="BlockRefrence with Leader Associated" style="width: 632px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/907722iD7F77B0312651CDD/image-size/large?v=v2&amp;amp;px=999" role="button" title="Block with Leader Associated.JPG" alt="BlockRefrence with Leader Associated" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;BlockRefrence with Leader Associated&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;If anyone can help I am grateful.&lt;/P&gt;</description>
      <pubDate>Fri, 16 Apr 2021 14:22:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/get-the-associated-leader-from-blockreference/m-p/10244455#M20202</guid>
      <dc:creator>Gepaha</dc:creator>
      <dc:date>2021-04-16T14:22:15Z</dc:date>
    </item>
    <item>
      <title>Re: Get the Associated Leader from BlockReference</title>
      <link>https://forums.autodesk.com/t5/net-forum/get-the-associated-leader-from-blockreference/m-p/10250038#M20203</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Someone to help?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Apr 2021 11:09:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/get-the-associated-leader-from-blockreference/m-p/10250038#M20203</guid>
      <dc:creator>Gepaha</dc:creator>
      <dc:date>2021-04-19T11:09:40Z</dc:date>
    </item>
    <item>
      <title>Re: Get the Associated Leader from BlockReference</title>
      <link>https://forums.autodesk.com/t5/net-forum/get-the-associated-leader-from-blockreference/m-p/10465860#M20204</link>
      <description>&lt;P&gt;I have tried several ways to get the Leader associated with the BlockReference and I have not been successful.&lt;/P&gt;&lt;P&gt;I'm trying to avoid runs through the entire database.&lt;/P&gt;&lt;P&gt;Somewhere the block stores the associated Leader information.&lt;/P&gt;&lt;P&gt;Can anyone help?&lt;/P&gt;</description>
      <pubDate>Tue, 13 Jul 2021 17:30:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/get-the-associated-leader-from-blockreference/m-p/10465860#M20204</guid>
      <dc:creator>Gepaha</dc:creator>
      <dc:date>2021-07-13T17:30:09Z</dc:date>
    </item>
  </channel>
</rss>

