<?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: Vertices or Grip Points of MULTILEADER in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/vertices-or-grip-points-of-multileader/m-p/13436033#M293</link>
    <description>&lt;P&gt;Well, following code works for me with a simple MLeader entity as shown in picture below:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="normanyuan_0-1745253314963.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1491488iF623779B4467D8D4/image-size/medium?v=v2&amp;amp;px=400" role="button" title="normanyuan_0-1745253314963.png" alt="normanyuan_0-1745253314963.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt;        [CommandMethod("MLTest")]
        public static void TestMLeader()
        {
            var dwg = CadApp.DocumentManager.MdiActiveDocument;
            var ed = dwg.Editor;

            var res = ed.GetEntity("\nSelect an MLEADER entity:");
            if (res.Status == PromptStatus.OK)
            {
                using (var tran = dwg.TransactionManager.StartTransaction())
                {
                    var mleader = (MLeader)tran.GetObject(res.ObjectId, OpenMode.ForRead);

                    var leaderIndex = (int)mleader.GetLeaderIndexes()[0];

                    var leaderlineIndexes = mleader.GetLeaderLineIndexes(leaderIndex);
                    var leaderlineIndex = (int)leaderlineIndexes[0];

                    var firstVertex = mleader.GetFirstVertex(leaderlineIndex);
                    var lastVertex = mleader.GetLastVertex(leaderlineIndex);

                    ed.WriteMessage(
                        $"\nFirst vertex = {firstVertex.ToString()}");
                    ed.WriteMessage(
                        $"\nLast vertex = {lastVertex.ToString()}");

                    var vertex = mleader.GetVertex(leaderlineIndex, 0);
                    ed.WriteMessage(
                        $"\nFirst vertex of the first leader line = {vertex.ToString()}");

                    tran.Commit();
                }
            }
        }&lt;/LI-CODE&gt;
&lt;P&gt;Basically, you need to call GetLeaderIndexes() and GetLeaderLineIndexes() to see if there is how many leaders and how many leader lines. there could be leader only (i.e. a leader without leader line). Since you need to get vertex on LEADERLINE, there must be at least one LeaderLine for your code to work.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 21 Apr 2025 16:40:43 GMT</pubDate>
    <dc:creator>norman.yuan</dc:creator>
    <dc:date>2025-04-21T16:40:43Z</dc:date>
    <item>
      <title>Vertices or Grip Points of MULTILEADER</title>
      <link>https://forums.autodesk.com/t5/net-forum/vertices-or-grip-points-of-multileader/m-p/13432545#M290</link>
      <description>&lt;P&gt;Hi Team, I have to get the vertices or Grip points of a&amp;nbsp;MULTILEADER and looking for C# code for that.&lt;/P&gt;</description>
      <pubDate>Fri, 18 Apr 2025 12:27:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/vertices-or-grip-points-of-multileader/m-p/13432545#M290</guid>
      <dc:creator>subash.nalla</dc:creator>
      <dc:date>2025-04-18T12:27:42Z</dc:date>
    </item>
    <item>
      <title>Re: Vertices or Grip Points of MULTILEADER</title>
      <link>https://forums.autodesk.com/t5/net-forum/vertices-or-grip-points-of-multileader/m-p/13432832#M291</link>
      <description>&lt;P&gt;Have you looked into/tried with &lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;MLeader.GetVertex(int, int)&amp;nbsp;&lt;/STRONG&gt;&lt;FONT color="#000000"&gt;? You may also need to look into MLeader.GetFirst[Last]Vertex(int).&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 18 Apr 2025 16:15:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/vertices-or-grip-points-of-multileader/m-p/13432832#M291</guid>
      <dc:creator>norman.yuan</dc:creator>
      <dc:date>2025-04-18T16:15:28Z</dc:date>
    </item>
    <item>
      <title>Re: Vertices or Grip Points of MULTILEADER</title>
      <link>https://forums.autodesk.com/t5/net-forum/vertices-or-grip-points-of-multileader/m-p/13435162#M292</link>
      <description>&lt;P&gt;Hi Norman. I have tried both options but getting the attached exception (Exception.PNG). Can you please suggest me what I am doing wrong here.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is my code, please let me know for any other information.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Entity ent = tr.GetObject(selObj.ObjectId, OpenMode.ForRead) as Entity;&lt;BR /&gt;MLeader mLeader = ent as MLeader;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Point3d pntFirst = mLeader.GetVertex(0, 0);&amp;nbsp; or&amp;nbsp;Point3d pntFirst = mLeader.GetFirstVertex(0);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am getting same exception for when tried using both options.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 21 Apr 2025 04:58:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/vertices-or-grip-points-of-multileader/m-p/13435162#M292</guid>
      <dc:creator>subash.nalla</dc:creator>
      <dc:date>2025-04-21T04:58:35Z</dc:date>
    </item>
    <item>
      <title>Re: Vertices or Grip Points of MULTILEADER</title>
      <link>https://forums.autodesk.com/t5/net-forum/vertices-or-grip-points-of-multileader/m-p/13436033#M293</link>
      <description>&lt;P&gt;Well, following code works for me with a simple MLeader entity as shown in picture below:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="normanyuan_0-1745253314963.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1491488iF623779B4467D8D4/image-size/medium?v=v2&amp;amp;px=400" role="button" title="normanyuan_0-1745253314963.png" alt="normanyuan_0-1745253314963.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt;        [CommandMethod("MLTest")]
        public static void TestMLeader()
        {
            var dwg = CadApp.DocumentManager.MdiActiveDocument;
            var ed = dwg.Editor;

            var res = ed.GetEntity("\nSelect an MLEADER entity:");
            if (res.Status == PromptStatus.OK)
            {
                using (var tran = dwg.TransactionManager.StartTransaction())
                {
                    var mleader = (MLeader)tran.GetObject(res.ObjectId, OpenMode.ForRead);

                    var leaderIndex = (int)mleader.GetLeaderIndexes()[0];

                    var leaderlineIndexes = mleader.GetLeaderLineIndexes(leaderIndex);
                    var leaderlineIndex = (int)leaderlineIndexes[0];

                    var firstVertex = mleader.GetFirstVertex(leaderlineIndex);
                    var lastVertex = mleader.GetLastVertex(leaderlineIndex);

                    ed.WriteMessage(
                        $"\nFirst vertex = {firstVertex.ToString()}");
                    ed.WriteMessage(
                        $"\nLast vertex = {lastVertex.ToString()}");

                    var vertex = mleader.GetVertex(leaderlineIndex, 0);
                    ed.WriteMessage(
                        $"\nFirst vertex of the first leader line = {vertex.ToString()}");

                    tran.Commit();
                }
            }
        }&lt;/LI-CODE&gt;
&lt;P&gt;Basically, you need to call GetLeaderIndexes() and GetLeaderLineIndexes() to see if there is how many leaders and how many leader lines. there could be leader only (i.e. a leader without leader line). Since you need to get vertex on LEADERLINE, there must be at least one LeaderLine for your code to work.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 21 Apr 2025 16:40:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/vertices-or-grip-points-of-multileader/m-p/13436033#M293</guid>
      <dc:creator>norman.yuan</dc:creator>
      <dc:date>2025-04-21T16:40:43Z</dc:date>
    </item>
    <item>
      <title>Re: Vertices or Grip Points of MULTILEADER</title>
      <link>https://forums.autodesk.com/t5/net-forum/vertices-or-grip-points-of-multileader/m-p/13436719#M294</link>
      <description>&lt;P&gt;Hi Norman, thanks for the code sample and looks like I am able to get the vertices now and only thing missing in my code was&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;var leaderlineIndex = (int)leaderlineIndexes[0];&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was passing leaderlineIndexes to find the first or last vertex.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Apr 2025 05:44:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/vertices-or-grip-points-of-multileader/m-p/13436719#M294</guid>
      <dc:creator>subash.nalla</dc:creator>
      <dc:date>2025-04-22T05:44:09Z</dc:date>
    </item>
  </channel>
</rss>

