<?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: Extracting Coordinates from a polyline in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/extracting-coordinates-from-a-polyline/m-p/9681004#M71620</link>
    <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;Its work for me&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;.&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="20200809_124653.gif" style="width: 720px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/805242iA78FC22A8E3680C6/image-size/large?v=v2&amp;amp;px=999" role="button" title="20200809_124653.gif" alt="20200809_124653.gif" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;See that, working sample.&lt;/P&gt;&lt;P&gt;Try with this lisp.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;(If&amp;nbsp; (not work)&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (post your AutoCAD Version)&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (Enjoy)&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;)&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;&lt;EM&gt;&lt;FONT face="comic sans ms,sans-serif"&gt;"Sorry for late reply, Because I went vacation."&lt;/FONT&gt; &lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
    <pubDate>Sun, 09 Aug 2020 07:34:29 GMT</pubDate>
    <dc:creator>kajanthangavel</dc:creator>
    <dc:date>2020-08-09T07:34:29Z</dc:date>
    <item>
      <title>Extracting Coordinates from a polyline</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/extracting-coordinates-from-a-polyline/m-p/9668902#M71615</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to get a lisp extract the X and Y coordinates of series points on a polyline&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;First situation is the points divide polyline with&amp;nbsp; equal interval (for example 1 meter).&lt;/P&gt;&lt;P&gt;without lisp, I can do is use measure command, put points along polyline every 1 meter, then use dataextraction to get all points coordinates.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Second situation, the points have equal increasing on x. For example, increase 1 meter each time, I need find y value at the point x =&amp;nbsp;&amp;nbsp;1, 2, 3,.... until end.&lt;/P&gt;&lt;P&gt;without lips, I can do is drawing array of lines with interval 1 meter, then trim them by the polyline, use dataextaction to get all lines end point y value.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope can have some lisps to solve my two problems and speed up my work, highly appreciate if anyone can help!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Bin&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Aug 2020 01:30:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/extracting-coordinates-from-a-polyline/m-p/9668902#M71615</guid>
      <dc:creator>Bin2009</dc:creator>
      <dc:date>2020-08-03T01:30:20Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting Coordinates from a polyline</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/extracting-coordinates-from-a-polyline/m-p/9669069#M71616</link>
      <description>&lt;P&gt;Try this.&lt;/P&gt;&lt;P&gt;for your first requirement&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="20200803_103953.gif" style="width: 640px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/802479iA464CE4CDF92F5F6/image-size/large?v=v2&amp;amp;px=999" role="button" title="20200803_103953.gif" alt="20200803_103953.gif" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;It working Like this&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(defun c:brk (/ *error* k_len kchain file ov dis cEnt pt)
  (vl-load-com)

	(defun *error* (msg)
		(close file)
		(command "_.UNDO" "_B")
		(mapcar 'setvar svnames svvals)
		(if (not (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*"))
		(princ (strcat "\n&amp;lt;&amp;lt; Error: " msg " &amp;gt;&amp;gt;")))
		(princ)
	)

	(command "_.UNDO" "_M")
	(vla-startundomark (setq doc (vla-get-activedocument (vlax-get-acad-object))))
	(setq svnames '(osmode cmdecho blipmode plinewid))
	(setq svvals (mapcar 'getvar svnames))
	(setq kchain 1)
	(setq file (open (strcat (getvar 'dwgprefix) "coordnate.csv") "w"))
	(mapcar 'setvar svnames '(0 0 0 0))
	(write-line (strcat "Number" "," "X-Coor" "," "Y-Coor" "," "X-Coor") file)
	(or (= (type k_len) 'REAL)(setq k_len 1.0))
	(not (initget 6))
		(if (setq dis (getdist (strcat "\nLength of stripe &amp;lt;" (rtos k_len (getvar "lunits") 2) "&amp;gt;: ")))
			(setq k_len dis)
			(setq dis k_len)
		)
	(while (and (setq cEnt (car (entsel "\nSelect Polyline: ")))
				(vl-position (cdadr (entget cEnt)) '("LINE" "LWPOLYLINE" "POLYLINE" "ARC" "SPLINE")))
		(while (and (setq pt (vlax-curve-getPointatDist cEnt dis))
					(&amp;gt;= (distance pt (vlax-curve-getEndPoint cEnt)) dis))
					
		(command "_.break" (list cEnt pt) "_F" pt pt)

			(princ (strcat "
"(rtos kchain 2 0) "," (rtos (car pt) 2 3) "," (rtos (cadr pt) 2 3) "," (rtos (caddr pt) 2 3)))
			(progn
				(write-line (strcat (rtos kchain 2 0) "," (rtos (car pt) 2 3) "," (rtos (cadr pt) 2 3) "," (rtos (caddr pt) 2 3)) file)
				(setq kchain (+ kchain 1))
			)
		(setq cEnt (entlast))
		)
	)
	(close file)
	(command "_.UNDO" "_B")
	(mapcar 'setvar svnames svvals)
	(vla-endundomark doc)
(princ)
)&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 not Lisp Expert&lt;/P&gt;</description>
      <pubDate>Mon, 03 Aug 2020 05:14:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/extracting-coordinates-from-a-polyline/m-p/9669069#M71616</guid>
      <dc:creator>kajanthangavel</dc:creator>
      <dc:date>2020-08-03T05:14:47Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting Coordinates from a polyline</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/extracting-coordinates-from-a-polyline/m-p/9669208#M71617</link>
      <description>&lt;P&gt;This it your 2nd requirement&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="This is working like this" style="width: 640px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/802504iCCE595EA52BA67B4/image-size/large?v=v2&amp;amp;px=999" role="button" title="20200803_125910.gif" alt="This is working like this" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;This is working like this&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;This is working sample&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Try this code&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(defun C:xcoor (/ *error* doc svnames svvals ss n plobj LL xl xlobj intc file kchain k_len dis)

  (defun *error* (errmsg)
    (if (not (wcmatch errmsg "Function cancelled,quit / exit abort,console break"))
      (princ (strcat "\nError: " errmsg))
    )
    (mapcar 'setvar svnames svvals)
    (vla-endundomark doc)
	(close file)
    (princ)
  )
 
(vla-startundomark (setq doc (vla-get-activedocument (vlax-get-acad-object))))
(setq svnames '(osmode cmdecho blipmode plinewid))
(setq svvals (mapcar 'getvar svnames))
(setq file (open (strcat (getvar 'dwgprefix) "X_level_corrdinate.csv") "w"))
(write-line (strcat "Number" "," "X-Coor" "," "Y-Coor") file)
(mapcar 'setvar svnames '(0 0 0 0))
(setq kchain 1)
	(or (= (type k_len) 'REAL)(setq k_len 1.0))
	(not (initget 6))
		(if (setq dis (getdist (strcat "\nX axsi Length &amp;lt;" (rtos k_len (getvar "lunits") 1) "&amp;gt;: ")))
			(setq k_len dis)
			(setq dis k_len)
		)
(prompt "\nSelect Polyline(s),")
  (if (setq ss (ssget '((0 . "*POLYLINE"))))
    (progn
      (mapcar 'setvar svnames '(0 0 0 0))
      (repeat	(setq n (sslength ss))
				(setq plobj (vlax-ename-&amp;gt;vla-object (ssname ss (setq n (1- n)))))
				(vla-getboundingbox plobj 'minpt 'maxpt)
				(setq LL (vlax-safearray-&amp;gt;list minpt))
				(command "_.xline" "_ver" LL "")
				(setq xl (entlast) xlobj (vlax-ename-&amp;gt;vla-object xl))
				(repeat (1+ (fix (/ (- (car (vlax-safearray-&amp;gt;list maxpt)) (car LL)) dis)))
					(setq intc (vlax-invoke plobj 'IntersectWith xlobj acExtendNone))
					(princ (strcat "
					" (rtos kchain 2 0) " " (rtos (car intc) 2 3) " " (rtos (cadr intc) 2 3)))
					(write-line (strcat (rtos kchain 2 0) "," (rtos (car intc) 2 3) "," (rtos (cadr intc) 2 3)) file)
					(command "_.move" xl "" (list dis 0) "")
					(setq kchain (+ kchain 1))
				)
				(entdel xl)
      )
    )
    (prompt "\nNo Polyline(s) selected.")
  )
(close file)

(mapcar 'setvar svnames svvals)
(vla-endundomark doc)
(princ)
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am not lisp expert&lt;/P&gt;&lt;P&gt;I hope this is help you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Aug 2020 07:35:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/extracting-coordinates-from-a-polyline/m-p/9669208#M71617</guid>
      <dc:creator>kajanthangavel</dc:creator>
      <dc:date>2020-08-03T07:35:14Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting Coordinates from a polyline</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/extracting-coordinates-from-a-polyline/m-p/9671072#M71618</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;SPAN class="UserName lia-user-name lia-user-rank-Enthusiast lia-component-message-view-widget-author-username"&gt;&lt;A href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/6662555" target="_self"&gt;&lt;SPAN class=""&gt;kajanthangavel,&lt;/SPAN&gt;&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="UserName lia-user-name lia-user-rank-Enthusiast lia-component-message-view-widget-author-username"&gt;&lt;SPAN class=""&gt;Thank very much for your lisp, I think you helped me before.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="UserName lia-user-name lia-user-rank-Enthusiast lia-component-message-view-widget-author-username"&gt;&lt;SPAN class=""&gt;I tried this lisp, it works great when the polyline made from lines, but if the polyline contain curves, it looks can't go through, could you please help, I attach one polyline I need work with.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="UserName lia-user-name lia-user-rank-Enthusiast lia-component-message-view-widget-author-username"&gt;&lt;SPAN class=""&gt;Thanks so much!&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="UserName lia-user-name lia-user-rank-Enthusiast lia-component-message-view-widget-author-username"&gt;&lt;SPAN class=""&gt;Bin&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Aug 2020 03:14:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/extracting-coordinates-from-a-polyline/m-p/9671072#M71618</guid>
      <dc:creator>Bin2009</dc:creator>
      <dc:date>2020-08-04T03:14:43Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting Coordinates from a polyline</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/extracting-coordinates-from-a-polyline/m-p/9671076#M71619</link>
      <description>&lt;P&gt;Hello&amp;nbsp;kajanthangavel,&lt;/P&gt;&lt;P&gt;Thank very much for your lisp,&amp;nbsp; it works great!&lt;/P&gt;&lt;P&gt;Bin&lt;/P&gt;</description>
      <pubDate>Tue, 04 Aug 2020 03:16:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/extracting-coordinates-from-a-polyline/m-p/9671076#M71619</guid>
      <dc:creator>Bin2009</dc:creator>
      <dc:date>2020-08-04T03:16:24Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting Coordinates from a polyline</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/extracting-coordinates-from-a-polyline/m-p/9681004#M71620</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;Its work for me&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;.&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="20200809_124653.gif" style="width: 720px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/805242iA78FC22A8E3680C6/image-size/large?v=v2&amp;amp;px=999" role="button" title="20200809_124653.gif" alt="20200809_124653.gif" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;See that, working sample.&lt;/P&gt;&lt;P&gt;Try with this lisp.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;(If&amp;nbsp; (not work)&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (post your AutoCAD Version)&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (Enjoy)&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;)&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;&lt;EM&gt;&lt;FONT face="comic sans ms,sans-serif"&gt;"Sorry for late reply, Because I went vacation."&lt;/FONT&gt; &lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 09 Aug 2020 07:34:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/extracting-coordinates-from-a-polyline/m-p/9681004#M71620</guid>
      <dc:creator>kajanthangavel</dc:creator>
      <dc:date>2020-08-09T07:34:29Z</dc:date>
    </item>
  </channel>
</rss>

