<?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: Is there a way to return Points in a circle? in Civil 3D Customization Forum</title>
    <link>https://forums.autodesk.com/t5/civil-3d-customization-forum/is-there-a-way-to-return-points-in-a-circle/m-p/13229939#M804</link>
    <description>&lt;P&gt;Thank you so much for your reply! I initially thought it would be simple to select entities that touch or are contained within the circle, but after several days of searching, I realized there isn't a function for that. I also came to understand that the method you suggested seems to be the best approach. I really appreciate your help.&lt;/P&gt;</description>
    <pubDate>Wed, 25 Dec 2024 23:19:40 GMT</pubDate>
    <dc:creator>rampseeker</dc:creator>
    <dc:date>2024-12-25T23:19:40Z</dc:date>
    <item>
      <title>Is there a way to return Points in a circle?</title>
      <link>https://forums.autodesk.com/t5/civil-3d-customization-forum/is-there-a-way-to-return-points-in-a-circle/m-p/13226631#M801</link>
      <description>&lt;P&gt;I want to select only the points within a certain circle among the points on a certain layer.&lt;/P&gt;&lt;P&gt;What I initially thought was to store all the x,y coordinates of the points and then loop through and inspect all the point data when a circle is selected.&lt;BR /&gt;&amp;nbsp; However, this method seems to become more inefficient as there are more points.&lt;BR /&gt;If there is any other way, I would appreciate it if you could let me know.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="화면 캡처 2024-12-23 172028.png" style="width: 609px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1448563i340123DB7BE31F41/image-size/large?v=v2&amp;amp;px=999" role="button" title="화면 캡처 2024-12-23 172028.png" alt="화면 캡처 2024-12-23 172028.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="화면 캡처 2024-12-23 172615.png" style="width: 663px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1448564i903F980E8A6EB4EB/image-size/large?v=v2&amp;amp;px=999" role="button" title="화면 캡처 2024-12-23 172615.png" alt="화면 캡처 2024-12-23 172615.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Dec 2024 08:37:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/civil-3d-customization-forum/is-there-a-way-to-return-points-in-a-circle/m-p/13226631#M801</guid>
      <dc:creator>rampseeker</dc:creator>
      <dc:date>2024-12-23T08:37:55Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to return Points in a circle?</title>
      <link>https://forums.autodesk.com/t5/civil-3d-customization-forum/is-there-a-way-to-return-points-in-a-circle/m-p/13228682#M802</link>
      <description>&lt;P&gt;Here is Some code that i use in one of my plugins. In this example i just highlight the points you can change it to suite your needs:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="general"&gt; public static void SelectPointsInCircle()
 {
     Document doc = Application.DocumentManager.MdiActiveDocument;
     Editor ed = doc.Editor;
     Database db = doc.Database;

     try
     {
         // Prompt the user to select a circle
         PromptEntityOptions peo = new PromptEntityOptions("\nSelect a circle: ");
         peo.SetRejectMessage("\nThe selected object is not a circle.");
         peo.AddAllowedClass(typeof(Circle), false);
         PromptEntityResult per = ed.GetEntity(peo);

         if (per.Status != PromptStatus.OK) return;

         // Open the selected circle
         using (Transaction tr = db.TransactionManager.StartTransaction())
         {
             Circle circle = tr.GetObject(per.ObjectId, OpenMode.ForRead) as Circle;
             if (circle == null) return;

             Point3d center = circle.Center;
             double radius = circle.Radius;

             // Create a selection filter for Civil 3D points
             TypedValue[] filterList = new TypedValue[]
             {
                 new TypedValue((int)DxfCode.Start, "AECC_COGO_POINT")
             };
             SelectionFilter filter = new SelectionFilter(filterList);

             // Select all points in the drawing
             PromptSelectionResult psr = ed.SelectAll(filter);
             if (psr.Status != PromptStatus.OK)
             {
                 ed.WriteMessage("\nNo points found in the drawing.");
                 return;
             }

             SelectionSet selSet = psr.Value;
             ObjectIdCollection selectedPoints = new ObjectIdCollection();

             foreach (SelectedObject selObj in selSet)
             {
                 if (selObj != null)
                 {
                     CogoPoint point = tr.GetObject(selObj.ObjectId, OpenMode.ForRead) as CogoPoint;
                     if (point != null)
                     {
                         // Check if the point is within the circle
                         if (center.DistanceTo(point.Location) &amp;lt;= radius)
                         {
                             selectedPoints.Add(point.ObjectId);
                         }
                     }
                 }
             }

             // Highlight the selected points
             if (selectedPoints.Count &amp;gt; 0)
             {
                 foreach (ObjectId id in selectedPoints)
                 {
                     Entity entity = tr.GetObject(id, OpenMode.ForWrite) as Entity;
                     if (entity != null)
                     {
                         entity.Highlight();
                     }
                 }
                 ed.WriteMessage($"\n{selectedPoints.Count} points were selected within the circle.");
             }
             else
             {
                 ed.WriteMessage("\nNo points were found in the circle.");
             }

             tr.Commit();
         }
     }
     catch (System.Exception ex)
     {
         ed.WriteMessage($"\nError: {ex.Message}");
     }
 }&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 24 Dec 2024 16:29:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/civil-3d-customization-forum/is-there-a-way-to-return-points-in-a-circle/m-p/13228682#M802</guid>
      <dc:creator>Domzinator</dc:creator>
      <dc:date>2024-12-24T16:29:34Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to return Points in a circle?</title>
      <link>https://forums.autodesk.com/t5/civil-3d-customization-forum/is-there-a-way-to-return-points-in-a-circle/m-p/13228766#M803</link>
      <description>&lt;P&gt;hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/15547724"&gt;@rampseeker&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;you can basically filter all points that lies inside a rectangle of P1/P2 by checking (or selecting) points with &lt;STRONG&gt;&lt;EM&gt;x,y &amp;gt; P1 and &amp;lt; P2&lt;/EM&gt; &lt;/STRONG&gt;with simple math, then filter by the &lt;EM&gt;&lt;STRONG&gt;d &amp;lt;= r,&lt;/STRONG&gt;&lt;/EM&gt; where:&lt;BR /&gt;C = circle.CenterPoint&lt;BR /&gt;r = circle.Radius&lt;BR /&gt;P1.X = C.X - r&lt;BR /&gt;P1.Y = C.Y - r&lt;BR /&gt;P2.X = C.X + r&lt;BR /&gt;P2.Y = C.Y + r&lt;/P&gt;&lt;P&gt;d = distanceBetweeen(C, p)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;note that the first filtering can be done by fence selection by 4 points of the rectangle of P1/P2&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="essamsalah_0-1735062887143.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1448942i245D824A15022520/image-size/medium?v=v2&amp;amp;px=400" role="button" title="essamsalah_0-1735062887143.png" alt="essamsalah_0-1735062887143.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Dec 2024 18:04:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/civil-3d-customization-forum/is-there-a-way-to-return-points-in-a-circle/m-p/13228766#M803</guid>
      <dc:creator>essam-salah</dc:creator>
      <dc:date>2024-12-24T18:04:21Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to return Points in a circle?</title>
      <link>https://forums.autodesk.com/t5/civil-3d-customization-forum/is-there-a-way-to-return-points-in-a-circle/m-p/13229939#M804</link>
      <description>&lt;P&gt;Thank you so much for your reply! I initially thought it would be simple to select entities that touch or are contained within the circle, but after several days of searching, I realized there isn't a function for that. I also came to understand that the method you suggested seems to be the best approach. I really appreciate your help.&lt;/P&gt;</description>
      <pubDate>Wed, 25 Dec 2024 23:19:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/civil-3d-customization-forum/is-there-a-way-to-return-points-in-a-circle/m-p/13229939#M804</guid>
      <dc:creator>rampseeker</dc:creator>
      <dc:date>2024-12-25T23:19:40Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to return Points in a circle?</title>
      <link>https://forums.autodesk.com/t5/civil-3d-customization-forum/is-there-a-way-to-return-points-in-a-circle/m-p/13229944#M805</link>
      <description>&lt;P&gt;&amp;nbsp; Initially, I tried to filter the data using the method you suggested, but the issue was that all the points had to be loaded for the function to work. I was hoping there might be a way to simply check if any points existed among the entities within the circle. However, after searching for a few days, I realized that wasn't possible. Thank you so much for your reply.&lt;/P&gt;</description>
      <pubDate>Wed, 25 Dec 2024 23:24:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/civil-3d-customization-forum/is-there-a-way-to-return-points-in-a-circle/m-p/13229944#M805</guid>
      <dc:creator>rampseeker</dc:creator>
      <dc:date>2024-12-25T23:24:59Z</dc:date>
    </item>
  </channel>
</rss>

