<?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: polylines intersection in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/polylines-intersection/m-p/9765109#M18438</link>
    <description>&lt;P&gt;Thank you for your answer&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/109424"&gt;@_gile&lt;/a&gt;&amp;nbsp;.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I had already tried that before , but neither it works. I thought that i had posted the code with the newest version of intersetWith(), sorry for the missundertanding. Any other clue about where could be the problem?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;</description>
    <pubDate>Thu, 24 Sep 2020 07:02:32 GMT</pubDate>
    <dc:creator>carlosrdrzalns</dc:creator>
    <dc:date>2020-09-24T07:02:32Z</dc:date>
    <item>
      <title>polylines intersection</title>
      <link>https://forums.autodesk.com/t5/net-forum/polylines-intersection/m-p/9761591#M18436</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to check if there is any MText below my current MText, as i have an exported drawing from Revit which explode every MText into single-line Mtext. So i have used this code:&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;private static bool IsTextBelow(Editor ed, MText entityabove, MText entitybelow )
        {
            Polyline pl = new Polyline();
            int[] VerticesX = new int[4] { 0, 1, 1, 0 };
            int[] VerticesY = new int[4] { 0, 0, -1, -1 };
            for(int i = 0; i == VerticesX.Length - 1 ;i++)
            {
                Point2d pnt = new Point2d(entityabove.Location.X + entityabove.ActualWidth * VerticesX[i], entityabove.Location.Y + (entityabove.ActualHeight + entityabove.TextHeight) * VerticesY[i]);
                pl.AddVertexAt(i, pnt, 0, 0, 0);
            }
            Polyline plaux = new Polyline();
            for (int i = 0; i == VerticesX.Length - 1; i++)
            {
                Point2d pnt = new Point2d(entitybelow.Location.X + entitybelow.ActualWidth * VerticesX[i], entitybelow.Location.Y + entitybelow.ActualHeight * VerticesY[i]);
                plaux.AddVertexAt(i, pnt, 0, 0, 0);
            }
            
            pl.Closed = true;
            plaux.Closed = true;
            
            Point3dCollection IntPnt = new Point3dCollection();
            pl.IntersectWith(plaux, Intersect.OnBothOperands, IntPnt, (int)IntPtr.Zero, (int)IntPtr.Zero);
            pl.Dispose();
            plaux.Dispose();
            if (IntPnt.Count &amp;gt; 0)
            {
                IntPnt.Dispose();
                return true;
            }
            else
            {
                IntPnt.Dispose();
                return false;
            }

        }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am getting a weird error when using Entity.IntersectWith() method with two polylines. I have already use this code in VB.NET, but in this new proyect in C# i am getting this error:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Error: eInvalidInput en Acdbmgd , at Autodesk.AutoCAD.DatabaseServices.Entity.IntersectWith(Entity entityPointer, Intersect intersectType, Point3dCollection points, IntPtr thisGraphicSystemMarker, IntPtr otherGraphicSystemMarker)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My VB.NET code that already works is as following:&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; Private Function IsTextBelow(ByVal tx As MText, ByVal entitybelow As MText) As Boolean
        Try


            Dim pl As Polyline = New Polyline
            Dim VerticesX = New Integer() {0, 1, 1, 0}
            Dim VerticesY = New Integer() {0, 0, -1, -1}
            For i As Integer = 0 To VerticesX.Count - 1
                Dim pnt As Point2d = New Point2d(tx.Location.X + tx.ActualWidth * VerticesX(i), tx.Location.Y + (tx.ActualHeight + tx.TextHeight) * VerticesY(i))
                pl.AddVertexAt(i, pnt, 0, 0, 0)
            Next
            Dim plaux As Polyline = New Polyline
            For i As Integer = 0 To VerticesX.Count - 1
                Dim pnt As Point2d = New Point2d(entitybelow.Location.X + entitybelow.ActualWidth * VerticesX(i), entitybelow.Location.Y + (entitybelow.ActualHeight) * VerticesY(i))
                plaux.AddVertexAt(i, pnt, 0, 0, 0)
            Next
            plaux.Closed = True
            pl.Closed = True
            Dim IntPnt As Point3dCollection = New Point3dCollection
            pl.IntersectWith(plaux, Intersect.OnBothOperands, IntPnt, New IntPtr(0), New IntPtr(0))
            plaux.Dispose()
            pl.Dispose()

            If IntPnt.Count &amp;gt; 0 Then
                Return True
            Else
                Return False
            End If


        Catch ex As System.Exception
            ed.WriteMessage("error al encontrar el texto inferior")
            Return False
        End Try



    End Function&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;any clue about what may be happening?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Sep 2020 16:07:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/polylines-intersection/m-p/9761591#M18436</guid>
      <dc:creator>carlosrdrzalns</dc:creator>
      <dc:date>2020-09-22T16:07:48Z</dc:date>
    </item>
    <item>
      <title>Re: polylines intersection</title>
      <link>https://forums.autodesk.com/t5/net-forum/polylines-intersection/m-p/9761656#M18437</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Except if you're targeting an old version of AutoCAD, you should not cast the IntPtr into an integer. If you absolutely need to cast the IntPtr, cast it into a long (Int64) instead of a int (Int32).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try replacing this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt;pl.IntersectWith(plaux, Intersect.OnBothOperands, IntPnt, (int)IntPtr.Zero, (int)IntPtr.Zero);&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;with this:&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt;pl.IntersectWith(plaux, Intersect.OnBothOperands, IntPnt, IntPtr.Zero, IntPtr.Zero);&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;</description>
      <pubDate>Tue, 22 Sep 2020 16:45:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/polylines-intersection/m-p/9761656#M18437</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2020-09-22T16:45:58Z</dc:date>
    </item>
    <item>
      <title>Re: polylines intersection</title>
      <link>https://forums.autodesk.com/t5/net-forum/polylines-intersection/m-p/9765109#M18438</link>
      <description>&lt;P&gt;Thank you for your answer&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/109424"&gt;@_gile&lt;/a&gt;&amp;nbsp;.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I had already tried that before , but neither it works. I thought that i had posted the code with the newest version of intersetWith(), sorry for the missundertanding. Any other clue about where could be the problem?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;</description>
      <pubDate>Thu, 24 Sep 2020 07:02:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/polylines-intersection/m-p/9765109#M18438</guid>
      <dc:creator>carlosrdrzalns</dc:creator>
      <dc:date>2020-09-24T07:02:32Z</dc:date>
    </item>
    <item>
      <title>Re: polylines intersection</title>
      <link>https://forums.autodesk.com/t5/net-forum/polylines-intersection/m-p/9765173#M18439</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/9201543"&gt;@carlosrdrzalns&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Replace next line:&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt;for (int i = 0; i == VerticesX.Length - 1; i++)&lt;/LI-CODE&gt;
&lt;P&gt;with this line:&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt;for (int i = 0; i &amp;lt; VerticesX.Length; i++)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Sep 2020 07:34:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/polylines-intersection/m-p/9765173#M18439</guid>
      <dc:creator>Alexander.Rivilis</dc:creator>
      <dc:date>2020-09-24T07:34:16Z</dc:date>
    </item>
    <item>
      <title>Re: polylines intersection</title>
      <link>https://forums.autodesk.com/t5/net-forum/polylines-intersection/m-p/9765239#M18440</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/481027"&gt;@Alexander.Rivilis&lt;/a&gt;&amp;nbsp;, that solved the problem. I thought that those conditions were the same.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Sep 2020 07:59:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/polylines-intersection/m-p/9765239#M18440</guid>
      <dc:creator>carlosrdrzalns</dc:creator>
      <dc:date>2020-09-24T07:59:39Z</dc:date>
    </item>
    <item>
      <title>Re: polylines intersection</title>
      <link>https://forums.autodesk.com/t5/net-forum/polylines-intersection/m-p/9765248#M18441</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/9201543"&gt;@carlosrdrzalns&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Thank you&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/481027"&gt;@Alexander.Rivilis&lt;/a&gt;&amp;nbsp;, that solved the problem. I thought that those conditions were the same.&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;It will be wonderful to study the syntax of C#&amp;nbsp; &lt;span class="lia-unicode-emoji" title=":smiling_face_with_smiling_eyes:"&gt;😊&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Sep 2020 08:04:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/polylines-intersection/m-p/9765248#M18441</guid>
      <dc:creator>Alexander.Rivilis</dc:creator>
      <dc:date>2020-09-24T08:04:42Z</dc:date>
    </item>
  </channel>
</rss>

