<?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: TraceBoundary in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/traceboundary/m-p/11962835#M8845</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have drawn a closed boundary with several lines, and now I want to be able to click inside that boundary and get information about the lines that make up the boundary. For example, tell me that this boundary is made up of 4 lines, one of which is yellow, one is red, and two are white.&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="img.jpg" style="width: 496px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1214212i6E682D5E5617063D/image-size/large?v=v2&amp;amp;px=999" role="button" title="img.jpg" alt="img.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Sun, 14 May 2023 16:31:54 GMT</pubDate>
    <dc:creator>hakocivil</dc:creator>
    <dc:date>2023-05-14T16:31:54Z</dc:date>
    <item>
      <title>TraceBoundary</title>
      <link>https://forums.autodesk.com/t5/net-forum/traceboundary/m-p/11961758#M8840</link>
      <description>&lt;DIV class=""&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;PRE&gt;&lt;SPAN class=""&gt;Hello, I want to access the objects around it by clicking inside a limit in AutoCAD, for example, when I click inside a limit, I want to know if there is a line or polyline around it, what is its color.
I use TraceBoundary&lt;/SPAN&gt;&lt;/PRE&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Sat, 13 May 2023 17:10:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/traceboundary/m-p/11961758#M8840</guid>
      <dc:creator>hakocivil</dc:creator>
      <dc:date>2023-05-13T17:10:35Z</dc:date>
    </item>
    <item>
      <title>Re: TraceBoundary</title>
      <link>https://forums.autodesk.com/t5/net-forum/traceboundary/m-p/11962039#M8841</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/3699134"&gt;@hakocivil&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Wouldn't you iterate the collection returned, and decide, according to your requirements ?&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;// Determine the objects making up the boundary 

      DBObjectCollection objs =  _ed.TraceBoundary(ppr.Value, true);
      if (objs.Count &amp;gt; 0)
      {
          // . . . do your magic&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;</description>
      <pubDate>Sat, 13 May 2023 22:02:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/traceboundary/m-p/11962039#M8841</guid>
      <dc:creator>kerry_w_brown</dc:creator>
      <dc:date>2023-05-13T22:02:03Z</dc:date>
    </item>
    <item>
      <title>Re: TraceBoundary</title>
      <link>https://forums.autodesk.com/t5/net-forum/traceboundary/m-p/11962640#M8842</link>
      <description>&lt;P&gt;&lt;STRONG&gt;&lt;SPAN class=""&gt;Thank you very much for your reply&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;BR /&gt;But what I mean is that when I use TraceBoundary I want to access the boundary drawings&lt;BR /&gt;For example, when I clicked inside this limit according to the image below, it returned the following value&lt;BR /&gt;A yellow line&lt;BR /&gt;A red line&lt;BR /&gt;and two white lines&lt;/P&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="img.jpg" style="width: 496px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1214178i39562322DC8C81D9/image-size/large?v=v2&amp;amp;px=999" role="button" title="img.jpg" alt="img.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 14 May 2023 13:05:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/traceboundary/m-p/11962640#M8842</guid>
      <dc:creator>hakocivil</dc:creator>
      <dc:date>2023-05-14T13:05:42Z</dc:date>
    </item>
    <item>
      <title>Re: TraceBoundary</title>
      <link>https://forums.autodesk.com/t5/net-forum/traceboundary/m-p/11962652#M8843</link>
      <description>&lt;LI-CODE lang="general"&gt;If ppr.Status &amp;lt;&amp;gt; PromptStatus.OK Then Return
Dim objs As DBObjectCollection = ed.TraceBoundary(ppr.Value, True)
If objs.Count &amp;gt; 0 Then
Dim tr As Transaction = doc.TransactionManager.StartTransaction()

Using tr
Dim bt As BlockTable = CType(tr.GetObject(doc.Database.BlockTableId, OpenMode.ForRead), BlockTable)
Dim btr As BlockTableRecord = CType(tr.GetObject(bt(BlockTableRecord.ModelSpace), OpenMode.ForWrite), BlockTableRecord)
Dim ids As ObjectIdCollection = New ObjectIdCollection()
For Each obj As DBObject In objs
Dim ent As Entity = TryCast(obj, Entity)
If ent IsNot Nothing Then
'Here it creates New Boundary that I don't need, I just want the information from which it creates this Boundary
ids.Add(btr.AppendEntity(ent))
tr.AddNewlyCreatedDBObject(ent, True)
End If
Next&lt;/LI-CODE&gt;</description>
      <pubDate>Sun, 14 May 2023 13:17:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/traceboundary/m-p/11962652#M8843</guid>
      <dc:creator>hakocivil</dc:creator>
      <dc:date>2023-05-14T13:17:15Z</dc:date>
    </item>
    <item>
      <title>Re: TraceBoundary</title>
      <link>https://forums.autodesk.com/t5/net-forum/traceboundary/m-p/11962722#M8844</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;If you do not want to do it, do not append these DBObjects to the model space.&lt;/P&gt;
&lt;P&gt;Simply get the object type, its color (or layer) an do what you want with these data.&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt;foreach (Entity obj in objs)
{
    ed.WriteMessage($"\nType = {obj.GetType().Name} Color Index = {obj.ColorIndex}");
}&lt;/LI-CODE&gt;</description>
      <pubDate>Sun, 14 May 2023 14:41:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/traceboundary/m-p/11962722#M8844</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2023-05-14T14:41:12Z</dc:date>
    </item>
    <item>
      <title>Re: TraceBoundary</title>
      <link>https://forums.autodesk.com/t5/net-forum/traceboundary/m-p/11962835#M8845</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have drawn a closed boundary with several lines, and now I want to be able to click inside that boundary and get information about the lines that make up the boundary. For example, tell me that this boundary is made up of 4 lines, one of which is yellow, one is red, and two are white.&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="img.jpg" style="width: 496px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1214212i6E682D5E5617063D/image-size/large?v=v2&amp;amp;px=999" role="button" title="img.jpg" alt="img.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 14 May 2023 16:31:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/traceboundary/m-p/11962835#M8845</guid>
      <dc:creator>hakocivil</dc:creator>
      <dc:date>2023-05-14T16:31:54Z</dc:date>
    </item>
    <item>
      <title>Re: TraceBoundary</title>
      <link>https://forums.autodesk.com/t5/net-forum/traceboundary/m-p/11962870#M8846</link>
      <description>&lt;P&gt;And another question is that I want when I click inside this shape, don't consider the purple line and only convert the yellow lines to a polyline.&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="img2.JPG" style="width: 859px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1214221iED9C516524E8A885/image-size/large?v=v2&amp;amp;px=999" role="button" title="img2.JPG" alt="img2.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 14 May 2023 16:59:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/traceboundary/m-p/11962870#M8846</guid>
      <dc:creator>hakocivil</dc:creator>
      <dc:date>2023-05-14T16:59:04Z</dc:date>
    </item>
    <item>
      <title>Re: TraceBoundary</title>
      <link>https://forums.autodesk.com/t5/net-forum/traceboundary/m-p/11962962#M8847</link>
      <description>&lt;P&gt;In the case as you showed, Editor.TraceBoundary() would return a DBObjectCollection only containing one Polyline. So, you would not be able to tell which of the 4 lines in he drawing form this Polyline. You need to compare the geometries of the lines with the Polyline, something like:&lt;BR /&gt;foreach (var entId in [ModelSpaceBlock]&lt;BR /&gt;{&lt;BR /&gt;if (entId.ObjectClass.DxfName!="LINE") continue;&lt;BR /&gt;If IsPartOfBoundary(entId, boundaryPoly)&lt;BR /&gt;{&lt;BR /&gt;... ...&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;In the IsPartOfBoundary() method, you can test if 2 vertices of each segment of the boundary polyline are the same as the Line's Start/EndPoint (or on the line, if the line is actually longer then the polyline's segment).&lt;BR /&gt;&lt;BR /&gt;HTH.&lt;/P&gt;</description>
      <pubDate>Sun, 14 May 2023 18:31:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/traceboundary/m-p/11962962#M8847</guid>
      <dc:creator>norman.yuan</dc:creator>
      <dc:date>2023-05-14T18:31:58Z</dc:date>
    </item>
    <item>
      <title>Re: TraceBoundary</title>
      <link>https://forums.autodesk.com/t5/net-forum/traceboundary/m-p/11962968#M8848</link>
      <description>&lt;P&gt;As for your last question, if you do not want the purple line to interfere the boundary test, you need to make sure it is located on different layer and freeze the layer right before calling TraceBoundary()&amp;nbsp; (then thaw the layer, if necessary).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 14 May 2023 19:49:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/traceboundary/m-p/11962968#M8848</guid>
      <dc:creator>norman.yuan</dc:creator>
      <dc:date>2023-05-14T19:49:11Z</dc:date>
    </item>
    <item>
      <title>Re: TraceBoundary</title>
      <link>https://forums.autodesk.com/t5/net-forum/traceboundary/m-p/11962980#M8849</link>
      <description>&lt;P&gt;Another way could be using the vertices of the returned polyline to make a polygon selection.&lt;/P&gt;
&lt;P&gt;Here's a quick and dirty example (it needs to be improved).&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt;        [CommandMethod("BOUNDARYTEST")]
        public static void BoundaryTest()
        {
            var doc = Application.DocumentManager.MdiActiveDocument;
            var db = doc.Database;
            var ed = doc.Editor;
            var ppr = ed.GetPoint("\nPick a point: ");
            var objs = ed.TraceBoundary(ppr.Value, true);
            if (objs.Count == 1 &amp;amp;&amp;amp; objs[0] is Polyline)
            {
                var pline = (Polyline)objs[0];
                var polygon = new Point3dCollection();
                for (int i = 0; i &amp;lt; pline.NumberOfVertices; i++)
                {
                    polygon.Add(pline.GetPoint3dAt(i));
                }
                pline.Dispose();
                var selection = ed.SelectCrossingPolygon(polygon);
                if (selection.Status == PromptStatus.OK)
                {
                    using (var tr = db.TransactionManager.StartTransaction())
                    {
                        foreach (ObjectId id in selection.Value.GetObjectIds())
                        {
                            var entity = (Entity)tr.GetObject(id, OpenMode.ForRead);
                            ed.WriteMessage($"\nType = {entity.GetType().Name} Color index = {entity.ColorIndex}");
                        }
                        tr.Commit();
                    }
                }
            }
            else
            {
                foreach (DBObject obj in objs)
                {
                    obj?.Dispose();
                }
            }
        }&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 14 May 2023 18:52:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/traceboundary/m-p/11962980#M8849</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2023-05-14T18:52:38Z</dc:date>
    </item>
    <item>
      <title>Re: TraceBoundary</title>
      <link>https://forums.autodesk.com/t5/net-forum/traceboundary/m-p/11963570#M8850</link>
      <description>&lt;P&gt;&lt;FONT face="comic sans ms,sans-serif" color="#FF0000"&gt;&lt;STRONG&gt;Thank you to all my dear friends for solving the previous problem.&lt;span class="lia-unicode-emoji" title=":folded_hands:"&gt;🙏&lt;/span&gt;&lt;span class="lia-unicode-emoji" title=":folded_hands:"&gt;🙏&lt;/span&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;Please consider the following figure. I would like to obtain an output similar to the following when I select the entire shape in AutoCAD:&lt;BR /&gt;1- Area A2, from the north with a length of 1.53, to area A27&lt;BR /&gt;2- Area A2, from the east with a length of 1.51, to area A27&lt;BR /&gt;3- Area A2, from the south with a length of 1.55, to area A18&lt;BR /&gt;4- Area A2, from the west in two parts: the first part with a length of 0.86 in area A18 and the second part with a length of 0.59 in area A1&lt;/P&gt;&lt;P&gt;In general, I want to identify the neighbors of area A2.&lt;BR /&gt;Of course, I need to do this for all areas. Also note that all shapes are drawn using lines.&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="img3.JPG" style="width: 644px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1214308i57AAF70AA6E70291/image-size/large?v=v2&amp;amp;px=999" role="button" title="img3.JPG" alt="img3.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 15 May 2023 05:18:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/traceboundary/m-p/11963570#M8850</guid>
      <dc:creator>hakocivil</dc:creator>
      <dc:date>2023-05-15T05:18:18Z</dc:date>
    </item>
  </channel>
</rss>

