<?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: Help with OpenAI ChatGPT generated Autolisp code in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-openai-chatgpt-generated-autolisp-code/m-p/11619127#M37233</link>
    <description>&lt;P&gt;Seems the fundamental problem here is that the system doesn't know the syntax and semantics of IF, so it doesn't know when to close the parentheses, and when to use PROGN to group commands for the correct semantics.&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>Wed, 14 Dec 2022 08:23:30 GMT</pubDate>
    <dc:creator>martti.halminen</dc:creator>
    <dc:date>2022-12-14T08:23:30Z</dc:date>
    <item>
      <title>Help with OpenAI ChatGPT generated Autolisp code</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-openai-chatgpt-generated-autolisp-code/m-p/11613021#M37227</link>
      <description>&lt;P&gt;Hello All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Precursor: I have very limited knowledge in lisp and how to debug lisp code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was able to use the new ChatGPT implementation on the OpenAI website to write the lisp code below:&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;&lt;LI-CODE lang="general"&gt;;;; c:EQUALSPACE - Spaces a group of blocks evenly by a specified distance
;;;
;;; Usage:
;;;   1. Start the AutoCAD program and open a drawing.
;;;   2. Type "APPLOAD" on the command line and press Enter.
;;;   3. In the "Load/Unload Applications" dialog box, select "EQUALSPACE.LSP"
;;;      from the list and click the "Load" button.
;;;   4. Type "EQUALSPACE" on the command line and press Enter.
;;;   5. Follow the prompts to select the blocks and specify the distance.

(defun c:EQUALSPACE()
  "Spaces a group of blocks evenly by a specified distance"

    ;; Ask the user to select the blocks
    (if (not (setq blocks (entsel "Select blocks: ")))
        (princ "Oops! No blocks were selected. Try again.")

      ;; Ask the user to enter the distance
      (if (setq distance (getreal "Enter the distance to space the blocks: "))

          ;; Check that at least two blocks were selected
          (if (&amp;lt; (setq num_blocks (length blocks)) 2)
              (princ "Oops! You need to select at least two blocks. Try again.")

            ;; Calculate the total distance and the starting point
            (setq total_distance (* distance (- num_blocks 1)))
            (setq start_point (car (car blocks)))

            ;; Iterate over the blocks and move them to the appropriate locations
            (setq current_point start_point)
            (foreach block blocks
              (setq current_point (polar current_point (cadr block) total_distance))
              (command "move" block "" start_point (car current_point) (cadr current_point) 0)
            )
            (princ "EQUALSPACE completed successfully.")
          )
        )
      )
    )
)
&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, I am getting the errors below before I could even test if the lisp works in practice.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;These are the errors:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Regenerating model.
AutoCAD menu utilities loaded.*Cancel*
Command:
Command:
Command:
Command: AP
APPLOAD EQUAL_SPACE.lsp successfully loaded.
Command: ; error: syntax error
Command:
Command: EQUALSPACE
Unknown command "EQUALSPACE". Press F1 for help.&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any ideas why? Please explain like I am five years old.&lt;/P&gt;</description>
      <pubDate>Mon, 12 Dec 2022 00:33:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-openai-chatgpt-generated-autolisp-code/m-p/11613021#M37227</guid>
      <dc:creator>asimjian</dc:creator>
      <dc:date>2022-12-12T00:33:02Z</dc:date>
    </item>
    <item>
      <title>Re: Help with OpenAI ChatGPT generated Autolisp code</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-openai-chatgpt-generated-autolisp-code/m-p/11613173#M37228</link>
      <description>&lt;P&gt;1st error found.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(defun c:EQUALSPACE()
  "Spaces a group of blocks evenly by a specified distance"

(defun c:EQUALSPACE()
 ; "Spaces a group of blocks evenly by a specified distance"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Suggestion use \n for new line&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(princ "\nEQUALSPACE completed successfully. ")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Suggestion 2 when using appload then run 1st time on load just add this as last line.&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(c:EQUALSPACE)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Dec 2022 03:05:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-openai-chatgpt-generated-autolisp-code/m-p/11613173#M37228</guid>
      <dc:creator>Sea-Haven</dc:creator>
      <dc:date>2022-12-12T03:05:49Z</dc:date>
    </item>
    <item>
      <title>Re: Help with OpenAI ChatGPT generated Autolisp code</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-openai-chatgpt-generated-autolisp-code/m-p/11613189#M37229</link>
      <description>&lt;P&gt;Code modified as described by Sea Haven below:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;;;; c:EQUALSPACE - Spaces a group of blocks evenly by a specified distance
;;;
;;; Usage:
;;;   1. Start the AutoCAD program and open a drawing.
;;;   2. Type "APPLOAD" on the command line and press Enter.
;;;   3. In the "Load/Unload Applications" dialog box, select "EQUALSPACE.LSP"
;;;      from the list and click the "Load" button.
;;;   4. Type "EQUALSPACE" on the command line and press Enter.
;;;   5. Follow the prompts to select the blocks and specify the distance.

(defun EQUALSPACE()
  ;"Spaces a group of blocks evenly by a specified distance"

    ;; Ask the user to select the blocks
    (if (not (setq blocks (entsel "Select blocks: ")))
        (princ "Oops! No blocks were selected. Try again.")

      ;; Ask the user to enter the distance
      (if (setq distance (getreal "Enter the distance to space the blocks: "))

          ;; Check that at least two blocks were selected
          (if (&amp;lt; (setq num_blocks (length blocks)) 2)
              (princ "Oops! You need to select at least two blocks. Try again.")

            ;; Calculate the total distance and the starting point
            (setq total_distance (* distance (- num_blocks 1)))
            (setq start_point (car (car blocks)))

            ;; Iterate over the blocks and move them to the appropriate locations
            (setq current_point start_point)
            (foreach block blocks
              (setq current_point (polar current_point (cadr block) total_distance))
              (command "move" block "" start_point (car current_point) (cadr current_point) 0)
            )
          )
        )
      )
  (princ "\nEQUALSPACE completed successfully. ")
  )

;; Call the c:EQUALSPACE function to initialize the EQUALSPACE command
(c:EQUALSPACE)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Still getting a syntax error and command not found:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Regenerating model.
AutoCAD menu utilities loaded.*Cancel*
Command:
Command:
Command:
Command: AP
APPLOAD EQUAL_SPACE.lsp successfully loaded.
Command: ; error: syntax error
Command:
Command: EQUALSPACE
Unknown command "EQUALSPACE".  Press F1 for help.&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Dec 2022 03:23:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-openai-chatgpt-generated-autolisp-code/m-p/11613189#M37229</guid>
      <dc:creator>asimjian</dc:creator>
      <dc:date>2022-12-12T03:23:35Z</dc:date>
    </item>
    <item>
      <title>Re: Help with OpenAI ChatGPT generated Autolisp code</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-openai-chatgpt-generated-autolisp-code/m-p/11613214#M37230</link>
      <description>&lt;P&gt;Ok I should have read the code more, lots of problems&amp;nbsp;&lt;/P&gt;&lt;P&gt;;; Check that at least two blocks were selected&lt;/P&gt;&lt;P&gt;Your only selecting 1 block&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think what is best is post a dwg explaining what your trying to do as the code does not make much sense.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is it this&lt;/P&gt;&lt;LI-CODE lang="general"&gt;;; Call the c:EQUALSPACE function to initialize the EQUALSPACE command

(defun c:EQUALSPACE( / x distance blk ins ss)
(prompt "\nSelect blocks ")
(if (and (setq blocks (ssget '((0 . "INSERT"))))
    (&amp;gt; (sslength blocks) 1)
    )
    (progn
    (setq distance (getreal "Enter the distance to space the blocks: "))
    (setq start_point (getpoint "\nPick start point "))
    (repeat (setq x (sslength blocks))
      (setq blk (ssname blocks (setq x (1- x))))
      (setq ins (cdr (assoc 10 (entget blk))))
      (command "move" blk "" ins start_point)
      (setq start_point (mapcar '+ start_point (list distance 0.0 0.0)))
    )
   )
   (princ "\nOops! a min of 2 blocks need to be selected. Try again.")
)
(princ "\nEQUALSPACE completed successfully. ")
)
(c:EQUALSPACE)&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 12 Dec 2022 04:45:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-openai-chatgpt-generated-autolisp-code/m-p/11613214#M37230</guid>
      <dc:creator>Sea-Haven</dc:creator>
      <dc:date>2022-12-12T04:45:58Z</dc:date>
    </item>
    <item>
      <title>Re: Help with OpenAI ChatGPT generated Autolisp code</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-openai-chatgpt-generated-autolisp-code/m-p/11613364#M37231</link>
      <description>&lt;P&gt;Look like the AI algorithm writes the code all wonky and unusable. Appreciate the time spent on this experiment&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/6254908"&gt;@Sea-Haven&lt;/a&gt;.&lt;/P&gt;</description>
      <pubDate>Mon, 12 Dec 2022 06:28:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-openai-chatgpt-generated-autolisp-code/m-p/11613364#M37231</guid>
      <dc:creator>asimjian</dc:creator>
      <dc:date>2022-12-12T06:28:45Z</dc:date>
    </item>
    <item>
      <title>Re: Help with OpenAI ChatGPT generated Autolisp code</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-openai-chatgpt-generated-autolisp-code/m-p/11613512#M37232</link>
      <description>&lt;P&gt;Does it meet your needs ? There are smarter ways to display and order blocks.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Dec 2022 07:58:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-openai-chatgpt-generated-autolisp-code/m-p/11613512#M37232</guid>
      <dc:creator>Sea-Haven</dc:creator>
      <dc:date>2022-12-12T07:58:13Z</dc:date>
    </item>
    <item>
      <title>Re: Help with OpenAI ChatGPT generated Autolisp code</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-openai-chatgpt-generated-autolisp-code/m-p/11619127#M37233</link>
      <description>&lt;P&gt;Seems the fundamental problem here is that the system doesn't know the syntax and semantics of IF, so it doesn't know when to close the parentheses, and when to use PROGN to group commands for the correct semantics.&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>Wed, 14 Dec 2022 08:23:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-openai-chatgpt-generated-autolisp-code/m-p/11619127#M37233</guid>
      <dc:creator>martti.halminen</dc:creator>
      <dc:date>2022-12-14T08:23:30Z</dc:date>
    </item>
    <item>
      <title>Re: Help with OpenAI ChatGPT generated Autolisp code</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-openai-chatgpt-generated-autolisp-code/m-p/12494881#M37235</link>
      <description>&lt;P&gt;As already noted, ChatGPT doesn't know AutoLisp well enough yet.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The (entsel) function is for a &lt;EM&gt;single object&lt;/EM&gt;.&amp;nbsp; For &lt;EM&gt;more than one&lt;/EM&gt;, you would need to use (ssget) instead, but it does not allow you to spell out a prompt as (entsel) does.&amp;nbsp; You would need to add a (prompt) before it, and it will prompt with "Select objects: ".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The (if) function at line 22 has its 'then' argument on the next line, but lines 25 through 35 need to be "wrapped" in a (progn) function to make it all into a &lt;EM&gt;single&lt;/EM&gt; 'else' argument for the (if) in line 22.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The (foreach) function [line 31] is for stepping through a &lt;EM&gt;list&lt;/EM&gt;, not a selection set such as (ssget) returns.&amp;nbsp; There are ways to turn the selection set into a list of entity names first, or you can do it by stepping through the selection set with (repeat) or (while) and (ssname).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The Move command at line 33 needs the last three elements [XYZ coordinates of the displacement end point] wrapped into a (list).&lt;/P&gt;</description>
      <pubDate>Sat, 13 Jan 2024 13:32:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-openai-chatgpt-generated-autolisp-code/m-p/12494881#M37235</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2024-01-13T13:32:25Z</dc:date>
    </item>
    <item>
      <title>Re: Help with OpenAI ChatGPT generated Autolisp code</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-openai-chatgpt-generated-autolisp-code/m-p/12495313#M37236</link>
      <description>&lt;P&gt;ChatGP just does not meet the grade it makes obvious mistakes, like the select multiple as singles. Did you read what I posted ?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It would be best if you describe what it is your trying to achieve by posting a dwg. If its a legend showing blocks there are better ways to do it.&lt;/P&gt;</description>
      <pubDate>Sat, 13 Jan 2024 22:40:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-openai-chatgpt-generated-autolisp-code/m-p/12495313#M37236</guid>
      <dc:creator>Sea-Haven</dc:creator>
      <dc:date>2024-01-13T22:40:51Z</dc:date>
    </item>
    <item>
      <title>Re: Help with OpenAI ChatGPT generated Autolisp code</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-openai-chatgpt-generated-autolisp-code/m-p/12652822#M37237</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Can you explain the primary differences between Visual LISP and AutoLISP in the context of AutoCAD customization?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Mar 2024 08:14:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-openai-chatgpt-generated-autolisp-code/m-p/12652822#M37237</guid>
      <dc:creator>lionelmoen4</dc:creator>
      <dc:date>2024-03-20T08:14:03Z</dc:date>
    </item>
    <item>
      <title>Re: Help with OpenAI ChatGPT generated Autolisp code</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-openai-chatgpt-generated-autolisp-code/m-p/12652862#M37238</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;Please don't offend the natural intelligence of the people who provide help here by posting AI-generated code (the Stack Overflow site has banned generative AI).&lt;/P&gt;</description>
      <pubDate>Wed, 20 Mar 2024 08:43:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-openai-chatgpt-generated-autolisp-code/m-p/12652862#M37238</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2024-03-20T08:43:06Z</dc:date>
    </item>
  </channel>
</rss>

