<?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: Equivalent of READ lisp function in .net? in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/equivalent-of-read-lisp-function-in-net/m-p/5477326#M41659</link>
    <description>&lt;P&gt;I would if I thought there was an answer, but I have a feeling there is no "serialized lisp list to result buffer" function in .net via pinvoke. I'd love to be wrong on that.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;I know I could make a lisp function in lisp to do the read, and call that from .net, but the return journey is nasty as I never send complex lists to .net in any form other than xml serialized lists due to how .net reformats certain resultbuffer&amp;nbsp;items incorrectly. So I have to serialize on lisp end, then unravel the xml string on .net end which is more overhead than just making parsing in .net to begin with.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I did write my own last night, and thought it was too slow at first during debug. Then tried release version and its super fast. So I'm not really worried about the pivoke read function as much now...&lt;/P&gt;</description>
    <pubDate>Wed, 21 Jan 2015 16:40:18 GMT</pubDate>
    <dc:creator>JamesMaeding</dc:creator>
    <dc:date>2015-01-21T16:40:18Z</dc:date>
    <item>
      <title>Equivalent of READ lisp function in .net?</title>
      <link>https://forums.autodesk.com/t5/net-forum/equivalent-of-read-lisp-function-in-net/m-p/5475126#M41653</link>
      <description>&lt;P&gt;So I have old data files that have lisp lists represented as strings.&lt;/P&gt;&lt;P&gt;I could write my own lisp parser, but wanted to try to get acad to read them for me into a resultbuffer.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have the pinvoked acedEvaluateLisp and was trying to send it something like:&lt;/P&gt;&lt;P&gt;string evalthis = "(read \"" +&amp;nbsp;stringtoread + "\")";&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but that string does not quite work, as I do not want the \" before and after the stringtoread, I just want "&lt;/P&gt;&lt;P&gt;But the code must have the \ to make the quotes part of the string.&lt;/P&gt;&lt;P&gt;I think I need to use the READ function from lisp if possible, as wrapping the string with read is not working.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Jan 2015 23:59:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/equivalent-of-read-lisp-function-in-net/m-p/5475126#M41653</guid>
      <dc:creator>JamesMaeding</dc:creator>
      <dc:date>2015-01-19T23:59:43Z</dc:date>
    </item>
    <item>
      <title>Re: Equivalent of READ lisp function in .net?</title>
      <link>https://forums.autodesk.com/t5/net-forum/equivalent-of-read-lisp-function-in-net/m-p/5475219#M41654</link>
      <description>&lt;P&gt;Did you perhaps also&amp;nbsp;want to evaluate the string?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;string evalthis = "(eval (read \"" +&amp;nbsp;stringtoread + "\"))";&lt;/P&gt;</description>
      <pubDate>Tue, 20 Jan 2015 02:47:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/equivalent-of-read-lisp-function-in-net/m-p/5475219#M41654</guid>
      <dc:creator>owenwengerd</dc:creator>
      <dc:date>2015-01-20T02:47:27Z</dc:date>
    </item>
    <item>
      <title>Re: Equivalent of READ lisp function in .net?</title>
      <link>https://forums.autodesk.com/t5/net-forum/equivalent-of-read-lisp-function-in-net/m-p/5475947#M41655</link>
      <description>&lt;P&gt;no, as the items are a lisp list of data, not variable names.&lt;/P&gt;&lt;P&gt;That trick of using eval to allow passing functions variables "byreference" is slick, where you pass in the var name as a string, and it gets eval's to be a variable, just not what I'm doing here.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My lisp function I want to do in .net looks like:&lt;/P&gt;&lt;P&gt;(DEFUN FILE-TO-LST-READ (FILE-NAME / INDEX RESULT DATA-FILE RLINE)&lt;BR /&gt;&amp;nbsp; (SETQ RESULT nil)&lt;BR /&gt;&amp;nbsp; (SETQ DATA-FILE (OPEN FILE-NAME "r"))&lt;BR /&gt;&amp;nbsp; (WHILE (SETQ RLINE (READ-LINE DATA-FILE))&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; (IF (AND (/= RLINE NIL)(/= RLINE "")(/= (SUBSTR RLINE 1 1) "'"))&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (SETQ RESULT (CONS (READ RLINE) RESULT))&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; )&lt;BR /&gt;&amp;nbsp; )&lt;BR /&gt;&amp;nbsp; (close DATA-FILE)&lt;BR /&gt;&amp;nbsp; (SETQ RESULT (REVERSE RESULT))&lt;BR /&gt;&amp;nbsp; RESULT&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;so I am just taking a text file containging a lisp list and converting to a list (resultbuffer).&lt;/P&gt;&lt;P&gt;example text for a horizontal alignment text file:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(("NAME" . "+Robert Street")("DESCRIPTION" . "xfghfdghf")("PATH" . "C:\Users\james\Desktop\Test Aligns")("TYPE" . "BASIC")("USER"&amp;nbsp; . "james")("DATE" . "01/08/15 1:24:28 PM")("STSTATION" . 789.9491148719630)("LENGTH" . 2208.169868062913)("STAEQS" . "None"))&lt;BR /&gt;(("START" . (-751.9091561265257 186.7627361809725 0.0))("END" . (-378.9933107305748 357.2781332772743 0.0)))&lt;BR /&gt;(("CENTER" . (69.74878846892860 -624.1173426586973 0.0))("RADIUS" . 1079.123047562959)("STANG" . 1.291887827092442)("ENDANG" . 1.999662145471057)("DIR" . "CW"))&lt;BR /&gt;(("CENTER" . (778.0616444626744 1849.275744619477 0.0))("RADIUS" . 1493.692621341728)("STANG" . 4.433480480682234)("ENDANG" . 5.125954547113812)("DIR" . "CCW"))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I use xml usually, this is just an old&amp;nbsp;way of storing things for very fast "read in" later. Seems faster than parsing an xml in lisp so far, but maybe .net parses faster...&lt;/P&gt;</description>
      <pubDate>Tue, 20 Jan 2015 17:10:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/equivalent-of-read-lisp-function-in-net/m-p/5475947#M41655</guid>
      <dc:creator>JamesMaeding</dc:creator>
      <dc:date>2015-01-20T17:10:10Z</dc:date>
    </item>
    <item>
      <title>Re: Equivalent of READ lisp function in .net?</title>
      <link>https://forums.autodesk.com/t5/net-forum/equivalent-of-read-lisp-function-in-net/m-p/5475966#M41656</link>
      <description>&lt;P&gt;btw, the read function does work on simple stuff in .net, like:&lt;/P&gt;&lt;P&gt;&lt;FONT size="2" face="Consolas"&gt;AcadEvalLisp(&lt;/FONT&gt;&lt;FONT color="#a31515" size="2" face="Consolas"&gt;"(read \"(1 2 3)\")"&lt;/FONT&gt;&lt;FONT size="2" face="Consolas"&gt;);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2" face="Consolas"&gt;but it does not work with anything that is a string, like:&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2" face="Consolas"&gt;AcadEvalLisp(&lt;FONT color="#a31515" size="2" face="Consolas"&gt;"(read \"(\"a\" \"b\" 1 2 3)\")"&lt;/FONT&gt;&lt;FONT size="2" face="Consolas"&gt;);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2" face="Consolas"&gt;&lt;FONT size="2" face="Consolas"&gt;so maybe its not the \" at start and end, but the quotes in the middle for the string values.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Jan 2015 17:20:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/equivalent-of-read-lisp-function-in-net/m-p/5475966#M41656</guid>
      <dc:creator>JamesMaeding</dc:creator>
      <dc:date>2015-01-20T17:20:43Z</dc:date>
    </item>
    <item>
      <title>Re: Equivalent of READ lisp function in .net?</title>
      <link>https://forums.autodesk.com/t5/net-forum/equivalent-of-read-lisp-function-in-net/m-p/5475994#M41657</link>
      <description>&lt;P&gt;oh, I see. My .net function does the eval, I just want the read.&lt;/P&gt;&lt;P&gt;I looked through the pinvoke export lists, did not see anything like lisp read function so far....&lt;/P&gt;</description>
      <pubDate>Tue, 20 Jan 2015 17:33:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/equivalent-of-read-lisp-function-in-net/m-p/5475994#M41657</guid>
      <dc:creator>JamesMaeding</dc:creator>
      <dc:date>2015-01-20T17:33:33Z</dc:date>
    </item>
    <item>
      <title>Re: Equivalent of READ lisp function in .net?</title>
      <link>https://forums.autodesk.com/t5/net-forum/equivalent-of-read-lisp-function-in-net/m-p/5477226#M41658</link>
      <description>&lt;P&gt;I think it would be helpful if you post&amp;nbsp;specially crafted&amp;nbsp;sample code that demonstrates the problem.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Jan 2015 15:55:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/equivalent-of-read-lisp-function-in-net/m-p/5477226#M41658</guid>
      <dc:creator>owenwengerd</dc:creator>
      <dc:date>2015-01-21T15:55:05Z</dc:date>
    </item>
    <item>
      <title>Re: Equivalent of READ lisp function in .net?</title>
      <link>https://forums.autodesk.com/t5/net-forum/equivalent-of-read-lisp-function-in-net/m-p/5477326#M41659</link>
      <description>&lt;P&gt;I would if I thought there was an answer, but I have a feeling there is no "serialized lisp list to result buffer" function in .net via pinvoke. I'd love to be wrong on that.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;I know I could make a lisp function in lisp to do the read, and call that from .net, but the return journey is nasty as I never send complex lists to .net in any form other than xml serialized lists due to how .net reformats certain resultbuffer&amp;nbsp;items incorrectly. So I have to serialize on lisp end, then unravel the xml string on .net end which is more overhead than just making parsing in .net to begin with.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I did write my own last night, and thought it was too slow at first during debug. Then tried release version and its super fast. So I'm not really worried about the pivoke read function as much now...&lt;/P&gt;</description>
      <pubDate>Wed, 21 Jan 2015 16:40:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/equivalent-of-read-lisp-function-in-net/m-p/5477326#M41659</guid>
      <dc:creator>JamesMaeding</dc:creator>
      <dc:date>2015-01-21T16:40:18Z</dc:date>
    </item>
  </channel>
</rss>

