<?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: How to reverse a polyline using an AutoCAD Lisp in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-reverse-a-polyline-using-an-autocad-lisp/m-p/12548340#M18067</link>
    <description>&lt;P&gt;&lt;SPAN&gt;Thank you for your response. What I need is to create a Lisp routine to automate a repetitive task. I need to address the issue of reversing as part of a larger code.&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 08 Feb 2024 12:19:45 GMT</pubDate>
    <dc:creator>n.lagos.pdr</dc:creator>
    <dc:date>2024-02-08T12:19:45Z</dc:date>
    <item>
      <title>How to reverse a polyline using an AutoCAD Lisp</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-reverse-a-polyline-using-an-autocad-lisp/m-p/12547488#M18063</link>
      <description>&lt;P&gt;&lt;SPAN&gt;How to create a Lisp routine that applies the reverse command to a polyline drawn from right to left, and at the same time does not apply the reverse command if it was drawn from left to right?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Feb 2024 12:24:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-reverse-a-polyline-using-an-autocad-lisp/m-p/12547488#M18063</guid>
      <dc:creator>n.lagos.pdr</dc:creator>
      <dc:date>2024-02-08T12:24:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to reverse a polyline using an AutoCAD Lisp</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-reverse-a-polyline-using-an-autocad-lisp/m-p/12547501#M18064</link>
      <description>&lt;P&gt;What if it was drawn from top to bottom?&amp;nbsp; [That is, will there always be an unmistakeable "right" and "left"?]&amp;nbsp; What if it goes around, or zigzags, or otherwise has parts going in opposite directions?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And why?&amp;nbsp; If it's for the uprightness of text elements, in recent-enough versions linetypes can be defined so it doesn't matter in which direction it was drawn.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Feb 2024 03:13:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-reverse-a-polyline-using-an-autocad-lisp/m-p/12547501#M18064</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2024-02-08T03:13:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to reverse a polyline using an AutoCAD Lisp</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-reverse-a-polyline-using-an-autocad-lisp/m-p/12548210#M18065</link>
      <description>&lt;P&gt;Regards&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/10825519"&gt;@n.lagos.pdr&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;By pressing the icon or typing REVERSE in the command bar, you can do what you need&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="calderg1000_0-1707390634737.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1323853i4A4710602C9B4BB4/image-size/medium?v=v2&amp;amp;px=400" role="button" title="calderg1000_0-1707390634737.png" alt="calderg1000_0-1707390634737.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Feb 2024 11:12:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-reverse-a-polyline-using-an-autocad-lisp/m-p/12548210#M18065</guid>
      <dc:creator>calderg1000</dc:creator>
      <dc:date>2024-02-08T11:12:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to reverse a polyline using an AutoCAD Lisp</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-reverse-a-polyline-using-an-autocad-lisp/m-p/12548336#M18066</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Thank you very much for addressing my question. I want to create a routine in AutoLISP to automate a repetitive task in my work. This task involves measuring certain polylines to insert blocks aligned with them. The polylines are drawn by another person, so they do not take care to create them in the same orientation. The LISP routine I want to create should select a polyline and perform a reverse when the leftmost vertex is not vertex 1, and then apply the measure command.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Feb 2024 12:18:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-reverse-a-polyline-using-an-autocad-lisp/m-p/12548336#M18066</guid>
      <dc:creator>n.lagos.pdr</dc:creator>
      <dc:date>2024-02-08T12:18:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to reverse a polyline using an AutoCAD Lisp</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-reverse-a-polyline-using-an-autocad-lisp/m-p/12548340#M18067</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Thank you for your response. What I need is to create a Lisp routine to automate a repetitive task. I need to address the issue of reversing as part of a larger code.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Feb 2024 12:19:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-reverse-a-polyline-using-an-autocad-lisp/m-p/12548340#M18067</guid>
      <dc:creator>n.lagos.pdr</dc:creator>
      <dc:date>2024-02-08T12:19:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to reverse a polyline using an AutoCAD Lisp</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-reverse-a-polyline-using-an-autocad-lisp/m-p/12548498#M18068</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/10825519"&gt;@n.lagos.pdr&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&lt;SPAN&gt;....&amp;nbsp; The LISP routine I want to create should select a polyline and perform a reverse when the leftmost vertex is not vertex 1, and then apply the measure command.&lt;/SPAN&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;When you say "the leftmost vertex is not vertex 1," do you mean only that vertex 1 is not at a &lt;EM&gt;lower X-coordinate value&lt;/EM&gt; than the end vertex?&amp;nbsp; Could the leftmost vertex be neither the first nor last one?&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Kent1Cooper_0-1707398414966.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1323955i175D79E369DC6B37/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Kent1Cooper_0-1707398414966.png" alt="Kent1Cooper_0-1707398414966.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;EDIT:&amp;nbsp; If it's only a question of Reversing when the start is to the right of the end, try this:&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;(defun C:SLE (/ esel pl); = Start at Left End
  (if
    (and
      (setq esel (entsel "\nPolyline or Line to Reverse if drawn right-to-left: "))
      (wcmatch (cdr (assoc 0 (entget (setq pl (car esel))))) "*POLYLINE,LINE") 
    ); and
    (if (&amp;gt; (car (vlax-curve-getStartPoint pl)) (car (vlax-curve-getEndPoint pl)))
      (command "_.reverse" pl ""); then
    ); if
    (prompt "\nNothing selected, or not a Polyline or Line.")
  )
  (prin1)
)&lt;/LI-CODE&gt;
&lt;P&gt;If it's vertical or closed [X coordinates of start and end are equal], it will not be reversed.&lt;/P&gt;
&lt;P&gt;Since the same standard can be applied to a Line by the same approach, it allows for them.&amp;nbsp; It could also allow a Spline or even a Helix, but REVERSE won't work on other things [e.g. an Arc].&amp;nbsp; If those or other kinds of paths are wanted, it could be done [see my &lt;STRONG&gt;ReverseDirection.lsp&lt;/STRONG&gt; routine, &lt;A href="https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/reverse-direction-of-any-directional-entity/m-p/3586080/highlight/true#M306038" target="_blank" rel="noopener"&gt;&amp;gt;here&amp;lt;&lt;/A&gt;].&lt;/P&gt;</description>
      <pubDate>Thu, 08 Feb 2024 13:42:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-reverse-a-polyline-using-an-autocad-lisp/m-p/12548498#M18068</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2024-02-08T13:42:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to reverse a polyline using an AutoCAD Lisp</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-reverse-a-polyline-using-an-autocad-lisp/m-p/12549911#M18069</link>
      <description>Great, the Lisp you provided completely meets my needs. Thank you very much</description>
      <pubDate>Fri, 09 Feb 2024 03:14:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-reverse-a-polyline-using-an-autocad-lisp/m-p/12549911#M18069</guid>
      <dc:creator>n.lagos.pdr</dc:creator>
      <dc:date>2024-02-09T03:14:01Z</dc:date>
    </item>
  </channel>
</rss>

