<?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 convert string point format to point format in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-convert-string-point-format-to-point-format/m-p/8736658#M89769</link>
    <description>&lt;P&gt;I did not get your point exactly .......&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But &lt;SPAN&gt;to convert&lt;/SPAN&gt; a&amp;nbsp;&lt;SPAN&gt;string like this "2.5,7.5" as a point simply use like...&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;(setq P1 "2.5,7.5")&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;(setq P2 "5.5,10.5")&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;(command "_line" P1 P2 "")&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Here P1 &amp;amp; P2 are two points...... And using these two point you can do any thing (Here I am drawing a line)&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 17 Apr 2019 10:00:02 GMT</pubDate>
    <dc:creator>dbhunia</dc:creator>
    <dc:date>2019-04-17T10:00:02Z</dc:date>
    <item>
      <title>how to convert string point format to point format</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-convert-string-point-format-to-point-format/m-p/8736476#M89768</link>
      <description>&lt;P&gt;hello everyone&lt;/P&gt;
&lt;P&gt;i am a beginner ...i need away to convert string like this "2.5,7.5" to point format that can any command accept it as input point .... sorry if it is a silly question&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Apr 2019 08:51:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-convert-string-point-format-to-point-format/m-p/8736476#M89768</guid>
      <dc:creator>ayadmustafa</dc:creator>
      <dc:date>2019-04-17T08:51:50Z</dc:date>
    </item>
    <item>
      <title>Re: how to convert string point format to point format</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-convert-string-point-format-to-point-format/m-p/8736658#M89769</link>
      <description>&lt;P&gt;I did not get your point exactly .......&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But &lt;SPAN&gt;to convert&lt;/SPAN&gt; a&amp;nbsp;&lt;SPAN&gt;string like this "2.5,7.5" as a point simply use like...&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;(setq P1 "2.5,7.5")&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;(setq P2 "5.5,10.5")&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;(command "_line" P1 P2 "")&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Here P1 &amp;amp; P2 are two points...... And using these two point you can do any thing (Here I am drawing a line)&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Apr 2019 10:00:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-convert-string-point-format-to-point-format/m-p/8736658#M89769</guid>
      <dc:creator>dbhunia</dc:creator>
      <dc:date>2019-04-17T10:00:02Z</dc:date>
    </item>
    <item>
      <title>Re: how to convert string point format to point format</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-convert-string-point-format-to-point-format/m-p/8736820#M89770</link>
      <description>&lt;P&gt;This "conversion" is usually called "parsing". It's a very common task, probably most often needed when you read data from a file.&amp;nbsp; You can find many examples here on the forum when you search... or some guys might share their own versions...&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www.lee-mac.com/parsenumbers.html" target="_blank" rel="noopener"&gt;HERE&lt;/A&gt;&amp;nbsp;is a one, quite a complex one, written by Lee Mac. As a beginner, just take it as a black box...&amp;nbsp;&lt;/P&gt;
&lt;P&gt;BTW it worth to search thru all the page, a lot of useful stuff. Either whole programs, or just subroutines as this one.&lt;/P&gt;</description>
      <pubDate>Wed, 17 Apr 2019 11:08:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-convert-string-point-format-to-point-format/m-p/8736820#M89770</guid>
      <dc:creator>ВeekeeCZ</dc:creator>
      <dc:date>2019-04-17T11:08:35Z</dc:date>
    </item>
    <item>
      <title>Re: how to convert string point format to point format</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-convert-string-point-format-to-point-format/m-p/8745643#M89771</link>
      <description>&lt;P&gt;It's not a silly question at all.&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;My motto #1:&amp;nbsp; "You've got to start somewhere."&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;My motto #2:&amp;nbsp; "If you don't know, ask."&lt;/P&gt;
&lt;P&gt;Most all of us here love to help beginners because they are trying to learn.&lt;/P&gt;
&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/5869979"&gt;@dbhunia&lt;/a&gt;&amp;nbsp;gave you good advice.&lt;/P&gt;
&lt;P&gt;From what he responded you can clearly see that AutoCAD can accept AutoLisp coordinate input just as you might enter it from the keyboard...&amp;nbsp; x,y and even x,y,z as a string.&lt;/P&gt;
&lt;P&gt;But if you need to mathematically process the point, then you probably want to convert it to the same format that one would be returned from the getpoint function... (x y z) as a list of reals.&lt;/P&gt;
&lt;P&gt;Here's what I use:&lt;/P&gt;
&lt;PRE&gt;  ;; Function to convert a string with delimiters into a list
  ;; pat is the delimiter and can contain multiple characters
   (defun @str2list (str pat / i j n lst)
     (cond
       ((/= (type str)(type pat) 'STR))
       ((= str pat)'(""))
       (T
         (setq i 0 n (strlen pat))
         (while (setq j (vl-string-search pat str i))
           (setq lst (cons (substr str (1+ i)(- j i)) lst)
                 i (+ j n)
           )
         )
         (reverse (cons (substr str (1+ i)) lst))
       )
     )
   )

For example:

Command: (setq a "5.7,7.8")
"5.7,7.8"

Command: (@str2list a ",")
("5.7" "7.8")

Command: (mapcar 'read (@str2list a ","))
(5.7 7.8)
&lt;/PRE&gt;
&lt;P&gt;I hope that helps you.&lt;/P&gt;</description>
      <pubDate>Mon, 22 Apr 2019 17:04:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-convert-string-point-format-to-point-format/m-p/8745643#M89771</guid>
      <dc:creator>john.uhden</dc:creator>
      <dc:date>2019-04-22T17:04:33Z</dc:date>
    </item>
    <item>
      <title>Re: how to convert string point format to point format</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-convert-string-point-format-to-point-format/m-p/8745701#M89772</link>
      <description>&lt;P&gt;My 2 cents&lt;/P&gt;
&lt;PRE&gt;;; gc:str2lst
;; Transforme un chaine avec séparateur en liste de chaines
;; Converts a string with separator into a list of strings
;;
;; Arguments
;; str : la chaîne / the string
;; sep : le séparateur / the separator
(defun gc:str2lst (str sep / len lst)
  (setq len (strlen sep))
  (while (setq pos (vl-string-search sep str))
    (setq lst (cons (substr str 1 pos) lst)
	  str (substr str (+ len pos 1))
    )
  )
  (reverse (cons (substr str 1 pos) lst))
)

;; gc:str2pt
;; Transforme une chaine en point 3d (liste de nombres réels)
;; Converts a string into a point (list of real numbers)
;;
;; Argument
;; str : la chaîne / the string
(defun gc:str2pt (str)
  (setq str (mapcar 'read (gc:str2lst str ",")))
  (if (and (vl-every 'numberp str)
	   (&amp;lt; 1 (length str) 4)
      )
    (trans str 0 0)
  )
)&lt;/PRE&gt;</description>
      <pubDate>Mon, 22 Apr 2019 17:30:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-convert-string-point-format-to-point-format/m-p/8745701#M89772</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2019-04-22T17:30:16Z</dc:date>
    </item>
  </channel>
</rss>

