<?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: draw polyline realtime in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/draw-polyline-realtime/m-p/12429908#M6372</link>
    <description>&lt;P&gt;I tried it in both code blocks. It didn't work. I couldn't see any polylines on the screen. . He didn't draw. It just catches the point and continues... &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Sat, 09 Dec 2023 05:20:59 GMT</pubDate>
    <dc:creator>k005</dc:creator>
    <dc:date>2023-12-09T05:20:59Z</dc:date>
    <item>
      <title>draw polyline realtime</title>
      <link>https://forums.autodesk.com/t5/net-forum/draw-polyline-realtime/m-p/12428555#M6367</link>
      <description>&lt;P&gt;Hello friends,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I want to make an addition to this code. In that :&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;From the first point I clicked, it continues to draw the Polyline without leaving the point...&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;how can I do that?&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Thanks in advance to the helpful friend.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt; [CommandMethod("HesArea")]
        public void AreaCalc()
        {
            // Prompt the user for 5 points
            Document acDoc = Application.DocumentManager.MdiActiveDocument;
            PromptPointResult pPtRes;
            Point2dCollection colPt = new Point2dCollection();
            PromptPointOptions pPtOpts = new PromptPointOptions("");
            Application.SetSystemVariable("OSMODE", 32 | 1);
            BirimCeviri();
            // Prompt for the first point
            pPtOpts.Message = "\nİlk nokta &amp;gt; ";
            pPtRes = acDoc.Editor.GetPoint(pPtOpts);
            colPt.Add(new Point2d(pPtRes.Value.X, pPtRes.Value.Y));
            // Exit if the user presses ESC or cancels the command
            if (pPtRes.Status == PromptStatus.Cancel) return;
            pPtOpts.Message = "\ndiğer nokta &amp;gt;";
            pPtOpts.UseBasePoint = true;
            pPtOpts.AllowNone = true;
            while (true)
            {
                // Use the previous point as the base point
                pPtOpts.BasePoint = pPtRes.Value;
                pPtRes = acDoc.Editor.GetPoint(pPtOpts);
                // Break the loop if the user does not specify a point
                if (pPtRes.Status != PromptStatus.OK)
                    break;
                colPt.Add(new Point2d(pPtRes.Value.X, pPtRes.Value.Y));
            }

            using (Polyline acPoly = new Polyline())
            {
                int i = 0;
                foreach (Point2d point in colPt)
                {
                    acPoly.AddVertexAt(i, point, 0, 0, 0);
                }

                // Close the polyline
                acPoly.Closed = true;

                double al1 = acPoly.Area / Durum.BolenA;
                double cv1 = acPoly.Length / Durum.Bolen;

                string aLNSonuc = string.Format("\nAlan   : {1}          Uzunluk : {2}",
                Environment.NewLine, al1.ToString("F3") + " m²", cv1.ToString("F3") + " m");
                System.Windows.Forms.MessageBox.Show(aLNSonuc, "Sonuç");
                YaziOlustur("Alan : " + al1.ToString("F2") + " m²     Uzunluk : " + cv1.ToString("F2") + " m");
            }

        }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Dec 2023 14:34:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/draw-polyline-realtime/m-p/12428555#M6367</guid>
      <dc:creator>k005</dc:creator>
      <dc:date>2023-12-08T14:34:42Z</dc:date>
    </item>
    <item>
      <title>Re: draw polyline realtime</title>
      <link>https://forums.autodesk.com/t5/net-forum/draw-polyline-realtime/m-p/12428792#M6368</link>
      <description>&lt;P&gt;You probably want to study the topic of "Jig". Searching this forum and/or the net would bring you plenty of sample code to get started with.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Dec 2023 16:14:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/draw-polyline-realtime/m-p/12428792#M6368</guid>
      <dc:creator>norman.yuan</dc:creator>
      <dc:date>2023-12-08T16:14:15Z</dc:date>
    </item>
    <item>
      <title>Re: draw polyline realtime</title>
      <link>https://forums.autodesk.com/t5/net-forum/draw-polyline-realtime/m-p/12428965#M6369</link>
      <description>&lt;P&gt;Thanks. I will search&lt;/P&gt;</description>
      <pubDate>Fri, 08 Dec 2023 17:36:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/draw-polyline-realtime/m-p/12428965#M6369</guid>
      <dc:creator>k005</dc:creator>
      <dc:date>2023-12-08T17:36:03Z</dc:date>
    </item>
    <item>
      <title>Re: draw polyline realtime</title>
      <link>https://forums.autodesk.com/t5/net-forum/draw-polyline-realtime/m-p/12429137#M6370</link>
      <description>&lt;P&gt;I did it this way. However, the polyline does not appear on the screen.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;[CommandMethod("HesArea")]
public void AreaCalc()
{
    // Prompt the user for 5 points
    Document acDoc = Application.DocumentManager.MdiActiveDocument;
    Database acCurDb = acDoc.Database;
    Editor acEd = acDoc.Editor;

    PromptPointResult pPtRes;
    Point2dCollection colPt = new Point2dCollection();
    PromptPointOptions pPtOpts = new PromptPointOptions("");
    Application.SetSystemVariable("OSMODE", 32 | 1);
    BirimCeviri();

    // Prompt for the first point
    pPtOpts.Message = "\nİlk nokta &amp;gt; ";
    pPtRes = acDoc.Editor.GetPoint(pPtOpts);
    colPt.Add(new Point2d(pPtRes.Value.X, pPtRes.Value.Y));

    // Exit if the user presses ESC or cancels the command
    if (pPtRes.Status == PromptStatus.Cancel) return;

    pPtOpts.Message = "\ndiğer nokta &amp;gt;";
    pPtOpts.UseBasePoint = true;
    pPtOpts.AllowNone = true;

    while (true)
    {
        // Use the previous point as the base point
        pPtOpts.BasePoint = pPtRes.Value;
        pPtRes = acDoc.Editor.GetPoint(pPtOpts);

        // Break the loop if the user does not specify a point
        if (pPtRes.Status != PromptStatus.OK)
            break;

        colPt.Add(new Point2d(pPtRes.Value.X, pPtRes.Value.Y));
    }

    // Start a transaction
    using (Transaction acTrans = acCurDb.TransactionManager.StartTransaction())
    {
        // Open the BlockTable for read
        BlockTable acBlkTbl;
        acBlkTbl = acTrans.GetObject(acCurDb.BlockTableId,
                                      OpenMode.ForRead) as BlockTable;

        // Open the BlockTableRecord for write
        BlockTableRecord acBlkTblRec;
        acBlkTblRec = acTrans.GetObject(acBlkTbl[BlockTableRecord.ModelSpace],
                                        OpenMode.ForWrite) as BlockTableRecord;

        using (Polyline acPoly = new Polyline())
        {
            int i = 0;
            foreach (Point2d point in colPt)
            {
                acPoly.AddVertexAt(i, point, 0, 0, 0);
            }

            // Close the polyline
            acPoly.Closed = true;

            // Add the polyline to the drawing
            acBlkTblRec.AppendEntity(acPoly);
            acTrans.AddNewlyCreatedDBObject(acPoly, true);

            double al1 = acPoly.Area / Durum.BolenA;
            double cv1 = acPoly.Length / Durum.Bolen;

            string aLNSonuc = string.Format("\nAlan   : {1}          Uzunluk : {2}",
                Environment.NewLine, al1.ToString("F3") + " m²", cv1.ToString("F3") + " m");
            System.Windows.Forms.MessageBox.Show(aLNSonuc, "Sonuç");
            YaziOlustur("Alan : " + al1.ToString("F2") + " m²     Uzunluk : " + cv1.ToString("F2") + " m");
        }

        // Commit the changes and dispose of the transaction
        acTrans.Commit();
    }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Dec 2023 19:02:57 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/draw-polyline-realtime/m-p/12429137#M6370</guid>
      <dc:creator>k005</dc:creator>
      <dc:date>2023-12-08T19:02:57Z</dc:date>
    </item>
    <item>
      <title>Re: draw polyline realtime</title>
      <link>https://forums.autodesk.com/t5/net-forum/draw-polyline-realtime/m-p/12429403#M6371</link>
      <description>&lt;P&gt;Perhaps try incrementing the vertex node index&amp;nbsp; i&amp;nbsp; in the foreach statement&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;acPoly.AddVertexAt(i, point, 0, 0, 0);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Perhaps try something like :&amp;nbsp; ( untested )&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;acPoly.AddVertexAt(i++, point, 0, 0, 0);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 09 Dec 2023 08:02:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/draw-polyline-realtime/m-p/12429403#M6371</guid>
      <dc:creator>kerry_w_brown</dc:creator>
      <dc:date>2023-12-09T08:02:33Z</dc:date>
    </item>
    <item>
      <title>Re: draw polyline realtime</title>
      <link>https://forums.autodesk.com/t5/net-forum/draw-polyline-realtime/m-p/12429908#M6372</link>
      <description>&lt;P&gt;I tried it in both code blocks. It didn't work. I couldn't see any polylines on the screen. . He didn't draw. It just catches the point and continues... &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 09 Dec 2023 05:20:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/draw-polyline-realtime/m-p/12429908#M6372</guid>
      <dc:creator>k005</dc:creator>
      <dc:date>2023-12-09T05:20:59Z</dc:date>
    </item>
    <item>
      <title>Re: draw polyline realtime</title>
      <link>https://forums.autodesk.com/t5/net-forum/draw-polyline-realtime/m-p/12429938#M6373</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This works for me.&lt;BR /&gt;I've commented out unnecessary code . . .&amp;nbsp;&lt;BR /&gt;The code is essentially your last posted code with iteration of the vertex index in the foreach block in line 60&lt;/P&gt;&lt;P&gt;( as I previously posted )&lt;/P&gt;&lt;P&gt;and translation of the prompts to English.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;      [CommandMethod("Answer_1209")]

      public void AreaCalc()
      {
         // Prompt the user for 5 points
         Document acDoc = Application.DocumentManager.MdiActiveDocument;
         Database acCurDb = acDoc.Database;
         Editor acEd = acDoc.Editor;

         PromptPointResult pPtRes;
         Point2dCollection colPt = new Point2dCollection();
         PromptPointOptions pPtOpts = new PromptPointOptions("");
         Application.SetSystemVariable("OSMODE", 32 | 1);

         ////BirimCeviri();

         // Prompt for the first point
         pPtOpts.Message = "\nDraw Polyline First point &amp;gt; ";
         pPtRes = acDoc.Editor.GetPoint(pPtOpts);
         colPt.Add(new Point2d(pPtRes.Value.X, pPtRes.Value.Y));

         // Exit if the user presses ESC or cancels the command
         if (pPtRes.Status == PromptStatus.Cancel) return;

         pPtOpts.Message = "\nNextPoint &amp;gt;";
         pPtOpts.UseBasePoint = true;
         pPtOpts.AllowNone = true;

         while (true)
         {
            // Use the previous point as the base point
            pPtOpts.BasePoint = pPtRes.Value;
            pPtRes = acDoc.Editor.GetPoint(pPtOpts);

            // Break the loop if the user does not specify a point
            if (pPtRes.Status != PromptStatus.OK)
               break;

            colPt.Add(new Point2d(pPtRes.Value.X, pPtRes.Value.Y));
         }

         // Start a transaction
         using (Transaction acTrans = acCurDb.TransactionManager.StartTransaction())
         {
            // Open the BlockTable for read
            BlockTable acBlkTbl;
            acBlkTbl = acTrans.GetObject(acCurDb.BlockTableId,
                                          OpenMode.ForRead) as BlockTable;

            // Open the BlockTableRecord for write
            BlockTableRecord acBlkTblRec;
            acBlkTblRec = acTrans.GetObject(acBlkTbl[BlockTableRecord.ModelSpace],
                                            OpenMode.ForWrite) as BlockTableRecord;

            using (Polyline acPoly = new Polyline())
            {
               int i = 0;
               foreach (Point2d point in colPt)
               {
                  acPoly.AddVertexAt(i++, point, 0, 0, 0);
               }

               // Close the polyline
               acPoly.Closed = true;

               // Add the polyline to the drawing
               acBlkTblRec.AppendEntity(acPoly);
               acTrans.AddNewlyCreatedDBObject(acPoly, true);

               /*
               double al1 = acPoly.Area / Durum.BolenA;
               double cv1 = acPoly.Length / Durum.Bolen;

               string aLNSonuc = string.Format("\nAlan   : {1}          Uzunluk : {2}",
                   Environment.NewLine, al1.ToString("F3") + " m²", cv1.ToString("F3") + " m");
               System.Windows.Forms.MessageBox.Show(aLNSonuc, "Sonuç");
               YaziOlustur("Alan : " + al1.ToString("F2") + " m²     Uzunluk : " + cv1.ToString("F2") + " m");
               */
            }

            // Commit the changes and dispose of the transaction
            acTrans.Commit();
         }
      }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="kdub_nz_0-1702102605303.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1302801iFBE851F0A396167A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="kdub_nz_0-1702102605303.png" alt="kdub_nz_0-1702102605303.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 09 Dec 2023 06:21:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/draw-polyline-realtime/m-p/12429938#M6373</guid>
      <dc:creator>kerry_w_brown</dc:creator>
      <dc:date>2023-12-09T06:21:27Z</dc:date>
    </item>
    <item>
      <title>Re: draw polyline realtime</title>
      <link>https://forums.autodesk.com/t5/net-forum/draw-polyline-realtime/m-p/12430042#M6374</link>
      <description>&lt;P&gt;I compiled the code you sent. But the problem is;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;When I click on the first point and then click on the second point, I should see the polyline between the two points... Not when it ends...&lt;/P&gt;</description>
      <pubDate>Sat, 09 Dec 2023 08:59:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/draw-polyline-realtime/m-p/12430042#M6374</guid>
      <dc:creator>k005</dc:creator>
      <dc:date>2023-12-09T08:59:10Z</dc:date>
    </item>
    <item>
      <title>Re: draw polyline realtime</title>
      <link>https://forums.autodesk.com/t5/net-forum/draw-polyline-realtime/m-p/12430093#M6375</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/537692"&gt;@k005&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then do as suggested by&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/543921"&gt;@norman.yuan&lt;/a&gt;&amp;nbsp;, build a jig.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you study the code you posted you will easily see that it is not designed as a jig, but as a simple procedural method.&amp;nbsp; ie collect all the points , then create a closed polyline using the points.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There are many jig examples available in various forums and blogs.&lt;/P&gt;&lt;P&gt;This forum has several ( search&amp;nbsp;Polyline jig )&lt;/P&gt;&lt;P&gt;&lt;A href="https://disqus.com/by/keanw/" target="_blank" rel="noopener noreferrer"&gt;Kean Walmsley&lt;/A&gt;&amp;nbsp;has several&lt;/P&gt;&lt;P&gt;TheSwamp has several&lt;/P&gt;&lt;P&gt;forums.augi.com has several&lt;/P&gt;&lt;P&gt;Github has several&lt;/P&gt;&lt;P&gt;Perhaps a Google search for something like "Polyline jig AutoCAD C#" would be a good start&lt;/P&gt;&lt;P&gt;or try ChatGPT&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;</description>
      <pubDate>Sat, 09 Dec 2023 10:12:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/draw-polyline-realtime/m-p/12430093#M6375</guid>
      <dc:creator>kerry_w_brown</dc:creator>
      <dc:date>2023-12-09T10:12:43Z</dc:date>
    </item>
    <item>
      <title>Re: draw polyline realtime</title>
      <link>https://forums.autodesk.com/t5/net-forum/draw-polyline-realtime/m-p/12430104#M6376</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ok. Thanks.&lt;/P&gt;</description>
      <pubDate>Sat, 09 Dec 2023 10:07:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/draw-polyline-realtime/m-p/12430104#M6376</guid>
      <dc:creator>k005</dc:creator>
      <dc:date>2023-12-09T10:07:12Z</dc:date>
    </item>
    <item>
      <title>Re: draw polyline realtime</title>
      <link>https://forums.autodesk.com/t5/net-forum/draw-polyline-realtime/m-p/12430118#M6377</link>
      <description>&lt;P&gt;My goal is for the first code I sent to work like in this video...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 09 Dec 2023 10:19:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/draw-polyline-realtime/m-p/12430118#M6377</guid>
      <dc:creator>k005</dc:creator>
      <dc:date>2023-12-09T10:19:15Z</dc:date>
    </item>
    <item>
      <title>Re: draw polyline realtime</title>
      <link>https://forums.autodesk.com/t5/net-forum/draw-polyline-realtime/m-p/12430227#M6378</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;You should be able to draw inspiration from &lt;A href="https://forums.autodesk.com/t5/net/polyline-jig-displaying-drawn-segments-of-polyline/m-p/9951255/highlight/true#M67665" target="_blank" rel="noopener"&gt;this answer&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Sat, 09 Dec 2023 12:42:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/draw-polyline-realtime/m-p/12430227#M6378</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2023-12-09T12:42:28Z</dc:date>
    </item>
    <item>
      <title>Re: draw polyline realtime</title>
      <link>https://forums.autodesk.com/t5/net-forum/draw-polyline-realtime/m-p/12431348#M6379</link>
      <description>&lt;P&gt;Yes, I compiled the code. This is the code I'm looking for. Thank you master.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;* I'll try merging it with my previous code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;**************************************************************&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I combined it. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp; &lt;span class="lia-unicode-emoji" title=":hugging_face:"&gt;🤗&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 10 Dec 2023 12:49:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/draw-polyline-realtime/m-p/12431348#M6379</guid>
      <dc:creator>k005</dc:creator>
      <dc:date>2023-12-10T12:49:22Z</dc:date>
    </item>
  </channel>
</rss>

