<?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: intersect method of tow intersected lines not working in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/intersect-method-of-two-intersected-lines-not-working/m-p/11756083#M9978</link>
    <description>&lt;P&gt;Are the entites far from the origin ? If so, there can be imprecisions due to the double precision floating point.&lt;/P&gt;
&lt;P&gt;In this case, you can move the entities nearer to the Origin, get the intersections and move back the entities and the points.&lt;/P&gt;</description>
    <pubDate>Wed, 15 Feb 2023 10:00:45 GMT</pubDate>
    <dc:creator>_gile</dc:creator>
    <dc:date>2023-02-15T10:00:45Z</dc:date>
    <item>
      <title>intersect method of two intersected lines not working</title>
      <link>https://forums.autodesk.com/t5/net-forum/intersect-method-of-two-intersected-lines-not-working/m-p/11753120#M9973</link>
      <description>&lt;P&gt;Hi every one, Im facing a wierd condition that tow lines are interesected, but the intersect method does not work.&lt;/P&gt;
&lt;P&gt;this is the code:&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="akouchakzadeh_0-1676366702811.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1176211i7C286C0F837E7C22/image-size/medium?v=v2&amp;amp;px=400" role="button" title="akouchakzadeh_0-1676366702811.png" alt="akouchakzadeh_0-1676366702811.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;its not just this, some lines that intersect with blocks have the same issue:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;this is my code:&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("intersector")]
        public void inters()
        {
            using (var tr = db.TransactionManager.StartOpenCloseTransaction())
            {
                var promptEntOpt1 = new PromptEntityOptions("Please select a first object");
                var res1 = ed.GetEntity(promptEntOpt1);
                var ent1 = (Entity)tr.GetObject(res1.ObjectId, OpenMode.ForRead);

                promptEntOpt1.Message = "\nPlease select a  second object";
                var res2 = ed.GetEntity(promptEntOpt1);
                var ent2 = (Entity)tr.GetObject(res1.ObjectId, OpenMode.ForRead);

                var intersect = new Point3dCollection();
                ent1.IntersectWith(ent2, Intersect.OnBothOperands, intersect, IntPtr.Zero, IntPtr.Zero);
                Application.ShowAlertDialog(intersect.Count.ToString());

            }
        }&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Feb 2023 15:47:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/intersect-method-of-two-intersected-lines-not-working/m-p/11753120#M9973</guid>
      <dc:creator>a.kouchakzadeh</dc:creator>
      <dc:date>2023-02-16T15:47:26Z</dc:date>
    </item>
    <item>
      <title>Re: intersect method of tow intersected lines not working</title>
      <link>https://forums.autodesk.com/t5/net-forum/intersect-method-of-two-intersected-lines-not-working/m-p/11753505#M9974</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE class="lia-code-sample line-numbers language-csharp" tabindex="0"&gt;&lt;CODE&gt;var ent2 = (Entity)tr.GetObject(res1.ObjectId, OpenMode.ForRead);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;It should be: &lt;STRONG&gt;res2&lt;/STRONG&gt;.ObjectId.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Feb 2023 12:24:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/intersect-method-of-two-intersected-lines-not-working/m-p/11753505#M9974</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2023-02-14T12:24:19Z</dc:date>
    </item>
    <item>
      <title>Re: intersect method of tow intersected lines not working</title>
      <link>https://forums.autodesk.com/t5/net-forum/intersect-method-of-two-intersected-lines-not-working/m-p/11753657#M9975</link>
      <description>&lt;P&gt;Hi Giles,&lt;/P&gt;&lt;P&gt;that was my mistake but actually it was just a test method to check the main problem.&lt;/P&gt;&lt;P&gt;how ever still I have this issue with my real drawing.&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="akouchakzadeh_0-1676379868077.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1176308i36E740C56F612648/image-size/medium?v=v2&amp;amp;px=400" role="button" title="akouchakzadeh_0-1676379868077.png" alt="akouchakzadeh_0-1676379868077.png" /&gt;&lt;/span&gt;&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="akouchakzadeh_1-1676379884097.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1176309i75F6C59E42A43142/image-size/medium?v=v2&amp;amp;px=400" role="button" title="akouchakzadeh_1-1676379884097.png" alt="akouchakzadeh_1-1676379884097.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Please take a look at this condition,&lt;/P&gt;&lt;P&gt;both line and arc are on the same plane and have no z value&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but when I try the intersect method, it showing 0 even though end of the line is at the same point which is end of the Arc&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="akouchakzadeh_2-1676380056781.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1176310i356C5F4A73FFE174/image-size/medium?v=v2&amp;amp;px=400" role="button" title="akouchakzadeh_2-1676380056781.png" alt="akouchakzadeh_2-1676380056781.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;now the crazy part is when I manually change the end point of the arc and return it back to where it was, it counts the intersection.&lt;/P&gt;&lt;P&gt;the arcs where created using fillet (if this has any impact on the process).&lt;/P&gt;&lt;P&gt;why is the program acting like this and how can i get the intersection at the end?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Feb 2023 13:11:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/intersect-method-of-two-intersected-lines-not-working/m-p/11753657#M9975</guid>
      <dc:creator>a.kouchakzadeh</dc:creator>
      <dc:date>2023-02-14T13:11:30Z</dc:date>
    </item>
    <item>
      <title>Re: intersect method of tow intersected lines not working</title>
      <link>https://forums.autodesk.com/t5/net-forum/intersect-method-of-two-intersected-lines-not-working/m-p/11754065#M9976</link>
      <description>&lt;P&gt;I've seen similar issues while Joining to Polylines, endpoint are equal, but still failed to add.&lt;/P&gt;&lt;P&gt;Can be solved by manually moving the Arc endpoint back and forth to the same endpoint.&lt;/P&gt;&lt;P&gt;The real issue might be a not exact alignments of the Tangential Lines at the endpoints.&lt;/P&gt;&lt;P&gt;Check/Set StartAngle and EndAngle.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Feb 2023 15:39:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/intersect-method-of-two-intersected-lines-not-working/m-p/11754065#M9976</guid>
      <dc:creator>SENL1362</dc:creator>
      <dc:date>2023-02-14T15:39:50Z</dc:date>
    </item>
    <item>
      <title>Re: intersect method of tow intersected lines not working</title>
      <link>https://forums.autodesk.com/t5/net-forum/intersect-method-of-two-intersected-lines-not-working/m-p/11755833#M9977</link>
      <description>&lt;P&gt;its not just Line and Arc objects. I this problem with Line and Block references as well. some blocks and lines wont show the intersection even though the line is completely on that specific block and has intersection with all its elements.&lt;/P&gt;&lt;P&gt;I have also check if objects are on the same plane and they are. non of them has a Z value&lt;/P&gt;</description>
      <pubDate>Wed, 15 Feb 2023 08:04:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/intersect-method-of-two-intersected-lines-not-working/m-p/11755833#M9977</guid>
      <dc:creator>a.kouchakzadeh</dc:creator>
      <dc:date>2023-02-15T08:04:14Z</dc:date>
    </item>
    <item>
      <title>Re: intersect method of tow intersected lines not working</title>
      <link>https://forums.autodesk.com/t5/net-forum/intersect-method-of-two-intersected-lines-not-working/m-p/11756083#M9978</link>
      <description>&lt;P&gt;Are the entites far from the origin ? If so, there can be imprecisions due to the double precision floating point.&lt;/P&gt;
&lt;P&gt;In this case, you can move the entities nearer to the Origin, get the intersections and move back the entities and the points.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Feb 2023 10:00:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/intersect-method-of-two-intersected-lines-not-working/m-p/11756083#M9978</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2023-02-15T10:00:45Z</dc:date>
    </item>
    <item>
      <title>Re: intersect method of tow intersected lines not working</title>
      <link>https://forums.autodesk.com/t5/net-forum/intersect-method-of-two-intersected-lines-not-working/m-p/11756248#M9979</link>
      <description>I dont know what do you mean by origin.&lt;BR /&gt;can you tell me what is origin and how can I check it?&lt;BR /&gt;also can you tell me how to move entities nearer to the origin?&lt;BR /&gt;&lt;BR /&gt;I checked the start and end point of both line and arcs. as shown in the picture, Line.EndPoint &amp;amp;&amp;amp; Arc.EndPoint are at the same point.&lt;BR /&gt;how ever with only 4 precessions.</description>
      <pubDate>Wed, 15 Feb 2023 11:23:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/intersect-method-of-two-intersected-lines-not-working/m-p/11756248#M9979</guid>
      <dc:creator>a.kouchakzadeh</dc:creator>
      <dc:date>2023-02-15T11:23:02Z</dc:date>
    </item>
    <item>
      <title>Re: intersect method of tow intersected lines not working</title>
      <link>https://forums.autodesk.com/t5/net-forum/intersect-method-of-two-intersected-lines-not-working/m-p/11758837#M9980</link>
      <description>&lt;P&gt;Sorry for the late reply. By "Origin" I meant the origin of WCS (0.0, 0.0, 0.0). But looking at your screenshot, I don't think this is the problem. Your coordinates are in the tens of thousands and these inaccuracy problems occur in the tens of millions.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/10854705"&gt;@a.kouchakzadeh&lt;/a&gt;&amp;nbsp; a écrit&amp;nbsp;:&lt;BR /&gt;I checked the start and end point of both line and arcs. as shown in the picture, Line.EndPoint &amp;amp;&amp;amp; Arc.EndPoint are at the same point.&lt;BR /&gt;how ever with only 4 precessions.&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;By default the Tolerance.Global.EqualPoint values is 1E-10 (10 digits).&lt;/P&gt;
&lt;P&gt;You should check it by code using: Line.EndPoint.IsEqualTo (Arc.EndPoint).&lt;/P&gt;</description>
      <pubDate>Thu, 16 Feb 2023 09:06:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/intersect-method-of-two-intersected-lines-not-working/m-p/11758837#M9980</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2023-02-16T09:06:59Z</dc:date>
    </item>
    <item>
      <title>Re: intersect method of tow intersected lines not working</title>
      <link>https://forums.autodesk.com/t5/net-forum/intersect-method-of-two-intersected-lines-not-working/m-p/11759070#M9981</link>
      <description>&lt;P&gt;I have uploaded the file just in case if you could take a look Giles.&lt;/P&gt;&lt;P&gt;I had this issue with some block to lines intersections as well.&lt;/P&gt;</description>
      <pubDate>Thu, 16 Feb 2023 10:55:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/intersect-method-of-two-intersected-lines-not-working/m-p/11759070#M9981</guid>
      <dc:creator>a.kouchakzadeh</dc:creator>
      <dc:date>2023-02-16T10:55:55Z</dc:date>
    </item>
    <item>
      <title>Re: intersect method of tow intersected lines not working</title>
      <link>https://forums.autodesk.com/t5/net-forum/intersect-method-of-two-intersected-lines-not-working/m-p/11760685#M9982</link>
      <description>&lt;P class="lia-align-left"&gt;Finally, the issue seems to be related to great coordinates.&lt;/P&gt;
&lt;P class="lia-align-left"&gt;Moving the entities closer to the WCS Origin seems to work.&lt;/P&gt;
&lt;P class="lia-align-left"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="lia-align-left"&gt;Here's an example to get all the intersections points between the supplied entities.&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt;        static Point3dCollection GetIntersections(IEnumerable&amp;lt;Entity&amp;gt; source)
        {
            var entities = source.ToArray();

            // Get the vector from WCS Origin to the extents of the first entity
            var extents = entities[0].GeometricExtents;
            var displacement = extents.MinPoint.GetAsVector();

            // Move all entities nearer to origin
            var xform = Matrix3d.Displacement(displacement.Negate());
            foreach (var entity in entities)
            {
                if (!entity.IsWriteEnabled) entity.UpgradeOpen();
                entity.TransformBy(xform);
            }

            // Get all the intersections between entities
            var points = new Point3dCollection();
            for (var i = 0; i &amp;lt; entities.Length - 1; i++)
            {
                var ent1 = entities[i];
                for (int j = i + 1; j &amp;lt; entities.Length; j++)
                {
                    var ent2 = entities[j];
                    ent1.IntersectWith(ent2, Intersect.OnBothOperands, points, IntPtr.Zero, IntPtr.Zero);
                }
            }

            // Move back the entities
            xform = Matrix3d.Displacement(displacement);
            foreach (var entity in entities)
            {
                entity.TransformBy(xform);
            }

            // Return the transformed points
            return new Point3dCollection(
                points
                .Cast&amp;lt;Point3d&amp;gt;()
                .Select(p =&amp;gt; p.TransformBy(xform))
                .ToArray());
        }&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A testing command:&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt;        [CommandMethod("TEST")]
        public void Test()
        {
            var doc = AcAp.DocumentManager.MdiActiveDocument;
            var db = doc.Database;
            var ed = doc.Editor;
            db.Pdmode = 32;

            var selection = ed.GetSelection();
            if (selection.Status != PromptStatus.OK)
                return;

            using (var tr = db.TransactionManager.StartTransaction())
            {
                var entities = selection.Value
                    .GetObjectIds()
                    .Select(id =&amp;gt; (Entity)tr.GetObject(id, OpenMode.ForRead));
                var points = GetIntersections(entities);
                var curSpace = (BlockTableRecord)tr.GetObject(db.CurrentSpaceId, OpenMode.ForWrite);
                foreach (Point3d pt in points)
                {
                    var point = new DBPoint(pt);
                    point.ColorIndex = 30;
                    curSpace.AppendEntity(point);
                    tr.AddNewlyCreatedDBObject(point, true);
                }
                tr.Commit();
            }
        }&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 16 Feb 2023 21:22:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/intersect-method-of-two-intersected-lines-not-working/m-p/11760685#M9982</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2023-02-16T21:22:37Z</dc:date>
    </item>
    <item>
      <title>Re: intersect method of tow intersected lines not working</title>
      <link>https://forums.autodesk.com/t5/net-forum/intersect-method-of-two-intersected-lines-not-working/m-p/11760829#M9983</link>
      <description>&lt;P&gt;Giles, your code throws an error&lt;/P&gt;&lt;P&gt;the program still cant detect the intersection:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="akouchakzadeh_0-1676586204954.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1177652iC3BC0277FDF75C46/image-size/medium?v=v2&amp;amp;px=400" role="button" title="akouchakzadeh_0-1676586204954.png" alt="akouchakzadeh_0-1676586204954.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Im trying to get the line and the AOM block intersection.&lt;/P&gt;</description>
      <pubDate>Thu, 16 Feb 2023 22:26:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/intersect-method-of-two-intersected-lines-not-working/m-p/11760829#M9983</guid>
      <dc:creator>a.kouchakzadeh</dc:creator>
      <dc:date>2023-02-16T22:26:30Z</dc:date>
    </item>
    <item>
      <title>Re: intersect method of tow intersected lines not working</title>
      <link>https://forums.autodesk.com/t5/net-forum/intersect-method-of-two-intersected-lines-not-working/m-p/11761504#M9984</link>
      <description>&lt;P&gt;This error is due to the fact there's no intersection point (points.Count == 0) because of the Z coordinate of the AOM block.&lt;/P&gt;
&lt;P&gt;Here's a correctd code which corrects that.&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt;        static Point3dCollection GetIntersections(IEnumerable&amp;lt;Entity&amp;gt; source)
        {
            var entities = source.ToArray();

            // Get the vector from WCS Origin to the extents of the first entity
            var extents = entities[0].GeometricExtents;
            var displacement = extents.MinPoint.GetAsVector();

            // Move all entities nearer to origin
            var xform = Matrix3d.Displacement(displacement.Negate());
            foreach (var entity in entities)
            {
                if (!entity.IsWriteEnabled) entity.UpgradeOpen();
                entity.TransformBy(xform);
            }

            // Get all the intersections between entities
            var points = new Point3dCollection();
            for (var i = 0; i &amp;lt; entities.Length - 1; i++)
            {
                var ent1 = entities[i];
                for (int j = i + 1; j &amp;lt; entities.Length; j++)
                {
                    var ent2 = entities[j];
                    ent1.IntersectWith(ent2, Intersect.OnBothOperands, points, IntPtr.Zero, IntPtr.Zero);
                }
            }

            // Move back the entities
            xform = Matrix3d.Displacement(displacement);
            foreach (var entity in entities)
            {
                entity.TransformBy(xform);
            }

            // Return the transformed points
            if (0 &amp;lt; points.Count)
            {
                return new Point3dCollection(
                    points
                    .Cast&amp;lt;Point3d&amp;gt;()
                    .Select(p =&amp;gt; p.TransformBy(xform))
                    .ToArray());
            }
            else
            {
                return points;
            }
        }&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 17 Feb 2023 07:01:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/intersect-method-of-two-intersected-lines-not-working/m-p/11761504#M9984</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2023-02-17T07:01:07Z</dc:date>
    </item>
    <item>
      <title>Re: intersect method of tow intersected lines not working</title>
      <link>https://forums.autodesk.com/t5/net-forum/intersect-method-of-two-intersected-lines-not-working/m-p/11763862#M9985</link>
      <description>&lt;P&gt;Thank you sir&lt;/P&gt;</description>
      <pubDate>Sat, 18 Feb 2023 05:22:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/intersect-method-of-two-intersected-lines-not-working/m-p/11763862#M9985</guid>
      <dc:creator>a.kouchakzadeh</dc:creator>
      <dc:date>2023-02-18T05:22:03Z</dc:date>
    </item>
  </channel>
</rss>

