<?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 LISP Code for drawing perpendicular lines individually for the selected polyline from the selected set of points. so finally number points in the selection is equal to the number of lines generated. in AutoCAD Forum</title>
    <link>https://forums.autodesk.com/t5/autocad-forum/lisp-code-for-drawing-perpendicular-lines-individually-for-the/m-p/12390362#M25348</link>
    <description>&lt;P&gt;Hello Everyone,&lt;BR /&gt;I am Pankaj. I am Civil Engineer not from Programming background with lot of exploring mindset the below LISP code was drafted by me with the help of few open source knowledge and few debugging and correction process with the help of ChatGPT for drawing perpendicular&amp;nbsp;lines to the selected polyline from the selected points.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="lisp"&gt;(defun c:DLPP ()
;DLPP-Draw perpendicular lines for the selected polyline from the selected points
  (setq poly (car (nentsel "\nSelect polyline: ")))
  (setq poly-obj (vlax-ename-&amp;gt;vla-object poly))

  (setq ss (ssget "_:L" '((0 . "POINT"))))
  (setq points (list))
  
  (if ss
    (progn
      (setq numPoints (sslength ss))
      (setq i 0)
      (while (&amp;lt; i numPoints)
        (setq pt (cdr (assoc 10 (entget (ssname ss i)))))
        (setq points (cons pt points))
        (setq i (1+ i))
      )
    )
  )

  (foreach pt points
    (setq perp-point (vlax-curve-getClosestPointTo poly-obj pt))
    (command "line" pt perp-point "")
  )

  (princ)
)
&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;I am not sure what is the problem with this code i have tried all the possible debugging process but the perpendicular lines drawing process works only in few versions of the Autocad.&lt;BR /&gt;I am Using AUTOCAD 2024 in which it works as per my requirement.&lt;BR /&gt;But in another PC AUTOCAD 2023 in which certain start points are not taken correctly and it takes vertexes and mid between two vertexes as the start point which is resulting in not meeting the requirement.&lt;BR /&gt;&lt;BR /&gt;Please help me out with my code debugging process.&lt;BR /&gt;If needed please suggest me with the new approach of this LISP code for my idea of DLPP-Drawing Perpendicular lines for the selected polyline from the selected points.&lt;BR /&gt;&lt;BR /&gt;Thanks in Advance,&lt;BR /&gt;regards,&lt;BR /&gt;Pankaj&lt;/P&gt;</description>
    <pubDate>Tue, 21 Nov 2023 05:49:19 GMT</pubDate>
    <dc:creator>pankaj</dc:creator>
    <dc:date>2023-11-21T05:49:19Z</dc:date>
    <item>
      <title>LISP Code for drawing perpendicular lines individually for the selected polyline from the selected set of points. so finally number points in the selection is equal to the number of lines generated.</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/lisp-code-for-drawing-perpendicular-lines-individually-for-the/m-p/12390362#M25348</link>
      <description>&lt;P&gt;Hello Everyone,&lt;BR /&gt;I am Pankaj. I am Civil Engineer not from Programming background with lot of exploring mindset the below LISP code was drafted by me with the help of few open source knowledge and few debugging and correction process with the help of ChatGPT for drawing perpendicular&amp;nbsp;lines to the selected polyline from the selected points.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="lisp"&gt;(defun c:DLPP ()
;DLPP-Draw perpendicular lines for the selected polyline from the selected points
  (setq poly (car (nentsel "\nSelect polyline: ")))
  (setq poly-obj (vlax-ename-&amp;gt;vla-object poly))

  (setq ss (ssget "_:L" '((0 . "POINT"))))
  (setq points (list))
  
  (if ss
    (progn
      (setq numPoints (sslength ss))
      (setq i 0)
      (while (&amp;lt; i numPoints)
        (setq pt (cdr (assoc 10 (entget (ssname ss i)))))
        (setq points (cons pt points))
        (setq i (1+ i))
      )
    )
  )

  (foreach pt points
    (setq perp-point (vlax-curve-getClosestPointTo poly-obj pt))
    (command "line" pt perp-point "")
  )

  (princ)
)
&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;I am not sure what is the problem with this code i have tried all the possible debugging process but the perpendicular lines drawing process works only in few versions of the Autocad.&lt;BR /&gt;I am Using AUTOCAD 2024 in which it works as per my requirement.&lt;BR /&gt;But in another PC AUTOCAD 2023 in which certain start points are not taken correctly and it takes vertexes and mid between two vertexes as the start point which is resulting in not meeting the requirement.&lt;BR /&gt;&lt;BR /&gt;Please help me out with my code debugging process.&lt;BR /&gt;If needed please suggest me with the new approach of this LISP code for my idea of DLPP-Drawing Perpendicular lines for the selected polyline from the selected points.&lt;BR /&gt;&lt;BR /&gt;Thanks in Advance,&lt;BR /&gt;regards,&lt;BR /&gt;Pankaj&lt;/P&gt;</description>
      <pubDate>Tue, 21 Nov 2023 05:49:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/lisp-code-for-drawing-perpendicular-lines-individually-for-the/m-p/12390362#M25348</guid>
      <dc:creator>pankaj</dc:creator>
      <dc:date>2023-11-21T05:49:19Z</dc:date>
    </item>
    <item>
      <title>Re: LISP Code for drawing perpendicular lines individually for the selected polyline from the selected set of points. so finally number points in the selection is equal to the number of lines generate</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/lisp-code-for-drawing-perpendicular-lines-individually-for-the/m-p/12390376#M25349</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2023&amp;lt;&amp;gt;2024&lt;/P&gt;
&lt;P&gt;Different setting? Check your osnapcoord&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But you can also edit your code:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;(command "line" "non" pt "non" perp-point "")&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 21 Nov 2023 05:59:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/lisp-code-for-drawing-perpendicular-lines-individually-for-the/m-p/12390376#M25349</guid>
      <dc:creator>cadffm</dc:creator>
      <dc:date>2023-11-21T05:59:30Z</dc:date>
    </item>
    <item>
      <title>Re: LISP Code for drawing perpendicular lines individually for the selected polyline from the selected set of points. so finally number points in the selection is equal to the number of lines generate</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/lisp-code-for-drawing-perpendicular-lines-individually-for-the/m-p/12391188#M25350</link>
      <description>Thanks for you quick response.&lt;BR /&gt;I have checked as per suggestion "OSNAPCOORD" Both the Autocad versions has 2 as its value&lt;BR /&gt;Anyhow it had now worked in the both the versions with your modification line.&lt;BR /&gt;Thanks once again for your support.</description>
      <pubDate>Tue, 21 Nov 2023 12:59:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/lisp-code-for-drawing-perpendicular-lines-individually-for-the/m-p/12391188#M25350</guid>
      <dc:creator>pankaj</dc:creator>
      <dc:date>2023-11-21T12:59:11Z</dc:date>
    </item>
    <item>
      <title>Re: LISP Code for drawing perpendicular lines individually for the selected polyline from the selected set of points. so finally number points in the selection is equal to the number of lines generate</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/lisp-code-for-drawing-perpendicular-lines-individually-for-the/m-p/12391244#M25351</link>
      <description>&lt;P&gt;"&lt;SPAN&gt;Both the Autocad versions has 2 as its value"&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;In this case, you just had luck that it worked well, dependend on the current view!!!&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;(Pan/Zoom).&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;So it was also possible that it run fine in 2023, but not in your 2024,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Coincidence.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Osnapcoord=2 means: Your activated&amp;nbsp; running osnaps are ignored for (real)keyboard input, but is used for automated input - like script macro or (send)commands&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I changed the command-statement 2x to not use osnaps for the next coordinate input&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Nov 2023 13:21:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/lisp-code-for-drawing-perpendicular-lines-individually-for-the/m-p/12391244#M25351</guid>
      <dc:creator>cadffm</dc:creator>
      <dc:date>2023-11-21T13:21:52Z</dc:date>
    </item>
  </channel>
</rss>

