<?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: Error: malformed list on input in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/error-malformed-list-on-input/m-p/11740759#M34877</link>
    <description>&lt;P&gt;No all the sensor ID values are different based on the plan! The value will be some abbreviated version of the company, floor number then 1-however many sensors there are. Ex. TIAA-NY-F06-001 where the 001 will range from 001 to however many sensors there are, ex, 001 - 036&lt;/P&gt;</description>
    <pubDate>Wed, 08 Feb 2023 20:37:31 GMT</pubDate>
    <dc:creator>paulo.barreraF8J36</dc:creator>
    <dc:date>2023-02-08T20:37:31Z</dc:date>
    <item>
      <title>Error: malformed list on input</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/error-malformed-list-on-input/m-p/11722945#M34856</link>
      <description>&lt;P&gt;Hello Everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am currently trying to create a .lisp program that automates the editing of attributes in a dynamic block. I have written the code and uploaded it to AutoCAD but am getting the error : malformed list on input. This shows up above the command line after I load it in the load/unload applications tab.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The code works by taking a csv file and separating the entries by columns. The csv file has 5 columns: &lt;SPAN&gt;Block, ID, ID_value, Attribute, Attribute_Value.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;This is my first time working on AutoLISP so really anything could be wrong.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thank you so much for your time and help.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is my code, I will also upload the file below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(defun c:replaceAttributes (filePath)&lt;BR /&gt;(if (setq fp (open filePath "r"))&lt;BR /&gt;(progn&lt;BR /&gt;(while (setq line (read-line fp))&lt;BR /&gt;(if (&amp;gt; (length line) 0)&lt;BR /&gt;(progn&lt;BR /&gt;(setq values (mapcar 'atoi (strsplit line ",")))&lt;BR /&gt;(setq blockName (nth 0 values))&lt;BR /&gt;(setq attribName (nth 1 values))&lt;BR /&gt;(setq newValue (nth 2 values))&lt;BR /&gt;(if (setq b (ssget (list (cons 0 "INSERT") (cons 2 blockName))))&lt;BR /&gt;(progn&lt;BR /&gt;(foreach b (entget b)&lt;BR /&gt;(if (and (equal (cdr (assoc 2 b)) blockName) (equal (cdr (assoc 70 b)) 1))&lt;BR /&gt;(progn&lt;BR /&gt;(if (setq a (ssget (list (cons 0 "ATTRIB") (cons 8 b) (list (cons 2 attribName)))))&lt;BR /&gt;(progn&lt;BR /&gt;(setq attribs (entget a))&lt;BR /&gt;(if (setq index (assoc 2 attribName attribs))&lt;BR /&gt;(progn&lt;BR /&gt;(setq newAttribs (subst (cons 2 newValue) index attribs))&lt;BR /&gt;(entmod newAttribs)&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;(close fp)&lt;BR /&gt;(alert "Attributes replaced.")&lt;BR /&gt;)&lt;BR /&gt;(alert (strcat "File " filePath " not found."))&lt;BR /&gt;)&lt;BR /&gt;)&lt;/P&gt;</description>
      <pubDate>Thu, 02 Feb 2023 00:29:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/error-malformed-list-on-input/m-p/11722945#M34856</guid>
      <dc:creator>paulo.barreraF8J36</dc:creator>
      <dc:date>2023-02-02T00:29:50Z</dc:date>
    </item>
    <item>
      <title>Re: Error: malformed list on input</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/error-malformed-list-on-input/m-p/11723108#M34857</link>
      <description>&lt;P&gt;you missed a closing parenthesis at the end&lt;/P&gt;&lt;LI-CODE lang="general"&gt;; https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/error-malformed-list-on-input/m-p/11722945#M443041
(defun c:replaceAttributes (filePath)
(if (setq fp (open filePath "r"))
(progn
(while (setq line (read-line fp))
(if (&amp;gt; (length line) 0)
(progn
(setq values (mapcar 'atoi (strsplit line ",")))
(setq blockName (nth 0 values))
(setq attribName (nth 1 values))
(setq newValue (nth 2 values))
(if (setq b (ssget (list (cons 0 "INSERT") (cons 2 blockName))))
(progn
(foreach b (entget b)
(if (and (equal (cdr (assoc 2 b)) blockName) (equal (cdr (assoc 70 b)) 1))
(progn
(if (setq a (ssget (list (cons 0 "ATTRIB") (cons 8 b) (list (cons 2 attribName)))))
(progn
(setq attribs (entget a))
(if (setq index (assoc 2 attribName attribs))
(progn
(setq newAttribs (subst (cons 2 newValue) index attribs))
(entmod newAttribs)
) ; progn
) ; if
); progn
) ; if
) ; progn
) ; if
) ; foreach
) ; progn
) ; if
) ; progn
) ; if
(close fp)
(alert "Attributes replaced.")
) ; while
(alert (strcat "File " filePath " not found."))
) ; progn
) ; if
) ; defun&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 02 Feb 2023 02:44:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/error-malformed-list-on-input/m-p/11723108#M34857</guid>
      <dc:creator>paullimapa</dc:creator>
      <dc:date>2023-02-02T02:44:28Z</dc:date>
    </item>
    <item>
      <title>Re: Error: malformed list on input</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/error-malformed-list-on-input/m-p/11723447#M34858</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/12867856"&gt;@paulo.barreraF8J36&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;..&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;This is my first time working on AutoLISP so really anything could be wrong.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;...&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;FONT size="3"&gt;There's a couple of things you need to fix on top of the 'malformed list input'&amp;nbsp; error,&amp;nbsp; to name a few&lt;/FONT&gt;&lt;/P&gt;
&lt;PRE&gt;(&amp;gt; (&lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;length&lt;/FONT&gt;&lt;/STRONG&gt; line) 0)  should be (&amp;gt; (&lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;strlen&lt;/STRONG&gt;&lt;/FONT&gt; line) 0)
&lt;/PRE&gt;
&lt;P&gt;&lt;FONT size="3"&gt;line variable's vale would be a string, the &lt;EM&gt;&lt;A href="https://help.autodesk.com/view/ACD/2016/ENU/?guid=GUID-DD227383-1895-46B6-A83B-43000FCC1018" target="_blank" rel="noopener"&gt;length&lt;/A&gt; &lt;/EM&gt;function accepts a list type rather than a string&lt;/FONT&gt;&lt;/P&gt;
&lt;PRE&gt;(strsplit line ",") &amp;lt;--- pretty sure this is splitting the value of line variable to a list of string
(&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;mapcar 'atoi&lt;/STRONG&gt;&lt;/FONT&gt; (strsplit line ",")) &amp;lt;-- then you convert all items to an integer
&lt;/PRE&gt;
&lt;P&gt;&lt;FONT size="3"&gt;By doing that,&amp;nbsp; Block column would&amp;nbsp; come out as &lt;STRONG&gt;0 &lt;/STRONG&gt;if the value is a string ( block name i assumed )&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="3"&gt;This is what you probably get if the items omn the list happens to be a mix of Numbers and Letters &lt;STRONG&gt;( 0 0 0 0 0)&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;PRE&gt;(setq b (ssget (list (cons 0 "INSERT") (cons 2 blockName)))) 
and
(entget b) &amp;lt;---- should be  (entget &lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;(ssname&lt;/STRONG&gt; &lt;/FONT&gt;b &lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;0)&lt;/STRONG&gt;&lt;/FONT&gt;)
&lt;/PRE&gt;
&lt;P&gt;&lt;FONT size="3"&gt;As variable b is a selection set, you need to iterate thru the selection using an index , look into &lt;A href="https://help.autodesk.com/view/ACD/2016/ENU/?guid=GUID-EFB83751-9AC5-4C52-AD3D-D971BC560C15" target="_blank" rel="noopener"&gt;&lt;EM&gt;ssname&lt;/EM&gt;&lt;/A&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;FONT color="#0000FF"&gt;&lt;FONT color="#000000"&gt;(foreach &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;b&lt;/STRONG&gt; &lt;/FONT&gt;(entget b)&lt;/FONT&gt;&lt;BR /&gt;(&lt;STRONG&gt;and&lt;/STRONG&gt; &lt;/FONT&gt;(equal (cdr (assoc 2 b)) blockName)
			  (equal (cdr (assoc 70 b)) 1)
		     &lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;)
&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;FONT size="3"&gt;The above will note work at all, during foreach,you have only have access at one item at a time, since the result from entget is an entity's&amp;nbsp;&lt;SPAN&gt;definition data similar to this&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="lisp"&gt;(-1 . &amp;lt;Entity name: 223b08e0dd0&amp;gt;) 
(0 . "INSERT") 
(67 . 1) 
(410 . "JUB-PH1-CLL-LD-DWG-31001") 
(8 . "0") 
(2 . "CLL_Revison Description") 
(10 0.0 0.0 0.0) 
(70 . 0) 
(71 . 0) &lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="3"&gt;You cant have DXF 2 and 70 at the same run,&amp;nbsp; besides ou should not use&amp;nbsp; b as a&amp;nbsp; variable for foreach, as that is already defined as the selection set.&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="3"&gt;Post a sample of the csv or perhaps a drawing so we could guide you and let you finish your code.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Feb 2023 07:34:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/error-malformed-list-on-input/m-p/11723447#M34858</guid>
      <dc:creator>pbejse</dc:creator>
      <dc:date>2023-02-02T07:34:04Z</dc:date>
    </item>
    <item>
      <title>Re: Error: malformed list on input</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/error-malformed-list-on-input/m-p/11725122#M34859</link>
      <description>&lt;P&gt;Thank you so much!&lt;/P&gt;</description>
      <pubDate>Thu, 02 Feb 2023 18:03:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/error-malformed-list-on-input/m-p/11725122#M34859</guid>
      <dc:creator>paulo.barreraF8J36</dc:creator>
      <dc:date>2023-02-02T18:03:15Z</dc:date>
    </item>
    <item>
      <title>Re: Error: malformed list on input</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/error-malformed-list-on-input/m-p/11725125#M34860</link>
      <description>&lt;P&gt;This is my sample csv. How must I change it to work?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your help!&lt;/P&gt;</description>
      <pubDate>Thu, 02 Feb 2023 18:04:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/error-malformed-list-on-input/m-p/11725125#M34860</guid>
      <dc:creator>paulo.barreraF8J36</dc:creator>
      <dc:date>2023-02-02T18:04:11Z</dc:date>
    </item>
    <item>
      <title>Re: Error: malformed list on input</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/error-malformed-list-on-input/m-p/11725265#M34861</link>
      <description>&lt;P&gt;I have gotten it to load, but when I run the command&amp;nbsp;&lt;SPAN&gt;c:replaceAttributes it is saying unknown command.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;What would the reason be that it is not allowing me to use the command?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I have uploaded it to the startup suite as well as loaded it on the appload page. I also have the .lisp in an autocad supported folder specifically c:/program files/autodesk/Autocad 2023/Support&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Feb 2023 18:47:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/error-malformed-list-on-input/m-p/11725265#M34861</guid>
      <dc:creator>paulo.barreraF8J36</dc:creator>
      <dc:date>2023-02-02T18:47:50Z</dc:date>
    </item>
    <item>
      <title>Re: Error: malformed list on input</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/error-malformed-list-on-input/m-p/11725364#M34862</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/12867856"&gt;@paulo.barreraF8J36&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;.... when I run the command&amp;nbsp;&lt;SPAN&gt;&lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;c:&lt;/FONT&gt;&lt;/STRONG&gt;replaceAttributes it is saying unknown command.&amp;nbsp;&lt;/SPAN&gt;....&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Don't include the &lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;c:&lt;/FONT&gt;&lt;/STRONG&gt; -- that's not part of the command name.&lt;/P&gt;</description>
      <pubDate>Thu, 02 Feb 2023 19:24:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/error-malformed-list-on-input/m-p/11725364#M34862</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2023-02-02T19:24:29Z</dc:date>
    </item>
    <item>
      <title>Re: Error: malformed list on input</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/error-malformed-list-on-input/m-p/11725479#M34863</link>
      <description>&lt;P&gt;Yes I figured that out quickly. The issue now is that it is saying I don't have enough arguments, but the way I changed the script should prompt for a file path:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(defun c:replaceAttributes ()&lt;BR /&gt;(setq filePath (open (strcat "Select Attribute Data CSV file: ")))&lt;BR /&gt;(if (not filePath) (exit))&lt;BR /&gt;(setq fileData (readFile filePath))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It doesn't do this, and I am not sure why&lt;/P&gt;</description>
      <pubDate>Thu, 02 Feb 2023 20:04:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/error-malformed-list-on-input/m-p/11725479#M34863</guid>
      <dc:creator>paulo.barreraF8J36</dc:creator>
      <dc:date>2023-02-02T20:04:36Z</dc:date>
    </item>
    <item>
      <title>Re: Error: malformed list on input</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/error-malformed-list-on-input/m-p/11726450#M34864</link>
      <description>&lt;P&gt;&lt;FONT size="3"&gt;Thank you for posting the csv, if you don't mind also sharing the following items&lt;/FONT&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;FONT size="3"&gt;Drawing file with target blocks listed on the csv&lt;/FONT&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;FONT size="3"&gt;strsplit function&lt;/FONT&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;FONT size="3"&gt;&lt;SPAN&gt;readFile function&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Feb 2023 05:35:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/error-malformed-list-on-input/m-p/11726450#M34864</guid>
      <dc:creator>pbejse</dc:creator>
      <dc:date>2023-02-03T05:35:45Z</dc:date>
    </item>
    <item>
      <title>Re: Error: malformed list on input</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/error-malformed-list-on-input/m-p/11727198#M34865</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/12867856"&gt;@paulo.barreraF8J36&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;... it is saying I don't have enough arguments, but the way I changed the script should prompt for a file path:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(defun c:replaceAttributes ()&lt;BR /&gt;(setq filePath (open (&lt;FONT color="#FF0000"&gt;strcat&lt;/FONT&gt; "Select Attribute Data CSV file: ")))&lt;BR /&gt;....&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Should your&lt;FONT color="#FF0000"&gt; (strcat)&lt;/FONT&gt; function be &lt;STRONG&gt;&lt;FONT color="#0000FF"&gt;(getstring)&lt;/FONT&gt;&lt;/STRONG&gt; instead, so that it will prompt you?&amp;nbsp; If so, investigate the &lt;FONT color="#0000FF"&gt;(getfiled)&lt;/FONT&gt; function, in which you can navigate to the file you want and select it, rather than type in the entire path and file name.&lt;/P&gt;</description>
      <pubDate>Fri, 03 Feb 2023 12:34:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/error-malformed-list-on-input/m-p/11727198#M34865</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2023-02-03T12:34:55Z</dc:date>
    </item>
    <item>
      <title>Re: Error: malformed list on input</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/error-malformed-list-on-input/m-p/11728217#M34866</link>
      <description>&lt;P&gt;Getstring worked to ask for the location of the file, now I just need to figure out how to get my command to run and do what I want it to do&lt;/P&gt;</description>
      <pubDate>Fri, 03 Feb 2023 18:25:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/error-malformed-list-on-input/m-p/11728217#M34866</guid>
      <dc:creator>paulo.barreraF8J36</dc:creator>
      <dc:date>2023-02-03T18:25:10Z</dc:date>
    </item>
    <item>
      <title>Re: Error: malformed list on input</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/error-malformed-list-on-input/m-p/11728245#M34867</link>
      <description>&lt;P&gt;Here is the drawing of the block.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also aren't the other two functions you asked for just default functions in lisp?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have also managed to get the code to ask for the file path but it does not complete the task I want it to. Here is the updated code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(defun c:replaceAttributes ()&lt;BR /&gt;(setq filePath (open (getstring "Select Attribute Data CSV file: ")))&lt;BR /&gt;(if (not filePath) (exit))&lt;BR /&gt;(setq fileData (readFile filePath))&lt;BR /&gt;(progn&lt;BR /&gt;(while (setq line (read-line fp))&lt;BR /&gt;(if (&amp;gt; (length line) 0)&lt;BR /&gt;(progn&lt;BR /&gt;(setq values (mapcar 'atoi (strsplit line ",")))&lt;BR /&gt;(setq blockName (nth 0 values))&lt;BR /&gt;(setq attribName (nth 1 values))&lt;BR /&gt;(setq newValue (nth 2 values))&lt;BR /&gt;(if (setq b (ssget (list (cons 0 "INSERT") (cons 2 blockName))))&lt;BR /&gt;(progn&lt;BR /&gt;(foreach b (entget b)&lt;BR /&gt;(if (and (equal (cdr (assoc 2 b)) blockName) (equal (cdr (assoc 70 b)) 1))&lt;BR /&gt;(progn&lt;BR /&gt;(if (setq a (ssget (list (cons 0 "ATTRIB") (cons 8 b) (list (cons 2 attribName)))))&lt;BR /&gt;(progn&lt;BR /&gt;(setq attribs (entget a))&lt;BR /&gt;(if (setq index (assoc 2 attribName attribs))&lt;BR /&gt;(progn&lt;BR /&gt;(setq newAttribs (subst (cons 2 newValue) index attribs))&lt;BR /&gt;(entmod newAttribs)&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;(close fp)&lt;BR /&gt;(alert "Attributes replaced.")&lt;BR /&gt;)&lt;BR /&gt;(alert (strcat "File " filePath " not found."))&lt;BR /&gt;)&lt;BR /&gt;)&lt;/P&gt;</description>
      <pubDate>Fri, 03 Feb 2023 18:31:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/error-malformed-list-on-input/m-p/11728245#M34867</guid>
      <dc:creator>paulo.barreraF8J36</dc:creator>
      <dc:date>2023-02-03T18:31:53Z</dc:date>
    </item>
    <item>
      <title>Re: Error: malformed list on input</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/error-malformed-list-on-input/m-p/11728268#M34868</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/12867856"&gt;@paulo.barreraF8J36&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;....&lt;/P&gt;
&lt;P&gt;(setq filePath (open (getstring "Select Attribute Data CSV file: ")))&lt;BR /&gt;....&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Read in the AutoLisp Reference about the (open) function, and what arguments you need to give it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And answer the request for function definitions in Message 9.&lt;/P&gt;</description>
      <pubDate>Fri, 03 Feb 2023 18:37:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/error-malformed-list-on-input/m-p/11728268#M34868</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2023-02-03T18:37:02Z</dc:date>
    </item>
    <item>
      <title>Re: Error: malformed list on input</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/error-malformed-list-on-input/m-p/11728403#M34869</link>
      <description>&lt;P&gt;Are those functions not already defined in lisp? This is my first project in lisp so I am unfamiliar with what functions are built in (if any) and what the request for me to send in those functions really meant.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there any way that I could hop on a zoom call with one of you since it may be easier to debug in real time then sending messages back and forth?&lt;/P&gt;</description>
      <pubDate>Fri, 03 Feb 2023 19:30:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/error-malformed-list-on-input/m-p/11728403#M34869</guid>
      <dc:creator>paulo.barreraF8J36</dc:creator>
      <dc:date>2023-02-03T19:30:33Z</dc:date>
    </item>
    <item>
      <title>Re: Error: malformed list on input</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/error-malformed-list-on-input/m-p/11728597#M34870</link>
      <description>&lt;P&gt;See the &lt;A href="https://help.autodesk.com/view/ACD/2023/ENU/?guid=GUID-4CEE5072-8817-4920-8A2D-7060F5E16547" target="_blank" rel="noopener"&gt;AutoLisp Functions Reference&lt;/A&gt; for the defined functions.&amp;nbsp; No&lt;STRONG&gt;&lt;FONT face="courier new,courier" color="#000000"&gt; (readFile) &lt;/FONT&gt;&lt;/STRONG&gt;or&lt;STRONG&gt;&lt;FONT face="courier new,courier" color="#000000"&gt; (strsplit)&lt;/FONT&gt;&lt;/STRONG&gt;.&amp;nbsp; [There &lt;EM&gt;are&lt;/EM&gt; some undocumented functions, but these are not among them, or we wouldn't get those pesky "; error: no function definition:" messages.]&amp;nbsp; Somewhere do you have something that includes&lt;STRONG&gt;&lt;FONT face="courier new,courier" color="#000000"&gt; (defun readFile &lt;/FONT&gt;&lt;/STRONG&gt;and/or&lt;STRONG&gt;&lt;FONT face="courier new,courier" color="#000000"&gt; (defun strsplit &lt;/FONT&gt;&lt;/STRONG&gt;in it?&lt;/P&gt;</description>
      <pubDate>Fri, 03 Feb 2023 21:00:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/error-malformed-list-on-input/m-p/11728597#M34870</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2023-02-03T21:00:31Z</dc:date>
    </item>
    <item>
      <title>Re: Error: malformed list on input</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/error-malformed-list-on-input/m-p/11728729#M34871</link>
      <description>&lt;P&gt;No I do not, the place that I call it is here:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(defun c:replaceAttributes ()&lt;BR /&gt;(setq filePath (open (getstring "Select Attribute Data CSV file: ") "r"))&lt;BR /&gt;(if (not filePath) (exit))&lt;BR /&gt;(setq fileData (&lt;FONT color="#FF0000"&gt;readFile&lt;/FONT&gt; filePath))&lt;BR /&gt;(progn&lt;BR /&gt;(while (setq line (read-line fp))&lt;BR /&gt;(if (&amp;gt; (length line) 0)&lt;BR /&gt;(progn&lt;BR /&gt;(setq values (mapcar 'atoi (&lt;FONT color="#FF0000"&gt;strsplit&lt;/FONT&gt; line ",")))&lt;BR /&gt;(setq blockName (nth 0 values))&lt;BR /&gt;(setq attribName (nth 1 values))&lt;BR /&gt;(setq newValue (nth 2 values))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So there is no place that I define them as a function. I will look over that documentation.&lt;/P&gt;</description>
      <pubDate>Fri, 03 Feb 2023 22:07:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/error-malformed-list-on-input/m-p/11728729#M34871</guid>
      <dc:creator>paulo.barreraF8J36</dc:creator>
      <dc:date>2023-02-03T22:07:36Z</dc:date>
    </item>
    <item>
      <title>Re: Error: malformed list on input</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/error-malformed-list-on-input/m-p/11729166#M34872</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/12867856"&gt;@paulo.barreraF8J36&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Here is the drawing of the block.&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;Also aren't the other two functions you asked for just default functions in lisp?&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;..&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;FONT size="3"&gt;First of all, you choose not to follow the items i pointed out at post # 3 ( &lt;EM&gt;strlen, ssname, etc.).&amp;nbsp;&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="3" color="#0000FF"&gt;As pointed out at post # 15, those are not defined Lisp functions in AutoCAD.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="3"&gt;Let's analyze the csv and lisp code you posted.&lt;/FONT&gt;&lt;/P&gt;
&lt;PRE&gt;Block			| ID 		| ID_value		| Attribute	| Attribute_Value.
--------------------------------------------------------------------------------------------------
DENSITY_OA1-SENSOR_FOV	| SENSOR_ID	| TIAA-NY-F06-OAS001	| SERIAL_NUMBER	| D2FRG089
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="lisp"&gt;(defun c:replaceAttributes ( / filePath )
(defun strsplit ( str d_ )
  (while 
;  (setq filePath (open (getstring "Select Attribute Data CSV file: ")))
  (if (setq filePath (getfiled "Select Attribute Data CSV file" (getvar 'dwgprefix) " csv" 16))
    
; (setq fileData (readFile filePath))
    (progn
      (setq fp (open filePath "r"))
          (while (setq line (read-line fp))
;	    (&amp;gt; (length line) 0)
	     (if (and
		   (&amp;gt; (strlen line) 0)
;		(progn
;		(setq values (mapcar 'atoi (strsplit line ",")))
		(setq values (strsplit line ",")) ; function still not posted
	      	(setq blockName (nth 0 values))
	  	(setq attribName (nth 1 values))
	  	(setq newValue (nth 2 values))

;	(if
	    (setq b (ssget (list (cons 0 "INSERT") (cons 2 blockName))))
		   ....&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="3"&gt;Let's stop right there for now, if we use the sample CSV that you provided at post # 5, this is what you get as the first line&amp;nbsp; (provided the function&amp;nbsp;&lt;SPAN&gt;&lt;EM&gt;strsplit&lt;/EM&gt; spits out 5 items)&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;("DENSITY_OA1-SENSOR_FOV" "SENSOR_ID" "TIAA-NY-F06-OAS001" "SERIAL_NUMBER" "D2FRG089")&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;FONT size="3"&gt;(nth 0) blockName variable would be "DENSITY_OA1-SENSOR_FOV" | &lt;STRONG&gt;Block&amp;nbsp;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;FONT size="3"&gt;(nth 1) attribName is "SENSOR_ID" | &lt;STRONG&gt;ID&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;FONT size="3"&gt;(nth 2) newValue as "TIAA-NY-F06-OAS001" | &lt;STRONG&gt;ID_value&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&lt;FONT size="3"&gt;What about columns &lt;STRONG&gt;Attribute&lt;/STRONG&gt;&amp;nbsp;and &lt;STRONG&gt;Attribute_Value&lt;/STRONG&gt;? this is for "SERIAL_NUMBER" tag.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="3"&gt;The program prompts the user to select the target block on screen, if there's only one block name on the csv and the user know the block name beforehand then they can select it visually,&amp;nbsp; nowhere in the code&amp;nbsp; shows the name of the block for the user to identify which block object to select.&amp;nbsp; and if that is the case and there are multiple blocks on screen, the which value goes to what block object?&amp;nbsp; &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="3"&gt;Are you wanting to assign the ID_value based on an existing Attribute_value or vice versa automagically?&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="3"&gt;That is why its important to show the intent on a sample drawing, what you posted is a drawing that includes the block reference "DENSITY_OA1-SENSOR_FOV" but not the result you wanted. That sample will clear up any other question. And honestly the program is fairly easy, In fact its so easy, most of forum members here can replicate the two missing functions.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="3"&gt;Help us help you&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/12867856"&gt;@paulo.barreraF8J36&lt;/a&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 04 Feb 2023 04:03:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/error-malformed-list-on-input/m-p/11729166#M34872</guid>
      <dc:creator>pbejse</dc:creator>
      <dc:date>2023-02-04T04:03:39Z</dc:date>
    </item>
    <item>
      <title>Re: Error: malformed list on input</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/error-malformed-list-on-input/m-p/11729347#M34873</link>
      <description>&lt;P&gt;&lt;SPAN&gt;(setq filePath (open (getstring "Select Attribute Data CSV file: ") "r")) also as suggested use Getfile this is to easy to just type the wrong answer then the code will not work.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Getfile supports look for csv as file type and where to start looking for the file.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 04 Feb 2023 07:00:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/error-malformed-list-on-input/m-p/11729347#M34873</guid>
      <dc:creator>Sea-Haven</dc:creator>
      <dc:date>2023-02-04T07:00:55Z</dc:date>
    </item>
    <item>
      <title>Re: Error: malformed list on input</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/error-malformed-list-on-input/m-p/11729782#M34874</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/6254908"&gt;@Sea-Haven&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&lt;SPAN&gt;... as suggested use &lt;FONT color="#FF0000"&gt;Getfile&lt;/FONT&gt; ... easy to just type the wrong answer ....&lt;/SPAN&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;[My suggestion in Message 10 was to use the&lt;FONT size="4"&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier" color="#000000"&gt; (getfile&lt;FONT size="5" color="#0000FF"&gt;d&lt;/FONT&gt;) &lt;/FONT&gt;&lt;/STRONG&gt;&lt;/FONT&gt;AutoLisp function.&amp;nbsp; The&lt;FONT face="courier new,courier" size="4"&gt;&lt;STRONG&gt;&lt;FONT color="#0000FF"&gt; d&lt;/FONT&gt; &lt;/STRONG&gt;&lt;/FONT&gt;is for &lt;FONT face="courier new,courier" size="4"&gt;&lt;STRONG&gt;&lt;FONT color="#0000FF"&gt;d&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/FONT&gt;ialog box.]&lt;/P&gt;</description>
      <pubDate>Sat, 04 Feb 2023 14:14:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/error-malformed-list-on-input/m-p/11729782#M34874</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2023-02-04T14:14:12Z</dc:date>
    </item>
    <item>
      <title>Re: Error: malformed list on input</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/error-malformed-list-on-input/m-p/11733910#M34875</link>
      <description>&lt;P&gt;So the way I intended it to be written was that it would automatically change the attribute value of the block based on the ID. I will supply my test file below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Because all the blocks are the same the differentiating value is the ID, so the idea is to insert a specific attribute value or serial number for a specific ID as seen on the CSV.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am sorry for not being extremely helpful in my explanation,&amp;nbsp; I was a bit confused with what you were asking. Thank you for you assistance, it is much appreciated.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Feb 2023 18:37:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/error-malformed-list-on-input/m-p/11733910#M34875</guid>
      <dc:creator>paulo.barreraF8J36</dc:creator>
      <dc:date>2023-02-06T18:37:25Z</dc:date>
    </item>
  </channel>
</rss>

