<?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 - export coordinates to XML in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-export-coordinates-to-xml/m-p/10991359#M89557</link>
    <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(vl-load-com)

(defun c:PlineToXml (/ *error* :ReadFile :XmlPoint xml f vrs i)


    (defun *error* (errmsg)
    (if (not (wcmatch errmsg "Function cancelled,quit / exit abort,console break,end"))
      (princ (strcat "\nError: " errmsg)))
    (if f (close f))
    (princ))
  
  (defun :ReadFile (name / lst)
    (if (setq f (open name "r"))
      (while (setq l (read-line f))
        (setq lst (cons l lst))))
    (if f (close f))
    (reverse lst))
  
  (defun :XmlPoint (p i /)
    (list "  &amp;lt;Points&amp;gt;"
          (strcat "    &amp;lt;POINTID&amp;gt;" i "&amp;lt;/POINTID&amp;gt;")
          (strcat "    &amp;lt;IMMOVABLEID&amp;gt;1&amp;lt;/IMMOVABLEID&amp;gt;")
          (strcat "    &amp;lt;NO&amp;gt;" i "&amp;lt;/NO&amp;gt;")
          (strcat "    &amp;lt;X&amp;gt;" (rtos (car  p) 2 8 ) "&amp;lt;/X&amp;gt;")
          (strcat "    &amp;lt;Y&amp;gt;" (rtos (cadr p) 2 8 ) "&amp;lt;/Y&amp;gt;")
          "  &amp;lt;/Points&amp;gt;"))
  
  ; ---------------------------------------------------------------
  
  (or *p2x-path*
      (setq *p2x-path* (getvar 'DWGPREFIX)))
  
  (if (and (setq ss (ssget "_+.:E:S" '((0 . "LWPOLYLINE"))))
           (setq name (getfiled "Select XML file: " *p2x-path* "cgxml" 4))
           (setq *p2x-path* (strcat (vl-filename-directory name) "\\"))
           (setq xml (:ReadFile name))
           (setq vrs (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 10)) (entget (ssname ss 0)))))
           (setq f (open name "w"))
           (setq i 0) ; initial number is i+1
           )
    (progn
      (while (and (car xml)
                  (not (wcmatch (strcase (car xml) T) "*&amp;lt;points&amp;gt;*"))) 	; write back all until &amp;lt;registration&amp;gt; or &amp;lt;point*&amp;gt; tag reached
        (write-line (car xml) f)
        (setq xml (cdr xml)))
      
      (foreach vrt vrs									; write all new points
        (foreach l (:XmlPoint vrt (itoa (setq i (1+ i))))
         (write-line l f)))

      (while (and (car xml)								; skip all current &amp;lt;points&amp;gt; if there are any (untill &amp;lt;address&amp;gt; tag reached)
            (not (wcmatch (strcase (car xml) T) "*&amp;lt;address&amp;gt;*")))
	
      (setq xml (cdr xml)))
      
      (while (car xml)									; write all the rest.
        (write-line (car xml) f)
        (setq xml (cdr xml)))
      (close f)
      ))
  (princ)
  )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;Try this! Modify only line with &amp;lt;address&amp;gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 08 Mar 2022 15:01:52 GMT</pubDate>
    <dc:creator>bcddss</dc:creator>
    <dc:date>2022-03-08T15:01:52Z</dc:date>
    <item>
      <title>LISP - export coordinates to XML</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-export-coordinates-to-xml/m-p/8747445#M89549</link>
      <description>&lt;P&gt;Hi !&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;hi !&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;my list command shows me :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;LWPOLYLINE Layer: "0"&lt;BR /&gt;Space: Model space&lt;BR /&gt;Handle = 2a4&lt;BR /&gt;Closed&lt;BR /&gt;Constant width 0.0000&lt;BR /&gt;area 4322.9452&lt;BR /&gt;perimeter 443.9655&lt;/P&gt;
&lt;P&gt;at point X= 27.8339 Y= 47.2804 Z= 0.0000&lt;BR /&gt;at point X= 218.0915 Y= 108.9413 Z= 0.0000&lt;BR /&gt;at point X= 223.3759 Y= 91.6231 Z= 0.0000&lt;BR /&gt;at point X= 34.6587 Y= 23.1296 Z= 0.0000&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;i want to export just the coordinates , but in this format :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;lt;Points&amp;gt;&lt;BR /&gt;&amp;lt;POINTID&amp;gt;1&amp;lt;/POINTID&amp;gt;&lt;BR /&gt;&amp;lt;IMMOVABLEID&amp;gt;1&amp;lt;/IMMOVABLEID&amp;gt;&lt;BR /&gt;&amp;lt;NO&amp;gt;1&amp;lt;/NO&amp;gt;&lt;BR /&gt;&amp;lt;X&amp;gt;27.8339&amp;lt;/X&amp;gt;&lt;BR /&gt;&amp;lt;Y&amp;gt;47.2804&amp;lt;/Y&amp;gt;&lt;BR /&gt;&amp;lt;/Points&amp;gt;&lt;BR /&gt;&amp;lt;Points&amp;gt;&lt;BR /&gt;&amp;lt;POINTID&amp;gt;2&amp;lt;/POINTID&amp;gt;&lt;BR /&gt;&amp;lt;IMMOVABLEID&amp;gt;1&amp;lt;/IMMOVABLEID&amp;gt;&lt;BR /&gt;&amp;lt;NO&amp;gt;2&amp;lt;/NO&amp;gt;&lt;BR /&gt;&amp;lt;X&amp;gt;218.0915&amp;lt;/X&amp;gt;&lt;BR /&gt;&amp;lt;Y&amp;gt;108.9413&amp;lt;/Y&amp;gt;&lt;BR /&gt;&amp;lt;/Points&amp;gt;&lt;BR /&gt;&amp;lt;Points&amp;gt;&lt;BR /&gt;&amp;lt;POINTID&amp;gt;3&amp;lt;/POINTID&amp;gt;&lt;BR /&gt;&amp;lt;IMMOVABLEID&amp;gt;1&amp;lt;/IMMOVABLEID&amp;gt;&lt;BR /&gt;&amp;lt;NO&amp;gt;3&amp;lt;/NO&amp;gt;&lt;BR /&gt;&amp;lt;X&amp;gt;223.3759&amp;lt;/X&amp;gt;&lt;BR /&gt;&amp;lt;Y&amp;gt;491.6231&amp;lt;/Y&amp;gt;&lt;BR /&gt;&amp;lt;/Points&amp;gt;&lt;BR /&gt;&amp;lt;Points&amp;gt;&lt;BR /&gt;&amp;lt;POINTID&amp;gt;4&amp;lt;/POINTID&amp;gt;&lt;BR /&gt;&amp;lt;IMMOVABLEID&amp;gt;1&amp;lt;/IMMOVABLEID&amp;gt;&lt;BR /&gt;&amp;lt;NO&amp;gt;4&amp;lt;/NO&amp;gt;&lt;BR /&gt;&amp;lt;X&amp;gt;34.6587&amp;lt;/X&amp;gt;&lt;BR /&gt;&amp;lt;Y&amp;gt;23.1296&amp;lt;/Y&amp;gt;&lt;BR /&gt;&amp;lt;/Points&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if it has 3 points , to export 3 points ... if it has 50 points , to export 50 points , starting with point 1 on each export.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;can it be done to ask me where to export it ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;i attached a file with the coordinates and a file without the coordinates ...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thatks !&lt;/P&gt;</description>
      <pubDate>Tue, 23 Apr 2019 12:54:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-export-coordinates-to-xml/m-p/8747445#M89549</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-04-23T12:54:09Z</dc:date>
    </item>
    <item>
      <title>Re: LISP - export coordinates to XML</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-export-coordinates-to-xml/m-p/8747615#M89550</link>
      <description>&lt;P&gt;Should be entirely possible.&amp;nbsp; You might want to make a couple of changes though, if the XML content will allow it.&amp;nbsp; Consider changing the &amp;lt;Points&amp;gt; element name to a singular Point for clarity.&amp;nbsp; And start the vertex numbering at 0 rather than 1, which will help with later processing.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Apr 2019 14:00:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-export-coordinates-to-xml/m-p/8747615#M89550</guid>
      <dc:creator>dgorsman</dc:creator>
      <dc:date>2019-04-23T14:00:27Z</dc:date>
    </item>
    <item>
      <title>Re: LISP - export coordinates to XML</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-export-coordinates-to-xml/m-p/8747634#M89551</link>
      <description>&lt;P&gt;This should work. Since I have no experience with XML structure consider&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/253793"&gt;@dgorsman&lt;/a&gt;'s notes.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;(vl-load-com)

(defun c:PlineToXml (/ *error* :ReadFile :XmlPoint xml f vrs i)


    (defun *error* (errmsg)
    (if (not (wcmatch errmsg "Function cancelled,quit / exit abort,console break,end"))
      (princ (strcat "\nError: " errmsg)))
    (if f (close f))
    (princ))
  
  (defun :ReadFile (name / lst)
    (if (setq f (open name "r"))
      (while (setq l (read-line f))
        (setq lst (cons l lst))))
    (if f (close f))
    (reverse lst))
  
  (defun :XmlPoint (p i /)
    (list "  &amp;lt;Points&amp;gt;"
          (strcat "    &amp;lt;POINTID&amp;gt;" i "&amp;lt;/POINTID&amp;gt;")
          (strcat "    &amp;lt;IMMOVABLEID&amp;gt;1&amp;lt;/IMMOVABLEID&amp;gt;")
          (strcat "    &amp;lt;NO&amp;gt;" i "&amp;lt;/NO&amp;gt;")
          (strcat "    &amp;lt;X&amp;gt;" (rtos (car  p) 2 3 ) "&amp;lt;/X&amp;gt;")
          (strcat "    &amp;lt;Y&amp;gt;" (rtos (cadr p) 2 3 ) "&amp;lt;/Y&amp;gt;")
          "  &amp;lt;/Points&amp;gt;"))
  
  ; ---------------------------------------------------------------
  
  (or *p2x-path*
      (setq *p2x-path* (getvar 'DWGPREFIX)))
  
  (if (and (setq ss (ssget "_+.:E:S" '((0 . "LWPOLYLINE"))))
           (setq name (getfiled "Select XML file: " *p2x-path* "cgxml" 4))
           (setq *p2x-path* (strcat (vl-filename-directory name) "\\"))
           (setq xml (:ReadFile name))
           (or (not (member "  &amp;lt;Points&amp;gt;" xml))
               (alert "Error: File already includes points."))
           (setq vrs (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 10)) (entget (ssname ss 0)))))
           (setq f (open name "w"))
           (setq i 0) ; initial number is i+1
           )
    (progn
      (while (and (car xml)
                  (/= (car xml) "  &amp;lt;Registration&amp;gt;")
                  )
        (write-line (car xml) f)
        (setq xml (cdr xml)))
      
      (foreach vrt vrs
        (foreach l (:XmlPoint vrt (itoa (setq i (1+ i))))
          (write-line l f)))
      
      (while (car xml)
        (write-line (car xml) f)
        (setq xml (cdr xml)))
      (close f)
      ))
  (princ)
  )&lt;/PRE&gt;
&lt;P&gt;Also&amp;nbsp;&lt;A href="http://www.lee-mac.com/runlisp.html" target="_blank" rel="noopener"&gt;HERE&lt;/A&gt;&amp;nbsp;are some guidelines how to run LISP in case you don't know already.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Apr 2019 14:08:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-export-coordinates-to-xml/m-p/8747634#M89551</guid>
      <dc:creator>ВeekeeCZ</dc:creator>
      <dc:date>2019-04-23T14:08:05Z</dc:date>
    </item>
    <item>
      <title>Re: LISP - export coordinates to XML</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-export-coordinates-to-xml/m-p/8747708#M89552</link>
      <description>&lt;P&gt;Thanks &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1779365"&gt;@ВeekeeCZ&lt;/a&gt;&amp;nbsp;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;While it's possible to manually create XML using text strings I *highly* recommend using VLISP to access the MSXML2.DOMDOCUMENT.6.0 DOM.&amp;nbsp; It's not much more work, and guarantees properly formed XML.&amp;nbsp; It also makes accessing the elements much easier.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Apr 2019 14:32:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-export-coordinates-to-xml/m-p/8747708#M89552</guid>
      <dc:creator>dgorsman</dc:creator>
      <dc:date>2019-04-23T14:32:23Z</dc:date>
    </item>
    <item>
      <title>Re: LISP - export coordinates to XML</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-export-coordinates-to-xml/m-p/8749578#M89553</link>
      <description>&lt;P&gt;Thank you !!!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You are the best !&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Apr 2019 09:25:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-export-coordinates-to-xml/m-p/8749578#M89553</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-04-24T09:25:48Z</dc:date>
    </item>
    <item>
      <title>Re: LISP - export coordinates to XML</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-export-coordinates-to-xml/m-p/8749784#M89554</link>
      <description>&lt;P&gt;&lt;A href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1779365" target="_blank"&gt;@BeekeeCZ&lt;/A&gt; , need something more ...&lt;/P&gt;
&lt;P&gt;It works perfect if i don`t have points in my XML file.&lt;/P&gt;
&lt;P&gt;if i have points in my xml , it gives me an error ... and in some files it puts the text that i want after the &amp;lt;/CGXML&amp;gt; line (and it does not work). i uploaded a file that suffers that ...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;can you modify it a little ?&lt;/P&gt;
&lt;P&gt;i mean :&lt;/P&gt;
&lt;P&gt;1) if the XML file has points , remove all points and insert the points after that&lt;/P&gt;
&lt;P&gt;2) insert the points on line 2 ( after &amp;lt;CGXML&amp;gt; line)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;first one is the harder job ... i think to myself ...&lt;/P&gt;
&lt;P&gt;What can i do for you ?&lt;/P&gt;
&lt;P&gt;you really helped me untill now !&lt;/P&gt;
&lt;P&gt;if you do this modifications i really want to help you somehow !&lt;/P&gt;</description>
      <pubDate>Wed, 24 Apr 2019 11:14:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-export-coordinates-to-xml/m-p/8749784#M89554</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-04-24T11:14:08Z</dc:date>
    </item>
    <item>
      <title>Re: LISP - export coordinates to XML</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-export-coordinates-to-xml/m-p/8750248#M89555</link>
      <description>&lt;P&gt;Not really sure if I understood you correctly, but try the modified code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The key tag is &amp;lt;registration&amp;gt;. The points are always placed before it. It there is the &amp;lt;points&amp;gt; tag already, all lines from that to &amp;lt;registration&amp;gt; are removed.&lt;/P&gt;
&lt;P&gt;If the above rules wouldn't be enough and it should get more complicated, then it might be the right time to move to a more appropriate and comprehensive solution mentioned by&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/253793"&gt;@dgorsman&lt;/a&gt;&amp;nbsp;.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;BTW you should try to read the code and get understand the principle to be able to do at least minor adjustments by your own.&lt;/P&gt;
&lt;P&gt;Greetings to Romania!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;(vl-load-com)

(defun c:PlineToXml (/ *error* :ReadFile :XmlPoint xml f vrs i)


    (defun *error* (errmsg)
    (if (not (wcmatch errmsg "Function cancelled,quit / exit abort,console break,end"))
      (princ (strcat "\nError: " errmsg)))
    (if f (close f))
    (princ))
  
  (defun :ReadFile (name / lst)
    (if (setq f (open name "r"))
      (while (setq l (read-line f))
        (setq lst (cons l lst))))
    (if f (close f))
    (reverse lst))
  
  (defun :XmlPoint (p i /)
    (list "  &amp;lt;Points&amp;gt;"
          (strcat "    &amp;lt;POINTID&amp;gt;" i "&amp;lt;/POINTID&amp;gt;")
          (strcat "    &amp;lt;IMMOVABLEID&amp;gt;1&amp;lt;/IMMOVABLEID&amp;gt;")
          (strcat "    &amp;lt;NO&amp;gt;" i "&amp;lt;/NO&amp;gt;")
          (strcat "    &amp;lt;X&amp;gt;" (rtos (car  p) 2 3 ) "&amp;lt;/X&amp;gt;")
          (strcat "    &amp;lt;Y&amp;gt;" (rtos (cadr p) 2 3 ) "&amp;lt;/Y&amp;gt;")
          "  &amp;lt;/Points&amp;gt;"))
  
  ; ---------------------------------------------------------------
  
  (or *p2x-path*
      (setq *p2x-path* (getvar 'DWGPREFIX)))
  
  (if (and (setq ss (ssget "_+.:E:S" '((0 . "LWPOLYLINE"))))
           (setq name (getfiled "Select XML file: " *p2x-path* "cgxml" 4))
           (setq *p2x-path* (strcat (vl-filename-directory name) "\\"))
           (setq xml (:ReadFile name))
           (setq vrs (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 10)) (entget (ssname ss 0)))))
           (setq f (open name "w"))
           (setq i 0) ; initial number is i+1
           )
    (progn
      (while (and (car xml)
                  (not (wcmatch (strcase (car xml) T) "*&amp;lt;registration&amp;gt;*,*&amp;lt;points&amp;gt;*"))) 	; write back all until &amp;lt;registration&amp;gt; or &amp;lt;point*&amp;gt; tag reached
        (write-line (car xml) f)
        (setq xml (cdr xml)))
      
      (foreach vrt vrs									; write all new points
        (foreach l (:XmlPoint vrt (itoa (setq i (1+ i))))
          (write-line l f)))

      (while (and (car xml)								; skip all current &amp;lt;points&amp;gt; if there are any (untill &amp;lt;registration&amp;gt; tag reached)
                  (not (wcmatch (strcase (car xml) T) "*&amp;lt;registration&amp;gt;*")))
        (setq xml (cdr xml)))
      
      (while (car xml)									; write all the rest.
        (write-line (car xml) f)
        (setq xml (cdr xml)))
      (close f)
      ))
  (princ)
  )
&amp;nbsp;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Apr 2019 13:55:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-export-coordinates-to-xml/m-p/8750248#M89555</guid>
      <dc:creator>ВeekeeCZ</dc:creator>
      <dc:date>2019-04-24T13:55:28Z</dc:date>
    </item>
    <item>
      <title>Re: LISP - export coordinates to XML</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-export-coordinates-to-xml/m-p/9429880#M89556</link>
      <description>&lt;P&gt;i have another problem ...&lt;/P&gt;&lt;P&gt;there are some files that contains vital information between the last &amp;lt;/POINTS and &amp;lt;REGISTRATION&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The problem is that it deletes that &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;before it looks like this :&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;&amp;lt;Points&amp;gt;&lt;BR /&gt;&amp;lt;POINTID&amp;gt;30013&amp;lt;/POINTID&amp;gt;&lt;BR /&gt;&amp;lt;IMMOVABLEID&amp;gt;10001&amp;lt;/IMMOVABLEID&amp;gt;&lt;BR /&gt;&amp;lt;NO&amp;gt;30013&amp;lt;/NO&amp;gt;&lt;BR /&gt;&amp;lt;X&amp;gt;689470.514805319&amp;lt;/X&amp;gt;&lt;BR /&gt;&amp;lt;Y&amp;gt;476069.298022253&amp;lt;/Y&amp;gt;&lt;BR /&gt;&amp;lt;/Points&amp;gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;&amp;lt;Address&amp;gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;&amp;lt;ADDRESSID&amp;gt;10001&amp;lt;/ADDRESSID&amp;gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;&amp;lt;SIRSUP&amp;gt;75515&amp;lt;/SIRSUP&amp;gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;&amp;lt;SIRUTA&amp;gt;&amp;lt;/SIRUTA&amp;gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;&amp;lt;INTRAVILAN&amp;gt;false&amp;lt;/INTRAVILAN&amp;gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;&amp;lt;DISTRICTTYPE&amp;gt;&amp;lt;/DISTRICTTYPE&amp;gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;&amp;lt;DISTRICTNAME&amp;gt;&amp;lt;/DISTRICTNAME&amp;gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;&amp;lt;STREETTYPE&amp;gt;&amp;lt;/STREETTYPE&amp;gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;&amp;lt;STREETNAME&amp;gt;&amp;lt;/STREETNAME&amp;gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;&amp;lt;POSTALNUMBER&amp;gt;&amp;lt;/POSTALNUMBER&amp;gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;&amp;lt;BLOCK&amp;gt;&amp;lt;/BLOCK&amp;gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;&amp;lt;ENTRY&amp;gt;&amp;lt;/ENTRY&amp;gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;&amp;lt;FLOOR&amp;gt;&amp;lt;/FLOOR&amp;gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;&amp;lt;APNO&amp;gt;&amp;lt;/APNO&amp;gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;&amp;lt;ZIPCODE&amp;gt;&amp;lt;/ZIPCODE&amp;gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;&amp;lt;DESCRIPTION&amp;gt;&amp;lt;/DESCRIPTION&amp;gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;&amp;lt;SECTION&amp;gt;&amp;lt;/SECTION&amp;gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;&amp;lt;/Address&amp;gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;&amp;lt;Parcel&amp;gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;&amp;lt;PARCELID&amp;gt;10002&amp;lt;/PARCELID&amp;gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;&amp;lt;LANDID&amp;gt;10001&amp;lt;/LANDID&amp;gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;&amp;lt;NUMBER&amp;gt;1&amp;lt;/NUMBER&amp;gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;&amp;lt;MEASUREDAREA&amp;gt;240232.0&amp;lt;/MEASUREDAREA&amp;gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;&amp;lt;USECATEGORY&amp;gt;P&amp;lt;/USECATEGORY&amp;gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;&amp;lt;INTRAVILAN&amp;gt;false&amp;lt;/INTRAVILAN&amp;gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;&amp;lt;TITLENO&amp;gt;&amp;lt;/TITLENO&amp;gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;&amp;lt;LANDPLOTNO&amp;gt;13/1&amp;lt;/LANDPLOTNO&amp;gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;&amp;lt;PARCELNO&amp;gt;83/4&amp;lt;/PARCELNO&amp;gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;&amp;lt;PAPERCADNO&amp;gt;&amp;lt;/PAPERCADNO&amp;gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;&amp;lt;PAPERLBNO&amp;gt;&amp;lt;/PAPERLBNO&amp;gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;&amp;lt;TOPONO&amp;gt;&amp;lt;/TOPONO&amp;gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;&amp;lt;CADGENNO&amp;gt;&amp;lt;/CADGENNO&amp;gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;&amp;lt;/Parcel&amp;gt;&lt;/FONT&gt;&lt;BR /&gt;&amp;lt;RegistrationXEntity&amp;gt;&lt;BR /&gt;&amp;lt;REGISTRATIONXENTITYID&amp;gt;10001&amp;lt;/REGISTRATIONXENTITYID&amp;gt;&lt;BR /&gt;&amp;lt;REGISTRATIONID&amp;gt;10001&amp;lt;/REGISTRATIONID&amp;gt;&lt;BR /&gt;&amp;lt;LANDID&amp;gt;10001&amp;lt;/LANDID&amp;gt;&lt;BR /&gt;&amp;lt;/RegistrationXEntity&amp;gt;&lt;BR /&gt;&amp;lt;Registration&amp;gt;&lt;BR /&gt;&amp;lt;REGISTRATIONID&amp;gt;10001&amp;lt;/REGISTRATIONID&amp;gt;&lt;BR /&gt;&amp;lt;REGISTRATIONTYPE&amp;gt;INTAB&amp;lt;/REGISTRATIONTYPE&amp;gt;&lt;BR /&gt;&amp;lt;RIGHTTYPE&amp;gt;PROPRIETATE&amp;lt;/RIGHTTYPE&amp;gt;&lt;BR /&gt;&amp;lt;DEEDID&amp;gt;10001&amp;lt;/DEEDID&amp;gt;&lt;BR /&gt;&amp;lt;TITLE&amp;gt;LEGE&amp;lt;/TITLE&amp;gt;&lt;BR /&gt;&amp;lt;QUOTATYPE&amp;gt;FRACTION_QUOTA&amp;lt;/QUOTATYPE&amp;gt;&lt;BR /&gt;&amp;lt;INITIALQUOTA&amp;gt;1/1&amp;lt;/INITIALQUOTA&amp;gt;&lt;BR /&gt;&amp;lt;ACTUALQUOTA&amp;gt;1/1&amp;lt;/ACTUALQUOTA&amp;gt;&lt;BR /&gt;&amp;lt;VALUECURRENCY&amp;gt;&amp;lt;/VALUECURRENCY&amp;gt;&lt;BR /&gt;&amp;lt;VALUEAMOUNT&amp;gt;&amp;lt;/VALUEAMOUNT&amp;gt;&lt;BR /&gt;&amp;lt;COMMENTS&amp;gt;&amp;lt;/COMMENTS&amp;gt;&lt;BR /&gt;&amp;lt;LBPARTNO&amp;gt;2&amp;lt;/LBPARTNO&amp;gt;&lt;BR /&gt;&amp;lt;POSITION&amp;gt;1&amp;lt;/POSITION&amp;gt;&lt;BR /&gt;&amp;lt;APPNO&amp;gt;4858&amp;lt;/APPNO&amp;gt;&lt;BR /&gt;&amp;lt;APPDATE&amp;gt;2018-03-29T00:00:00.000+03:00&amp;lt;/APPDATE&amp;gt;&lt;BR /&gt;&amp;lt;/Registration&amp;gt;&lt;BR /&gt;&amp;lt;Deed&amp;gt;&lt;BR /&gt;&amp;lt;DEEDID&amp;gt;10001&amp;lt;/DEEDID&amp;gt;&lt;BR /&gt;&amp;lt;DEEDNUMBER&amp;gt;ordinul nr. 749&amp;lt;/DEEDNUMBER&amp;gt;&lt;BR /&gt;&amp;lt;DEEDDATE&amp;gt;2011-06-29T00:00:00.000+03:00&amp;lt;/DEEDDATE&amp;gt;&lt;BR /&gt;&amp;lt;DEEDTYPE&amp;gt;ACT_NORMATIV&amp;lt;/DEEDTYPE&amp;gt;&lt;BR /&gt;&amp;lt;AUTHORITY&amp;gt;INSTITUTIA PREFECTULUI JUDETUL GALATI&amp;lt;/AUTHORITY&amp;gt;&lt;BR /&gt;&amp;lt;FILEID&amp;gt;0&amp;lt;/FILEID&amp;gt;&lt;BR /&gt;&amp;lt;/Deed&amp;gt;&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;and after :&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;&amp;lt;Points&amp;gt;&lt;BR /&gt;&amp;lt;POINTID&amp;gt;1&amp;lt;/POINTID&amp;gt;&lt;BR /&gt;&amp;lt;IMMOVABLEID&amp;gt;1&amp;lt;/IMMOVABLEID&amp;gt;&lt;BR /&gt;&amp;lt;NO&amp;gt;30013&amp;lt;/NO&amp;gt;&lt;BR /&gt;&amp;lt;X&amp;gt;689470.514805319&amp;lt;/X&amp;gt;&lt;BR /&gt;&amp;lt;Y&amp;gt;476069.298022253&amp;lt;/Y&amp;gt;&lt;BR /&gt;&amp;lt;/Points&amp;gt;&lt;BR /&gt;&amp;lt;RegistrationXEntity&amp;gt;&lt;BR /&gt;&amp;lt;REGISTRATIONXENTITYID&amp;gt;10001&amp;lt;/REGISTRATIONXENTITYID&amp;gt;&lt;BR /&gt;&amp;lt;REGISTRATIONID&amp;gt;10001&amp;lt;/REGISTRATIONID&amp;gt;&lt;BR /&gt;&amp;lt;LANDID&amp;gt;10001&amp;lt;/LANDID&amp;gt;&lt;BR /&gt;&amp;lt;/RegistrationXEntity&amp;gt;&lt;BR /&gt;&amp;lt;Registration&amp;gt;&lt;BR /&gt;&amp;lt;REGISTRATIONID&amp;gt;10001&amp;lt;/REGISTRATIONID&amp;gt;&lt;BR /&gt;&amp;lt;REGISTRATIONTYPE&amp;gt;INTAB&amp;lt;/REGISTRATIONTYPE&amp;gt;&lt;BR /&gt;&amp;lt;RIGHTTYPE&amp;gt;PROPRIETATE&amp;lt;/RIGHTTYPE&amp;gt;&lt;BR /&gt;&amp;lt;DEEDID&amp;gt;10001&amp;lt;/DEEDID&amp;gt;&lt;BR /&gt;&amp;lt;TITLE&amp;gt;LEGE&amp;lt;/TITLE&amp;gt;&lt;BR /&gt;&amp;lt;QUOTATYPE&amp;gt;FRACTION_QUOTA&amp;lt;/QUOTATYPE&amp;gt;&lt;BR /&gt;&amp;lt;INITIALQUOTA&amp;gt;1/1&amp;lt;/INITIALQUOTA&amp;gt;&lt;BR /&gt;&amp;lt;ACTUALQUOTA&amp;gt;1/1&amp;lt;/ACTUALQUOTA&amp;gt;&lt;BR /&gt;&amp;lt;VALUECURRENCY&amp;gt;&amp;lt;/VALUECURRENCY&amp;gt;&lt;BR /&gt;&amp;lt;VALUEAMOUNT&amp;gt;&amp;lt;/VALUEAMOUNT&amp;gt;&lt;BR /&gt;&amp;lt;COMMENTS&amp;gt;&amp;lt;/COMMENTS&amp;gt;&lt;BR /&gt;&amp;lt;LBPARTNO&amp;gt;2&amp;lt;/LBPARTNO&amp;gt;&lt;BR /&gt;&amp;lt;POSITION&amp;gt;1&amp;lt;/POSITION&amp;gt;&lt;BR /&gt;&amp;lt;APPNO&amp;gt;4858&amp;lt;/APPNO&amp;gt;&lt;BR /&gt;&amp;lt;APPDATE&amp;gt;2018-03-29T00:00:00.000+03:00&amp;lt;/APPDATE&amp;gt;&lt;BR /&gt;&amp;lt;/Registration&amp;gt;&lt;BR /&gt;&amp;lt;Deed&amp;gt;&lt;BR /&gt;&amp;lt;DEEDID&amp;gt;10001&amp;lt;/DEEDID&amp;gt;&lt;BR /&gt;&amp;lt;DEEDNUMBER&amp;gt;ordinul nr. 749&amp;lt;/DEEDNUMBER&amp;gt;&lt;BR /&gt;&amp;lt;DEEDDATE&amp;gt;2011-06-29T00:00:00.000+03:00&amp;lt;/DEEDDATE&amp;gt;&lt;BR /&gt;&amp;lt;DEEDTYPE&amp;gt;ACT_NORMATIV&amp;lt;/DEEDTYPE&amp;gt;&lt;BR /&gt;&amp;lt;AUTHORITY&amp;gt;INSTITUTIA PREFECTULUI JUDETUL GALATI&amp;lt;/AUTHORITY&amp;gt;&lt;BR /&gt;&amp;lt;FILEID&amp;gt;0&amp;lt;/FILEID&amp;gt;&lt;BR /&gt;&amp;lt;/Deed&amp;gt;&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i have to change that condition :&amp;nbsp;&lt;/P&gt;&lt;P&gt;(progn&lt;BR /&gt;(while (and (car xml)&lt;BR /&gt;(not (wcmatch (strcase (car xml) T) "*&amp;lt;registration&amp;gt;*,*&amp;lt;points&amp;gt;*"))) ; write back all until &amp;lt;registration&amp;gt; or &amp;lt;point*&amp;gt; tag reached&lt;BR /&gt;(write-line (car xml) f)&lt;BR /&gt;(setq xml (cdr xml)))&lt;BR /&gt;&lt;BR /&gt;(foreach vrt vrs ; write all new points&lt;BR /&gt;(foreach l (:XmlPoint vrt (itoa (setq i (1+ i))))&lt;BR /&gt;(write-line l f)))&lt;/P&gt;&lt;P&gt;(while (and (car xml) ; skip all current &amp;lt;points&amp;gt; if there are any (untill &amp;lt;registration&amp;gt; tag reached)&lt;BR /&gt;(not (wcmatch (strcase (car xml) T) "*&amp;lt;registration&amp;gt;*")))&lt;BR /&gt;(setq xml (cdr xml)))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and instead of deleting all from point to registration , i just want to delete all the points.&lt;/P&gt;&lt;P&gt;Can you do that for me ?&lt;/P&gt;&lt;P&gt;Please ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Apr 2020 11:57:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-export-coordinates-to-xml/m-p/9429880#M89556</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-04-08T11:57:33Z</dc:date>
    </item>
    <item>
      <title>Re: LISP - export coordinates to XML</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-export-coordinates-to-xml/m-p/10991359#M89557</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(vl-load-com)

(defun c:PlineToXml (/ *error* :ReadFile :XmlPoint xml f vrs i)


    (defun *error* (errmsg)
    (if (not (wcmatch errmsg "Function cancelled,quit / exit abort,console break,end"))
      (princ (strcat "\nError: " errmsg)))
    (if f (close f))
    (princ))
  
  (defun :ReadFile (name / lst)
    (if (setq f (open name "r"))
      (while (setq l (read-line f))
        (setq lst (cons l lst))))
    (if f (close f))
    (reverse lst))
  
  (defun :XmlPoint (p i /)
    (list "  &amp;lt;Points&amp;gt;"
          (strcat "    &amp;lt;POINTID&amp;gt;" i "&amp;lt;/POINTID&amp;gt;")
          (strcat "    &amp;lt;IMMOVABLEID&amp;gt;1&amp;lt;/IMMOVABLEID&amp;gt;")
          (strcat "    &amp;lt;NO&amp;gt;" i "&amp;lt;/NO&amp;gt;")
          (strcat "    &amp;lt;X&amp;gt;" (rtos (car  p) 2 8 ) "&amp;lt;/X&amp;gt;")
          (strcat "    &amp;lt;Y&amp;gt;" (rtos (cadr p) 2 8 ) "&amp;lt;/Y&amp;gt;")
          "  &amp;lt;/Points&amp;gt;"))
  
  ; ---------------------------------------------------------------
  
  (or *p2x-path*
      (setq *p2x-path* (getvar 'DWGPREFIX)))
  
  (if (and (setq ss (ssget "_+.:E:S" '((0 . "LWPOLYLINE"))))
           (setq name (getfiled "Select XML file: " *p2x-path* "cgxml" 4))
           (setq *p2x-path* (strcat (vl-filename-directory name) "\\"))
           (setq xml (:ReadFile name))
           (setq vrs (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 10)) (entget (ssname ss 0)))))
           (setq f (open name "w"))
           (setq i 0) ; initial number is i+1
           )
    (progn
      (while (and (car xml)
                  (not (wcmatch (strcase (car xml) T) "*&amp;lt;points&amp;gt;*"))) 	; write back all until &amp;lt;registration&amp;gt; or &amp;lt;point*&amp;gt; tag reached
        (write-line (car xml) f)
        (setq xml (cdr xml)))
      
      (foreach vrt vrs									; write all new points
        (foreach l (:XmlPoint vrt (itoa (setq i (1+ i))))
         (write-line l f)))

      (while (and (car xml)								; skip all current &amp;lt;points&amp;gt; if there are any (untill &amp;lt;address&amp;gt; tag reached)
            (not (wcmatch (strcase (car xml) T) "*&amp;lt;address&amp;gt;*")))
	
      (setq xml (cdr xml)))
      
      (while (car xml)									; write all the rest.
        (write-line (car xml) f)
        (setq xml (cdr xml)))
      (close f)
      ))
  (princ)
  )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;Try this! Modify only line with &amp;lt;address&amp;gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Mar 2022 15:01:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-export-coordinates-to-xml/m-p/10991359#M89557</guid>
      <dc:creator>bcddss</dc:creator>
      <dc:date>2022-03-08T15:01:52Z</dc:date>
    </item>
    <item>
      <title>Re: LISP - export coordinates to XML</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-export-coordinates-to-xml/m-p/10991451#M89558</link>
      <description>&lt;P&gt;One more thing is to insert last point the point nr 1, to complete the CGXML. Please help!&lt;/P&gt;</description>
      <pubDate>Tue, 08 Mar 2022 15:32:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-export-coordinates-to-xml/m-p/10991451#M89558</guid>
      <dc:creator>bcddss</dc:creator>
      <dc:date>2022-03-08T15:32:53Z</dc:date>
    </item>
  </channel>
</rss>

