<?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: Lisp to create polyline with arrow in the ends, but not everytime! in AutoCAD Forum</title>
    <link>https://forums.autodesk.com/t5/autocad-forum/lisp-to-create-polyline-with-arrow-in-the-ends-but-not-everytime/m-p/10512279#M73617</link>
    <description>&lt;P&gt;This should do the work. You can pre-select the existing pline to add arrows to it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;(vl-load-com)
;; beekeecz 21-08-01

(defun c:PArrow ( / :PLAddVertex e len)

  ;; From Lee Mac's code
(defun :PLAddVertex (e p / tan LM:LWVertices a b e h l n r w x z)
  (defun tan ( x ) (if (not (equal 0.0 (cos x) 1e-10)) (/ (sin x) (cos x))))
  (defun LM:LWVertices ( e )
    (if (setq e (member (assoc 10 e) e))
      (cons (list (assoc 10 e) (assoc 40 e) (assoc 41 e) (assoc 42 e))
	    (LM:LWVertices (cdr e)))))
  
  (if (and p
	   e
	   (setq p (vlax-curve-getclosestpointto e (trans p 1 0))
		 n (vlax-curve-getparamatpoint e p)))
    (if (not (equal n (fix n) 1e-8))
      (progn
	(setq e (entget e)
	      h (reverse (member (assoc 39 e) (reverse e)))
	      l (LM:LWVertices e)
	      z (assoc 210 e))
	(repeat (fix n)
	  (setq a (cons (car l) a)
		l (cdr l)))
	(setq x (car l)
	      r (- n (fix n))
	      w (cdr (assoc 40 x))
	      w (+ w (* r (- (cdr (assoc 41 x)) w)))
	      b (atan (cdr (assoc 42 x))))
	(entmod (append h
			(apply 'append (reverse a))
			(list (assoc 10 x)
			      (assoc 40 x)
			      (cons  41 w)
			      (cons  42 (tan (* r b))))
			(list
			  (cons  10 (trans p 0 (cdr z)))
			  (cons  40 w)
			  (assoc 41 x)
			  (cons  42 (tan (* (- 1.0 r) b))))
			(apply 'append (cdr l))
			(list z)))))))

  ; -----------------------------------------------------------------------------------------------------

  (if (ssget "_I" '((0 . "LWPOLYLINE")))
    (setq e (ssname (ssget "_I") 0))
    (progn
      (command "_.pline") (while (&amp;gt; (getvar 'cmdactive) 0) (command pause))
      (setq e (entlast))))

  (setq o (vlax-ename-&amp;gt;vla-object e))

  (or *pa-t*
      (setq *pa-t* "End"))
  (initget "Start Both End")
  (setq *pa-t* (cond ((getkword (strcat "\nAdd arrows to [Start/Both/End] &amp;lt;" *pa-t* "&amp;gt;: "))) (*pa-t*)))

  (and (vl-position *pa-t* '("Start" "Both"))
       (&amp;lt; (vlax-curve-getparamatdist e 2.5) 1.)
       (:PlAddVertex e (vlax-curve-getpointatdist e 2.5))
       ;(not (vla-SetBulge o 0 0))
       (vla-SetWidth o 0 0 0.833))
  
  (and (vl-position *pa-t* '("End" "Both"))
       (setq len (vlax-curve-getdistatparam e (vlax-curve-getendparam e)))
       (&amp;lt; (- (vlax-curve-getendparam e) (vlax-curve-getparamatdist e (- len 2.5))) 1)
       (:PlAddVertex e (vlax-curve-getpointatdist e (- len 2.5)))
       ;(not (vla-SetBulge o (1- (vlax-curve-getendparam o)) 0))
       (vla-SetWidth o (1- (vlax-curve-getendparam o)) 0.833 0))
  (princ)
  )
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 01 Aug 2021 15:11:49 GMT</pubDate>
    <dc:creator>ВeekeeCZ</dc:creator>
    <dc:date>2021-08-01T15:11:49Z</dc:date>
    <item>
      <title>Lisp to create polyline with arrow in the ends, but not everytime!</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/lisp-to-create-polyline-with-arrow-in-the-ends-but-not-everytime/m-p/10506903#M73613</link>
      <description>&lt;P&gt;Dear all,&lt;BR /&gt;Can someone help me?&lt;BR /&gt;I need to create A LOT of polylines in my projects and sometimes they need to have an arrow at the beginning, end, or both, and I think a lisp like this could be helpful, instead of create a polyline then copy an arrow to the end.&lt;BR /&gt;I'm new with lisp and don't know hot to do it but I imagine something that, after the command, when I click on the screen pops up a window with options "yes" and "no" so I can choose to put an arrow on the beginning, then I would click on everywhere I need to extend my polyline, and in the end, with ESC, it opens another window asking me again if I want to leave an arrow in the end or not. All this made with the current layer. I've tried to use "leader" but it's not what I need, although the style of the arrow was fine! With leader the arrow should be "Closed Filled" with size 2.5, if that can help with the style.&lt;BR /&gt;&lt;BR /&gt;This is what I need:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Arrows.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/946723iDABB79DA9E5CE651/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Arrows.png" alt="Arrows.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I'm sorry if my english is not right, it's not used at all in my country&lt;BR /&gt;Since now, thank you for your attention!&lt;/P&gt;&lt;P&gt; &lt;/P&gt;</description>
      <pubDate>Thu, 29 Jul 2021 23:37:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/lisp-to-create-polyline-with-arrow-in-the-ends-but-not-everytime/m-p/10506903#M73613</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-07-29T23:37:58Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp to create polyline with arrow in the ends, but not everytime!</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/lisp-to-create-polyline-with-arrow-in-the-ends-but-not-everytime/m-p/10508103#M73614</link>
      <description>&lt;P&gt;Leaders should work fine. You can change the size in the style definition.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For LISP, I would suggest using the Customization and LISP forum.&lt;/P&gt;</description>
      <pubDate>Fri, 30 Jul 2021 12:04:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/lisp-to-create-polyline-with-arrow-in-the-ends-but-not-everytime/m-p/10508103#M73614</guid>
      <dc:creator>RobDraw</dc:creator>
      <dc:date>2021-07-30T12:04:22Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp to create polyline with arrow in the ends, but not everytime!</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/lisp-to-create-polyline-with-arrow-in-the-ends-but-not-everytime/m-p/10508267#M73615</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/569689"&gt;@RobDraw&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Leaders should work fine. ....&lt;/P&gt;
&lt;P&gt;For LISP, I would suggest using the Customization and LISP forum.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Leaders won't give you the both-ends option.&amp;nbsp; But I agree, the &lt;A href="https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/bd-p/130" target="_blank" rel="noopener"&gt;&amp;gt;Customization Forum&amp;lt;&lt;/A&gt; is the place to go.&lt;/P&gt;</description>
      <pubDate>Fri, 30 Jul 2021 13:05:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/lisp-to-create-polyline-with-arrow-in-the-ends-but-not-everytime/m-p/10508267#M73615</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2021-07-30T13:05:31Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp to create polyline with arrow in the ends, but not everytime!</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/lisp-to-create-polyline-with-arrow-in-the-ends-but-not-everytime/m-p/10511011#M73616</link>
      <description>&lt;P&gt;Personally, I don't use polylines for this. I use a block for the arrowheads and draw lines.&lt;/P&gt;</description>
      <pubDate>Sat, 31 Jul 2021 18:43:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/lisp-to-create-polyline-with-arrow-in-the-ends-but-not-everytime/m-p/10511011#M73616</guid>
      <dc:creator>RobDraw</dc:creator>
      <dc:date>2021-07-31T18:43:50Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp to create polyline with arrow in the ends, but not everytime!</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/lisp-to-create-polyline-with-arrow-in-the-ends-but-not-everytime/m-p/10512279#M73617</link>
      <description>&lt;P&gt;This should do the work. You can pre-select the existing pline to add arrows to it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;(vl-load-com)
;; beekeecz 21-08-01

(defun c:PArrow ( / :PLAddVertex e len)

  ;; From Lee Mac's code
(defun :PLAddVertex (e p / tan LM:LWVertices a b e h l n r w x z)
  (defun tan ( x ) (if (not (equal 0.0 (cos x) 1e-10)) (/ (sin x) (cos x))))
  (defun LM:LWVertices ( e )
    (if (setq e (member (assoc 10 e) e))
      (cons (list (assoc 10 e) (assoc 40 e) (assoc 41 e) (assoc 42 e))
	    (LM:LWVertices (cdr e)))))
  
  (if (and p
	   e
	   (setq p (vlax-curve-getclosestpointto e (trans p 1 0))
		 n (vlax-curve-getparamatpoint e p)))
    (if (not (equal n (fix n) 1e-8))
      (progn
	(setq e (entget e)
	      h (reverse (member (assoc 39 e) (reverse e)))
	      l (LM:LWVertices e)
	      z (assoc 210 e))
	(repeat (fix n)
	  (setq a (cons (car l) a)
		l (cdr l)))
	(setq x (car l)
	      r (- n (fix n))
	      w (cdr (assoc 40 x))
	      w (+ w (* r (- (cdr (assoc 41 x)) w)))
	      b (atan (cdr (assoc 42 x))))
	(entmod (append h
			(apply 'append (reverse a))
			(list (assoc 10 x)
			      (assoc 40 x)
			      (cons  41 w)
			      (cons  42 (tan (* r b))))
			(list
			  (cons  10 (trans p 0 (cdr z)))
			  (cons  40 w)
			  (assoc 41 x)
			  (cons  42 (tan (* (- 1.0 r) b))))
			(apply 'append (cdr l))
			(list z)))))))

  ; -----------------------------------------------------------------------------------------------------

  (if (ssget "_I" '((0 . "LWPOLYLINE")))
    (setq e (ssname (ssget "_I") 0))
    (progn
      (command "_.pline") (while (&amp;gt; (getvar 'cmdactive) 0) (command pause))
      (setq e (entlast))))

  (setq o (vlax-ename-&amp;gt;vla-object e))

  (or *pa-t*
      (setq *pa-t* "End"))
  (initget "Start Both End")
  (setq *pa-t* (cond ((getkword (strcat "\nAdd arrows to [Start/Both/End] &amp;lt;" *pa-t* "&amp;gt;: "))) (*pa-t*)))

  (and (vl-position *pa-t* '("Start" "Both"))
       (&amp;lt; (vlax-curve-getparamatdist e 2.5) 1.)
       (:PlAddVertex e (vlax-curve-getpointatdist e 2.5))
       ;(not (vla-SetBulge o 0 0))
       (vla-SetWidth o 0 0 0.833))
  
  (and (vl-position *pa-t* '("End" "Both"))
       (setq len (vlax-curve-getdistatparam e (vlax-curve-getendparam e)))
       (&amp;lt; (- (vlax-curve-getendparam e) (vlax-curve-getparamatdist e (- len 2.5))) 1)
       (:PlAddVertex e (vlax-curve-getpointatdist e (- len 2.5)))
       ;(not (vla-SetBulge o (1- (vlax-curve-getendparam o)) 0))
       (vla-SetWidth o (1- (vlax-curve-getendparam o)) 0.833 0))
  (princ)
  )
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 01 Aug 2021 15:11:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/lisp-to-create-polyline-with-arrow-in-the-ends-but-not-everytime/m-p/10512279#M73617</guid>
      <dc:creator>ВeekeeCZ</dc:creator>
      <dc:date>2021-08-01T15:11:49Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp to create polyline with arrow in the ends, but not everytime!</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/lisp-to-create-polyline-with-arrow-in-the-ends-but-not-everytime/m-p/10512510#M73618</link>
      <description>&lt;P&gt;Thank you very much for this LISP &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1779365"&gt;@ВeekeeCZ&lt;/a&gt;, it's just what I was in need! You're awesome!&lt;BR /&gt;When I use linetype "dashed" the arrow shows dashed too. Is it something that I need to correct on my AutoCAD?&lt;BR /&gt;If not, can you please fix this for me??&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Captura de tela 2021-08-01 153650.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/947390i13E4DAC183F89CC0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Captura de tela 2021-08-01 153650.png" alt="Captura de tela 2021-08-01 153650.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm sorry for using the wrong area, I'm new here. It won't happen again!&lt;/P&gt;</description>
      <pubDate>Sun, 01 Aug 2021 18:51:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/lisp-to-create-polyline-with-arrow-in-the-ends-but-not-everytime/m-p/10512510#M73618</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-08-01T18:51:21Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp to create polyline with arrow in the ends, but not everytime!</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/lisp-to-create-polyline-with-arrow-in-the-ends-but-not-everytime/m-p/14079495#M362281</link>
      <description>&lt;P&gt;Hi BeekeeCZ,&lt;/P&gt;&lt;P&gt;I like this routine, but is there a way to modify it to be able to use a block for the arrowhead at the ends and have it oriented (rotation / angle) in the same direction / angle of the polyline at the beginning and at the end?&lt;/P&gt;</description>
      <pubDate>Mon, 06 Apr 2026 16:42:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/lisp-to-create-polyline-with-arrow-in-the-ends-but-not-everytime/m-p/14079495#M362281</guid>
      <dc:creator>Erik_Le</dc:creator>
      <dc:date>2026-04-06T16:42:00Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp to create polyline with arrow in the ends, but not everytime!</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/lisp-to-create-polyline-with-arrow-in-the-ends-but-not-everytime/m-p/14079504#M362282</link>
      <description>&lt;P&gt;I also saw your other posting&amp;nbsp;&lt;A href="https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/routine-for-double-arrows/m-p/7800481#M108350" target="_blank" rel="noopener"&gt;https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/routine-for-double-arrows/m-p/7800481#M108350&lt;/A&gt;&amp;nbsp;, but this seems to only draw one segment line. Can I combine the two routines to draw a multi-segmented polyline (possibly with arcs) with a block of an arrowhead pointing in the correct direction? I appreciate any guidance.&lt;/P&gt;</description>
      <pubDate>Mon, 06 Apr 2026 16:47:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/lisp-to-create-polyline-with-arrow-in-the-ends-but-not-everytime/m-p/14079504#M362282</guid>
      <dc:creator>Erik_Le</dc:creator>
      <dc:date>2026-04-06T16:47:26Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp to create polyline with arrow in the ends, but not everytime!</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/lisp-to-create-polyline-with-arrow-in-the-ends-but-not-everytime/m-p/14080571#M362302</link>
      <description>&lt;P&gt;This should do the trick.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;(vl-load-com)

(defun c:ArrowDouble ( / pnt enl ent ss i)

  (if (setq pnt (getpoint "\nFirst point &amp;lt;select&amp;gt;: "))
    (progn
      (setq enl (entlast))
      &lt;STRONG&gt;(command-s "_.PLINE" "_none" pnt)&lt;/STRONG&gt;
      (if (not (equal enl (setq enl (entlast))))
	(setq ss (ssadd enl))))
    (setq ss (ssget "_:L" '((0 . "LWPOLYLINE,LINE,ARC")))))

  (if ss
    (repeat (setq i (sslength ss))
      (setq ent (ssname ss (setq i (1- i))))
      
      (command "._INSERT"
               "DIM-AH"
               "_Scale" (/ 1. (getvar 'CANNOSCALEVALUE) 120)
               "_Rotate" "_none" (trans (vlax-curve-getFirstDeriv ent (vlax-curve-getParamAtPoint ent (vlax-curve-getStartPoint ent))) 0 1) "_none" (trans '(0 0 0) 0 1) 
               "_none" (trans (vlax-curve-getStartPoint ent) 0 1))

      (command "._INSERT"
               "DIM-AH"
               "_Scale" (/ 1. (getvar 'CANNOSCALEVALUE) 120)
               "_Rotate" "_none" (trans '(0 0 0) 0 1) "_none" (trans (vlax-curve-getFirstDeriv ent (vlax-curve-getParamAtPoint ent (vlax-curve-getEndPoint ent))) 0 1)
               "_none" (trans (vlax-curve-getEndPoint ent) 0 1))))
  (princ)
)
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Apr 2026 14:07:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/lisp-to-create-polyline-with-arrow-in-the-ends-but-not-everytime/m-p/14080571#M362302</guid>
      <dc:creator>ВeekeeCZ</dc:creator>
      <dc:date>2026-04-07T14:07:58Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp to create polyline with arrow in the ends, but not everytime!</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/lisp-to-create-polyline-with-arrow-in-the-ends-but-not-everytime/m-p/14080632#M362305</link>
      <description>&lt;P&gt;Genius! Thanks a bunch! This is exactly what I was looking for. If you are looking for additional challenge, is there a way to dynamically adjust the polyline with grips so that if the ends of the line get adjusted the arrowheads would adjust with the polyline?&lt;/P&gt;&lt;P&gt;Thanks again!&lt;/P&gt;</description>
      <pubDate>Tue, 07 Apr 2026 15:35:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/lisp-to-create-polyline-with-arrow-in-the-ends-but-not-everytime/m-p/14080632#M362305</guid>
      <dc:creator>Erik_Le</dc:creator>
      <dc:date>2026-04-07T15:35:34Z</dc:date>
    </item>
  </channel>
</rss>

