<?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: does not return positive number in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/does-not-return-positive-number/m-p/11299059#M43332</link>
    <description>&lt;P&gt;Still, there is used &lt;EM&gt;&lt;STRONG&gt;read-from-string&lt;/STRONG&gt;&lt;/EM&gt; function unknown to the program. The idea of this function probably comes from CommonLisp, but it does not exist in AutoLisp. So you either need to write your own function that would mimic the original functionality&amp;nbsp;(or find/get the definition if the code is not yours) or use other functions built-in in AutoLisp.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Below is my version of the code...&lt;/P&gt;
&lt;PRE&gt;(defun c:XYM ( / p)

  (while (setq p (getpoint "\nPick a head point: "))
    (command "_.LEADER" "_none" p pause ""
	     (strcat (if (&amp;gt; (car p) 0) "E=" "W=")
		     (rtos (/ (abs (car p)) 1000))
		     ","
		     (if (&amp;gt; (cadr p) 0) "N=" "S=")
		     (rtos (/ (abs (cadr p)) 1000)))
	     ""))
  (princ)
  )
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 15 Jul 2022 10:09:38 GMT</pubDate>
    <dc:creator>ВeekeeCZ</dc:creator>
    <dc:date>2022-07-15T10:09:38Z</dc:date>
    <item>
      <title>does not return positive number</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/does-not-return-positive-number/m-p/11297071#M43327</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;can anyone help in lisp&lt;/P&gt;&lt;P&gt;what is wrong with below lisp program line&lt;/P&gt;&lt;P&gt;it does not return positive number&lt;/P&gt;&lt;P&gt;any suggestion welcome.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(abs (atof (read-from-string (rtos (/ (cadr p) 1000)))))&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jul 2022 11:45:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/does-not-return-positive-number/m-p/11297071#M43327</guid>
      <dc:creator>dmjayaraj</dc:creator>
      <dc:date>2022-07-14T11:45:24Z</dc:date>
    </item>
    <item>
      <title>Re: does not return positive number</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/does-not-return-positive-number/m-p/11297108#M43328</link>
      <description>&lt;P&gt;Show us the code for the (read-from-string) function, which is not in the AutoLisp Reference, and tell us what kind of value the 'p' variable would contain.&amp;nbsp; Also, what &lt;EM&gt;does&lt;/EM&gt; it return?&amp;nbsp; It's hard to imagine it could be a negative number.&amp;nbsp; Is it an error message?&amp;nbsp; Something else?&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jul 2022 12:05:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/does-not-return-positive-number/m-p/11297108#M43328</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2022-07-14T12:05:27Z</dc:date>
    </item>
    <item>
      <title>Re: does not return positive number</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/does-not-return-positive-number/m-p/11297159#M43329</link>
      <description>&lt;P&gt;(rtos (/ (cadr p) 1000))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;cadr p&amp;nbsp; &amp;nbsp; &amp;nbsp; is the y co-ordinates of 3d point which is real number (+ or - number)&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jul 2022 12:25:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/does-not-return-positive-number/m-p/11297159#M43329</guid>
      <dc:creator>dmjayaraj</dc:creator>
      <dc:date>2022-07-14T12:25:27Z</dc:date>
    </item>
    <item>
      <title>Re: does not return positive number</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/does-not-return-positive-number/m-p/11297250#M43330</link>
      <description>&lt;P&gt;That answers only one of my three requests/questions.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jul 2022 12:56:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/does-not-return-positive-number/m-p/11297250#M43330</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2022-07-14T12:56:29Z</dc:date>
    </item>
    <item>
      <title>Re: does not return positive number</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/does-not-return-positive-number/m-p/11298756#M43331</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/69526"&gt;@Kent1Cooper&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;code attached hope this will helpful.&lt;/P&gt;&lt;P&gt;aim is to remove the sign of -x and -y co-ordinates&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Jul 2022 03:01:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/does-not-return-positive-number/m-p/11298756#M43331</guid>
      <dc:creator>dmjayaraj</dc:creator>
      <dc:date>2022-07-15T03:01:54Z</dc:date>
    </item>
    <item>
      <title>Re: does not return positive number</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/does-not-return-positive-number/m-p/11299059#M43332</link>
      <description>&lt;P&gt;Still, there is used &lt;EM&gt;&lt;STRONG&gt;read-from-string&lt;/STRONG&gt;&lt;/EM&gt; function unknown to the program. The idea of this function probably comes from CommonLisp, but it does not exist in AutoLisp. So you either need to write your own function that would mimic the original functionality&amp;nbsp;(or find/get the definition if the code is not yours) or use other functions built-in in AutoLisp.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Below is my version of the code...&lt;/P&gt;
&lt;PRE&gt;(defun c:XYM ( / p)

  (while (setq p (getpoint "\nPick a head point: "))
    (command "_.LEADER" "_none" p pause ""
	     (strcat (if (&amp;gt; (car p) 0) "E=" "W=")
		     (rtos (/ (abs (car p)) 1000))
		     ","
		     (if (&amp;gt; (cadr p) 0) "N=" "S=")
		     (rtos (/ (abs (cadr p)) 1000)))
	     ""))
  (princ)
  )
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Jul 2022 10:09:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/does-not-return-positive-number/m-p/11299059#M43332</guid>
      <dc:creator>ВeekeeCZ</dc:creator>
      <dc:date>2022-07-15T10:09:38Z</dc:date>
    </item>
    <item>
      <title>Re: does not return positive number</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/does-not-return-positive-number/m-p/11299270#M43333</link>
      <description>&lt;P&gt;can you reply back code for 3d point please&lt;/P&gt;</description>
      <pubDate>Fri, 15 Jul 2022 10:01:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/does-not-return-positive-number/m-p/11299270#M43333</guid>
      <dc:creator>dmjayaraj</dc:creator>
      <dc:date>2022-07-15T10:01:59Z</dc:date>
    </item>
    <item>
      <title>Re: does not return positive number</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/does-not-return-positive-number/m-p/11299280#M43334</link>
      <description>&lt;P&gt;I tried and it is working fine with some changes&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(defun c:XYZM ( / p)&lt;/P&gt;&lt;P&gt;(while (setq p (getpoint "\nPick a head point: "))&lt;BR /&gt;(command "_.LEADER" "_none" p pause ""&lt;BR /&gt;(strcat (if (&amp;gt; (car p) 0) "E=" "W=")&lt;BR /&gt;(rtos (/ (abs (car p)) 1000))&lt;BR /&gt;"\n"&lt;BR /&gt;(if (&amp;gt; (cadr p) 0) "N=" "S=")&lt;BR /&gt;(rtos (/ (abs (car p)) 1000))&lt;BR /&gt;"\n"&lt;BR /&gt;(if (&amp;gt; (caddr p) 0) "U=" "D=")&lt;BR /&gt;(rtos (/ (abs (caddr p)) 1000)))&lt;BR /&gt;""))&lt;BR /&gt;(princ)&lt;BR /&gt;)&lt;/P&gt;</description>
      <pubDate>Fri, 15 Jul 2022 10:05:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/does-not-return-positive-number/m-p/11299280#M43334</guid>
      <dc:creator>dmjayaraj</dc:creator>
      <dc:date>2022-07-15T10:05:01Z</dc:date>
    </item>
    <item>
      <title>Re: does not return positive number</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/does-not-return-positive-number/m-p/11299328#M43335</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/4817050"&gt;@dmjayaraj&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I tried and it is working fine with some changes&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(defun c:XYZM ( / p)&lt;/P&gt;
&lt;P&gt;(while (setq p (getpoint "\nPick a head point: "))&lt;BR /&gt;(command "_.LEADER" "_none" p pause ""&lt;BR /&gt;(strcat (if (&amp;gt; (car p) 0) "E=" "W=")&lt;BR /&gt;(rtos (/ (abs (car p)) 1000))&lt;BR /&gt;"\n"&lt;BR /&gt;(if (&amp;gt; (cadr p) 0) "N=" "S=")&lt;BR /&gt;(rtos (/ (abs (&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;car&lt;/STRONG&gt; &lt;/FONT&gt;p)) 1000))&lt;BR /&gt;"\n"&lt;BR /&gt;(if (&amp;gt; (caddr p) 0) "U=" "D=")&lt;BR /&gt;(rtos (/ (abs (caddr p)) 1000)))&lt;BR /&gt;""))&lt;BR /&gt;(princ)&lt;BR /&gt;)&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What do you expect from me? Just fix the typo you should be good to go...&lt;/P&gt;</description>
      <pubDate>Fri, 15 Jul 2022 10:42:57 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/does-not-return-positive-number/m-p/11299328#M43335</guid>
      <dc:creator>ВeekeeCZ</dc:creator>
      <dc:date>2022-07-15T10:42:57Z</dc:date>
    </item>
    <item>
      <title>Re: does not return positive number</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/does-not-return-positive-number/m-p/11299370#M43336</link>
      <description>&lt;P&gt;Still nothing about the (read-from-string) function.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But in looking for places where the (abs) function is used to try to think of how that might be failing to remove the minus signs, I notice this line, and another like it for the Y coordinate:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &lt;FONT face="courier new,courier"&gt;(setq ptcoord1 (strcat "W="&lt;FONT color="#FF0000"&gt;(abs (atof&lt;/FONT&gt; (read-from-string (rtos (/ (car p) 1000)) )))))&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;You can't concatenate a string with a number.&amp;nbsp; &amp;nbsp;The &lt;FONT color="#FF0000"&gt;(abs (atof) ...&lt;/FONT&gt; function combination will return a number, not a text string such as (strcat) wants as an argument.&amp;nbsp; It needs to be converted to a string, something like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &lt;FONT face="courier new,courier"&gt;(setq ptcoord1 (strcat "W=" &lt;STRONG&gt;&lt;FONT color="#0000FF"&gt;(rtos&lt;/FONT&gt; &lt;/STRONG&gt;(abs (atof (read-from-string (rtos (/ (car p) 1000)) )))&lt;STRONG&gt;&lt;FONT color="#0000FF"&gt;)&lt;/FONT&gt;&lt;/STRONG&gt;))&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;But why that would leave the minus sign in place, I can't imagine, no matter what the (read-from-string) function does.&lt;/P&gt;</description>
      <pubDate>Fri, 15 Jul 2022 11:26:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/does-not-return-positive-number/m-p/11299370#M43336</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2022-07-15T11:26:37Z</dc:date>
    </item>
    <item>
      <title>Re: does not return positive number</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/does-not-return-positive-number/m-p/11299425#M43337</link>
      <description>&lt;P&gt;First thank you for your response&lt;/P&gt;&lt;P&gt;i was referring a site for the help on lisp same is attached as .png for read-from-string function.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Jul 2022 12:05:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/does-not-return-positive-number/m-p/11299425#M43337</guid>
      <dc:creator>dmjayaraj</dc:creator>
      <dc:date>2022-07-15T12:05:16Z</dc:date>
    </item>
    <item>
      <title>Re: does not return positive number</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/does-not-return-positive-number/m-p/11299451#M43338</link>
      <description>&lt;P&gt;So let me get this straight.&amp;nbsp; From Message 1:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier" color="#000000"&gt;&lt;STRONG&gt;(abs (atof (read-from-string (rtos (/ (cadr p) 1000)))))&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;would take a number (a Y coordinate) and divide it by 1000, &lt;EM&gt;turn that into a text string, then turn that back into a number&lt;/EM&gt;, and get its absolute value.&amp;nbsp; The&lt;FONT face="courier new,courier" color="#000000"&gt;&lt;STRONG&gt; (read-from-string)&lt;/STRONG&gt;&lt;/FONT&gt; function looks like it's made to handle all sorts of different variations of input, but&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;&lt;FONT color="#000000"&gt; (cadr p)&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/FONT&gt;, being a Y coordinate pulled from a point list, can't ever be anything other than a plain old real number.&amp;nbsp; That can be handled with simply this instead of the above:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier" color="#000000"&gt;&lt;STRONG&gt;(abs (/ (cadr p) 1000))&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;If you change it to that, does it work right?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Jul 2022 12:18:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/does-not-return-positive-number/m-p/11299451#M43338</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2022-07-15T12:18:41Z</dc:date>
    </item>
    <item>
      <title>Re: does not return positive number</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/does-not-return-positive-number/m-p/11299520#M43339</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/4817050"&gt;@dmjayaraj&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;First thank you for your response&lt;/P&gt;
&lt;P&gt;i was referring a site for the help on lisp same is attached as .png for read-from-string function.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://help.autodesk.com/view/OARX/2022/ENU/?guid=GUID-4CEE5072-8817-4920-8A2D-7060F5E16547" target="_blank" rel="noopener"&gt;THIS&lt;/A&gt;&amp;nbsp;would be a better source.&lt;/P&gt;</description>
      <pubDate>Fri, 15 Jul 2022 12:47:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/does-not-return-positive-number/m-p/11299520#M43339</guid>
      <dc:creator>ВeekeeCZ</dc:creator>
      <dc:date>2022-07-15T12:47:14Z</dc:date>
    </item>
  </channel>
</rss>

