How ChatGPT explained my Autolisp problem
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
As long as it's available, I think I'll be asking ChatGPT my questions first before coming here. It will even suggest code although it doesn't yet have a full knowledge of the limitations/differences in Autolisp vs LISP and VLX vs ActiveX. It will suggest alternate code if told of the invalid functions it had used and asked to rewrite it.
I got on this track this morning when I asked ChatGPT to analyze my code and suggest improvements. It replied that I could improve my code's speed and efficiency by using a dictionary instead of manipulating lists using MAPCAR, ASSOC, and NTH... and it wrote some code examples. Now, my 'find-nearest-point' function gets applied to an alignment data dictionary and examines each point tuple in the 2588 lisp data items and finds the one closest to a given point. It returns the result in a small fraction of a second. The previous list processing method, using the same data set (a list of 2588 lists of 13 items each), takes at least 2 seconds to return the result. I was stuck trying to understand why I could not use (VLAX-ITEM <dict> <key>)... so I asked ChatGPT. It gives such informed answers and does so very quickly too! I've found that the questions must be clear and complete. Its responses will let me know if my question misses the mark.
The 'add' method could not put my data lists because they are too complex. They don't look it to me but that was ChatGPT's assessment (the error said something about variants...) . That's why I shifted to 'vlax-ldata-put'.
Here is a typical data list item '("1" 0.0 442.448 430.951 0.0 0.01 (0 0 0) 8.0 (2 0 0 0) (1.88482e+06 496358.0 0.0) nil 0.0 nil)' Some of my data lists have been over 4,000 items which begins to slow things down noticably.
It seems like ChatGPT may be able to write some flawless code in a high level language like C# in .NET
I'm thinking I can learn to use C# much faster with ChatGPT's help. I'll explore that more.
Here's my last interaction with ChatGPT:
Product Version: 13.6.1963.0 Civil 3D 2024.4.1 Update Built on: U.202.0.0 AutoCAD 2024.1.6
27.0.37.14 Autodesk AutoCAD Map 3D 2024.0.1
8.6.52.0 AutoCAD Architecture 2024