<?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: touching or crossing in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/polylines-touching-or-crossing/m-p/8769329#M89087</link>
    <description>&lt;P&gt;Yes, i am talking about closed polylines. I wanted to know whether 2 plines are touching or crossing each other. It doesn't matter if one of the plines is inside or outside the other one.&lt;BR /&gt;&lt;BR /&gt;In the 1-st and 3-rd images in this thread, are cases where the plines produce 2 intersection points, both for crossing and touching.&lt;/P&gt;</description>
    <pubDate>Fri, 03 May 2019 12:37:35 GMT</pubDate>
    <dc:creator>doaiena</dc:creator>
    <dc:date>2019-05-03T12:37:35Z</dc:date>
    <item>
      <title>Polylines: touching or crossing</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/polylines-touching-or-crossing/m-p/8768098#M89072</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;&lt;BR /&gt;I am currently looking for a way to find out, whether 2 polylines are touching, or crossing each other. I have tried the "vla-intersectwith" method, but it returns an output in both cases. I don't want to use bounding boxes, as it would give false results, depending on the polylines' shapes.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I've spent a few hours on google, looking for an answer, but didn't find anything. I would be very thankfull if you could send some ideas my way, on how to approach the matter.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;SPAN style="font-family: inherit;"&gt;Thank you.&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: inherit;"&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="touchOrCross.png" style="width: 346px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/632630i1AA62FF1F314236F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="touchOrCross.png" alt="touchOrCross.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 02 May 2019 21:05:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/polylines-touching-or-crossing/m-p/8768098#M89072</guid>
      <dc:creator>doaiena</dc:creator>
      <dc:date>2019-05-02T21:05:19Z</dc:date>
    </item>
    <item>
      <title>Re: Polylines: touching or crossing</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/polylines-touching-or-crossing/m-p/8768289#M89073</link>
      <description>You can check  for each poly , for eachintersectpoint ,  by 

(vlax-curve-getParamAtPoint poly b)

If any of it give you a Whole par value</description>
      <pubDate>Thu, 02 May 2019 22:57:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/polylines-touching-or-crossing/m-p/8768289#M89073</guid>
      <dc:creator>devitg</dc:creator>
      <dc:date>2019-05-02T22:57:43Z</dc:date>
    </item>
    <item>
      <title>Re: Polylines: touching or crossing</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/polylines-touching-or-crossing/m-p/8768361#M89074</link>
      <description>&lt;P&gt;That idea went through my mind at one point, but i wrote it off, because it will only work for rectangles. A whole parameter value indicates a vertex, which would work in cases, where one of the polylines touches the other with a vertex /or multiple verteces/.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-family: inherit;"&gt;Maybe my initial image wasn't a good example. I want to find out, whether the 2 plines are touching each other, regardless if it's at a vertex or not.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="touchOrCross2.png" style="width: 398px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/632666i5BC460F261E6D16C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="touchOrCross2.png" alt="touchOrCross2.png" /&gt;&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 02 May 2019 23:57:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/polylines-touching-or-crossing/m-p/8768361#M89074</guid>
      <dc:creator>doaiena</dc:creator>
      <dc:date>2019-05-02T23:57:25Z</dc:date>
    </item>
    <item>
      <title>Re: Polylines: touching or crossing</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/polylines-touching-or-crossing/m-p/8768373#M89075</link>
      <description>You can check if there is more than one intersection and no (-par (fix par)) is = 0 [cross]  and  , or if there is only one intersection  [touch] or if are more than 1 par and all are (= 0 (-par (fix par))) [touch]  ,or no intersection [none]</description>
      <pubDate>Fri, 03 May 2019 00:09:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/polylines-touching-or-crossing/m-p/8768373#M89075</guid>
      <dc:creator>devitg</dc:creator>
      <dc:date>2019-05-03T00:09:50Z</dc:date>
    </item>
    <item>
      <title>Re: Polylines: touching or crossing</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/polylines-touching-or-crossing/m-p/8768377#M89076</link>
      <description>&lt;P&gt;In the first image /with the 2 rectangles/, there are 2 intersection points in both cases. Thats what i find weird about the "vla-intersectwith" method. I thought that the output would be different when the polylines are touching each other, not only at 2 points, but a long a certain length.&lt;/P&gt;</description>
      <pubDate>Fri, 03 May 2019 00:08:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/polylines-touching-or-crossing/m-p/8768377#M89076</guid>
      <dc:creator>doaiena</dc:creator>
      <dc:date>2019-05-03T00:08:19Z</dc:date>
    </item>
    <item>
      <title>Re: Polylines: touching or crossing</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/polylines-touching-or-crossing/m-p/8768380#M89077</link>
      <description>ePlease check post 4 , I edited. the fact , is to check for intersection-s , and par at  this those intersection-s</description>
      <pubDate>Fri, 03 May 2019 00:12:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/polylines-touching-or-crossing/m-p/8768380#M89077</guid>
      <dc:creator>devitg</dc:creator>
      <dc:date>2019-05-03T00:12:56Z</dc:date>
    </item>
    <item>
      <title>Re: Polylines: touching or crossing</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/polylines-touching-or-crossing/m-p/8768395#M89078</link>
      <description>&lt;P&gt;First of all i want to thank you for your ideas. I really appreciate your help.&lt;/P&gt;
&lt;P&gt;Maybe my brain isn't working at the moment, so i can't quite get your idea. (- par (fix par)) would give me the parameter of the touch/cross, for the pline segment. At the moment i can't think of a way that is usefull for me.&lt;BR /&gt;&lt;BR /&gt;Btw i just made another example of touching and crossing plines, both with 2 points, and both not on verteces, and i can't think of a way do differentiate the two.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="touchOrCross3.png" style="width: 354px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/632667i2940C9C46B2BEEC1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="touchOrCross3.png" alt="touchOrCross3.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 03 May 2019 00:41:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/polylines-touching-or-crossing/m-p/8768395#M89078</guid>
      <dc:creator>doaiena</dc:creator>
      <dc:date>2019-05-03T00:41:25Z</dc:date>
    </item>
    <item>
      <title>Re: Polylines: touching or crossing</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/polylines-touching-or-crossing/m-p/8768403#M89079</link>
      <description>&lt;P&gt;(= 0(- par (fix par))) will be T , for one or more touching points are at vertex if so.&lt;/P&gt;
&lt;P&gt;For your 2 touching rectangle you will get 2 PARam as INT as 1.00 and 2.00 or 1 and 2&lt;/P&gt;
&lt;P&gt;For your cross rectangle you will get 4 PARam , no one will fit (= 0(- par (fix par)))&lt;/P&gt;
&lt;P&gt;For the 3 case an arc touching the poly you will get ONLY one intersection so IT TOUCH , no matter about PARam If no intersection , neither touch or cross.&lt;/P&gt;
&lt;P&gt;For the 4 case , it had to be think&lt;/P&gt;
&lt;P&gt;As ever, you and most poster , do not show all the cases.&lt;/P&gt;</description>
      <pubDate>Fri, 03 May 2019 01:17:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/polylines-touching-or-crossing/m-p/8768403#M89079</guid>
      <dc:creator>devitg</dc:creator>
      <dc:date>2019-05-03T01:17:58Z</dc:date>
    </item>
    <item>
      <title>Re: Polylines: touching or crossing</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/polylines-touching-or-crossing/m-p/8768408#M89080</link>
      <description>&lt;P&gt;The problem is, i myself don't know all the cases. I post, as i think of a new case. The basic idea was to be able to find out whether the plines are touching or crossing, no matter the shapes or point/points of contact.&lt;/P&gt;</description>
      <pubDate>Fri, 03 May 2019 01:04:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/polylines-touching-or-crossing/m-p/8768408#M89080</guid>
      <dc:creator>doaiena</dc:creator>
      <dc:date>2019-05-03T01:04:10Z</dc:date>
    </item>
    <item>
      <title>Re: Polylines: touching or crossing</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/polylines-touching-or-crossing/m-p/8768411#M89081</link>
      <description>&lt;P&gt;Ok, i'm thinkin about no vertex is touching&lt;/P&gt;</description>
      <pubDate>Fri, 03 May 2019 01:07:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/polylines-touching-or-crossing/m-p/8768411#M89081</guid>
      <dc:creator>devitg</dc:creator>
      <dc:date>2019-05-03T01:07:12Z</dc:date>
    </item>
    <item>
      <title>Re: Polylines: touching or crossing</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/polylines-touching-or-crossing/m-p/8768450#M89082</link>
      <description>&lt;P&gt;Are the likely shapes "ordinary" enough, and is the degree of overlap [if any] smallish compared to the sizes, as in your examples, and would there not be other stuff around inside the shapes?&amp;nbsp; If so, you could find the centroids or middles of bounding boxes, use those as internal-pick points for BOUNDARY commands, and compare the areas of the results to the areas of the originals.&amp;nbsp; If the originals &lt;EM&gt;touch but don't overlap&lt;/EM&gt;, there will be something returned by the (intersectwith) method, but the BOUNDARY results will have the &lt;EM&gt;same areas&lt;/EM&gt;&amp;nbsp; as the originals, no matter how many points of intersection or how much length of coincident edge(s) there may be.&amp;nbsp; If the originals &lt;EM&gt;overlap&lt;/EM&gt;, the BOUNDARY results would each have a &lt;EM&gt;smaller&lt;/EM&gt;&amp;nbsp; area than its corresponding original, no matter how many points of intersection there are.&lt;/P&gt;</description>
      <pubDate>Fri, 03 May 2019 01:55:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/polylines-touching-or-crossing/m-p/8768450#M89082</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2019-05-03T01:55:11Z</dc:date>
    </item>
    <item>
      <title>Re: Polylines: touching or crossing</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/polylines-touching-or-crossing/m-p/8768634#M89083</link>
      <description>&lt;P&gt;First, check for intersections with vla method.&lt;/P&gt;
&lt;P&gt;Now check if the points &lt;EM&gt;between every 2 consecutive intersections &lt;/EM&gt;of one polyline are inside/outside the other polyline.&lt;/P&gt;
&lt;P&gt;Based on the alternation inside/outside, you can establish the relative position of the 2 polys.&lt;/P&gt;
&lt;P&gt;Now you only need a good &lt;EM&gt;inside_p&lt;/EM&gt; function &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; I guess you'll find some in this forum.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;See the image for demonstration. Notice it doesn't matter which polyline is checked against the other.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2_polylines.PNG" style="width: 999px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/632730i44EF2566BA7F7DDD/image-size/large?v=v2&amp;amp;px=999" role="button" title="2_polylines.PNG" alt="2_polylines.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 03 May 2019 06:24:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/polylines-touching-or-crossing/m-p/8768634#M89083</guid>
      <dc:creator>phanaem</dc:creator>
      <dc:date>2019-05-03T06:24:17Z</dc:date>
    </item>
    <item>
      <title>Re: Polylines: touching or crossing</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/polylines-touching-or-crossing/m-p/8769227#M89084</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/69526"&gt;@Kent1Cooper&lt;/a&gt;&amp;nbsp;: As you have pointed out, picking a point for a boundary is not reliable in all cases /depending on the plines' shapes/. I thought of something similar, that doesnt rely on picking points, but i was sure there must be a more straight forward way to perform this check.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My idea was:&lt;/P&gt;
&lt;P&gt;1. Region the plines.&lt;/P&gt;
&lt;P&gt;2. Intersect.&lt;/P&gt;
&lt;P&gt;3. If there is any geometry left over, the 2 plines are crossing /erase the remaining region/; else they are just touching.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/314908"&gt;@phanaem&lt;/a&gt;&amp;nbsp;: That's an interesting idea. I haven't thought it through, but at a glance, it might work.&lt;/P&gt;</description>
      <pubDate>Fri, 03 May 2019 11:49:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/polylines-touching-or-crossing/m-p/8769227#M89084</guid>
      <dc:creator>doaiena</dc:creator>
      <dc:date>2019-05-03T11:49:19Z</dc:date>
    </item>
    <item>
      <title>Re: Polylines: touching or crossing</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/polylines-touching-or-crossing/m-p/8769298#M89085</link>
      <description>&lt;P&gt;Further questions....&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Are you talking about only and always &lt;EM&gt;closed&lt;/EM&gt;&amp;nbsp; Polylines?&amp;nbsp; Or other closed shapes [Circles, Ellipses, Splines]?&amp;nbsp; If so, there's one definitive condition: if there's only &lt;EM&gt;one&lt;/EM&gt;&amp;nbsp; intersection, that&amp;nbsp;means they touch but do not overlap, so no further analysis would be needed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And what about shapes that overlap but do &lt;EM&gt;not&lt;/EM&gt;&amp;nbsp; intersect?&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="PlineOverlap.PNG" style="width: 115px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/632854iE83B9CEB3F55009B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="PlineOverlap.PNG" alt="PlineOverlap.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 03 May 2019 12:17:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/polylines-touching-or-crossing/m-p/8769298#M89085</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2019-05-03T12:17:07Z</dc:date>
    </item>
    <item>
      <title>Re: Polylines: touching or crossing</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/polylines-touching-or-crossing/m-p/8769306#M89086</link>
      <description>&lt;P&gt;For 2 rectangles touched side by side , it will be 2 intersections.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;See the first post,please&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It have 2 case , rectangles overlapping , and rectangles touching&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 03 May 2019 12:20:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/polylines-touching-or-crossing/m-p/8769306#M89086</guid>
      <dc:creator>devitg</dc:creator>
      <dc:date>2019-05-03T12:20:30Z</dc:date>
    </item>
    <item>
      <title>Re: Polylines: touching or crossing</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/polylines-touching-or-crossing/m-p/8769329#M89087</link>
      <description>&lt;P&gt;Yes, i am talking about closed polylines. I wanted to know whether 2 plines are touching or crossing each other. It doesn't matter if one of the plines is inside or outside the other one.&lt;BR /&gt;&lt;BR /&gt;In the 1-st and 3-rd images in this thread, are cases where the plines produce 2 intersection points, both for crossing and touching.&lt;/P&gt;</description>
      <pubDate>Fri, 03 May 2019 12:37:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/polylines-touching-or-crossing/m-p/8769329#M89087</guid>
      <dc:creator>doaiena</dc:creator>
      <dc:date>2019-05-03T12:37:35Z</dc:date>
    </item>
    <item>
      <title>Re: Polylines: touching or crossing</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/polylines-touching-or-crossing/m-p/8769346#M89088</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1166654"&gt;@doaiena&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;....&lt;BR /&gt;In the 1-st and 3-rd images in this thread, are cases where the plines produce 2 intersection points, both for crossing and touching.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Yes, and the upper one in Message 3 is what I was talking about -- &lt;EM&gt;one&lt;/EM&gt;&amp;nbsp; intersection, so you don't need to bother analyzing whether they simply touch or overlap [as you would if there are more than one intersection], because if they're both closed, one intersection&amp;nbsp;can only&amp;nbsp;mean that they touch &lt;EM&gt;without&lt;/EM&gt;&amp;nbsp; overlapping.&lt;/P&gt;</description>
      <pubDate>Fri, 03 May 2019 12:47:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/polylines-touching-or-crossing/m-p/8769346#M89088</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2019-05-03T12:47:41Z</dc:date>
    </item>
    <item>
      <title>Re: Polylines: touching or crossing</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/polylines-touching-or-crossing/m-p/8770431#M89089</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/314908"&gt;@phanaem&lt;/a&gt;&amp;nbsp;: I turned your suggestion into code, and it seems to be working. So far it gives correct results on all of the test cases i throw at it. Thank you for the interesting idea.&lt;/P&gt;</description>
      <pubDate>Fri, 03 May 2019 20:42:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/polylines-touching-or-crossing/m-p/8770431#M89089</guid>
      <dc:creator>doaiena</dc:creator>
      <dc:date>2019-05-03T20:42:34Z</dc:date>
    </item>
    <item>
      <title>Re: Polylines: touching or crossing</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/polylines-touching-or-crossing/m-p/8770434#M89090</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=""&gt;&lt;A id="link_12" class="lia-link-navigation lia-page-link lia-user-name-link" href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1166654" target="_self"&gt;doaiena&lt;/A&gt;&amp;nbsp;, would you please , share your Lisp code.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class=""&gt;If you want , you can send me to my email&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class=""&gt;myusernamehere at gmail&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 03 May 2019 20:46:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/polylines-touching-or-crossing/m-p/8770434#M89090</guid>
      <dc:creator>devitg</dc:creator>
      <dc:date>2019-05-03T20:46:23Z</dc:date>
    </item>
    <item>
      <title>Re: Polylines: touching or crossing</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/polylines-touching-or-crossing/m-p/8770511#M89091</link>
      <description>&lt;P&gt;Offcourse, i will share it with everyone. It's not ready though. The code is not optimal, but i wrote it in a hurry, to test if this approach works. I commented the code, so that at least you can follow the logic somewhat. If you want, you can streamline and optimize the code, and post a better version.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;PRE&gt;(defun c:test ( / obj1 obj2 acadmodel inter interPts pts result)&lt;BR /&gt;&lt;BR /&gt;;NEEDS ERROR HANDLER

;select 2 closed polylines
(while (not obj1) (setq obj1 (car (entsel "\nSelect first polyline: "))))
(while (not obj2) (setq obj2 (car (entsel "\nSelect second polyline: "))))
(setq obj1 (vlax-ename-&amp;gt;vla-object obj1))
(setq obj2 (vlax-ename-&amp;gt;vla-object obj2))
(setq acadmodel (vla-get-modelspace (vla-get-activedocument (vlax-get-acad-object))))
(setq result "\nThe polylines do NOT touch")

;NEEDS TO BE ADDED:
;- restrict selection to polylines only
;- check if plines are closed - vlax-curve-isClosed


;check for intersection between the 2 plines
(setq inter (vlax-invoke obj1 'intersectwith obj2 acExtendNone))

;group intersection result into list of points
(repeat (/ (length inter) 3)
(setq result "\nThe polylines TOUCH")
(setq interPts (cons (list (car inter) (cadr inter) (caddr inter)) interPts))
(setq inter (cdddr inter))
)

;group the intersection points into pairs

;group first and last point if there are more than 2 points
(if (&amp;gt; (length interPts) 2)
(setq pts (cons (list (last interPts) (car interPts)) pts))
)

;group the remaining pairs of points
(while (&amp;gt; (length interPts) 1)
(setq pts (cons (list (car interPts) (cadr interPts)) pts))
(setq interPts (cdr interPts))
)

;if there is at least 1 pair of points
(if (&amp;gt; (length pts) 0)
(progn

;check if the pair of points are because of touching or crossing
(mapcar '(lambda ( x / pt1 pt2 pr1 pr2 prStart prEnd ptStart ptEnd prMid1 prMid2 ptMid1 ptMid2)

(setq pt1 (car x) pt2 (cadr x))
(setq pr1 (vlax-curve-getparamatpoint obj1 pt1))
(setq pr2 (vlax-curve-getparamatpoint obj1 pt2))
(setq prStart (vlax-curve-getStartParam obj1))
(setq prEnd (vlax-curve-getEndParam obj1))
(setq ptStart (vlax-curve-getpointatParam obj1 prStart))
(setq ptEnd (vlax-curve-getpointatParam obj1 prEnd))

;comment:
;on a closed pline the start and end parameter share the same point
;so if the start/end vertex is part of the calculation
;vlax-curve-getparamatpoint doesn't always return the correct parameter
;the cond statement below takes care of that

;get the parameters between the 2 points on each side
(cond
;if the first intersection point is the start/end vertex
((equal pt1 ptStart)
(setq prMid1 (+ (/ (abs (- prStart pr2)) 2) (min prStart pr2)))
(setq prMid2 (+ (/ (abs (- prEnd pr2)) 2) (min prEnd pr2)))
)
;if the second intersection point is the start/end vertex
((equal pt2 ptStart)
(setq prMid1 (+ (/ (abs (- pr1 prStart)) 2) (min pr1 prStart)))
(setq prMid2 (+ (/ (abs (- pr1 prEnd)) 2) (min pr1 prEnd)))
)
;if the intersection points DONT lie on the start/end vertex
(t
(setq prMid1 (+ (/ (abs (- pr1 pr2)) 2) (min pr1 pr2)))
(setq prMid2 (+ (+ (/ (abs (- pr1 pr2)) 2) (min pr1 pr2)) (/ prEnd 2)))
(if (&amp;gt; prMid2 prEnd) (setq prMid2 (- prMid2 prEnd)))
)
);cond

;get the points of the 2 mid parameters
(setq ptMid1 (vlax-curve-getpointatparam obj1 prMid1))
(setq ptMid2 (vlax-curve-getpointatparam obj1 prMid2))

;check if either of the mid points are inside the polyline using ray casting
(mapcar '(lambda (pt / pt2 ray inter)

(setq pt2 (vlax-curve-getclosestpointto obj2 pt))
(if (not (equal pt pt2 0.0001))
(progn
(setq ray (vla-addray acadmodel (vlax-3D-point pt) (vlax-3D-point pt2)))
(setq inter (vlax-invoke ray 'intersectwith obj2 acExtendNone))
(vla-delete ray)
(if (equal (rem (length inter) 2) 1) (setq result "\nThe polylines CROSS"))
))
)
(list ptMid1 ptMid2)
);mapcar

)
pts
);mapcar

));if 2 points intersect

(princ result)
(princ)
);defun&lt;/PRE&gt;</description>
      <pubDate>Fri, 03 May 2019 21:44:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/polylines-touching-or-crossing/m-p/8770511#M89091</guid>
      <dc:creator>doaiena</dc:creator>
      <dc:date>2019-05-03T21:44:39Z</dc:date>
    </item>
  </channel>
</rss>

