mohamed hashad Posted July 29, 2022 Posted July 29, 2022 Is there any playlist in youtube or any video to teach me how to write a lisp step by step? Quote
Steven P Posted July 29, 2022 Posted July 29, 2022 Best way is to just go for it, rather than watching a video and learn by doing. So think of something that would be useful to automate with a script, post a question on here saying you want to learn and I am sure people will help you along the way 1 Quote
SLW210 Posted July 29, 2022 Posted July 29, 2022 Did you search YouTube? beginner autocad lisp routines - YouTube AfraLISP is a good start point as well....Learn AutoLISP for AutoCAD productivity | AfraLISP Here is a start.... 1 Quote
BIGAL Posted July 30, 2022 Posted July 30, 2022 Like Steven P pick a task just remember crawl, then walk, then run. Dont pick something to complicated. Most of us are still at a fast walk, with burst of speed. Once you have a task, ask not for code but method and you will get a lot of support if you have a go . 1 Quote
Steven P Posted July 30, 2022 Posted July 30, 2022 Her is very basic start which might give you ideas to get you going. Most of us started with something very simple, my goals are always to reduce the number of key presses or to improve consistency or speed of drawing. If you have written anything and want to ask about it, you can post the code in your question but press the code tag button above (it is the one in the text box here with '<>' - highlights the text as a code.. see below Open a text editor - going from first principles is the best way to learn the basics. Now save it as you want but save with a '.lsp' extension instead of say '.txt. Next define a LISP in that, you can copy this: (defun c:MyTestLisp ( / ) ) 'defun' is the thing that starts the definition. It has an opening bracket, ( and rhere needs to be a closing bracket to tell CAD where that command ends (always have pairs of brackets), So put a closing bracket right at the end of the LISP 'c:' tells the CAD that you can run this command from the command line. Some LISPs don't have this and some have others but if you want to run this directly put in the C MyTestLisp is your LISP name, this is the word you use to run it. Since it has a 'C:' in front just type that word in the command line and it will work. ( / ) is where you can define variables - always a good idea to define any you use here. Anything before the / are variables that are passed to the LISP at the start... can look at that another time, anything after local variables that only this LISP will use. If you dn't define a variable here it becomes global and that mens any LISP can use it... but if you don't expect that it can cause odd results, local variables are better. Right, save this, go to appload, and load it. Type MyTestLisp in the cokmand line and it runs. Does nothing yet but no error messages. First LISP I did was 'ZA', you might have a go put in this (commamnd "Zoom" "all") (command tells the LISP that you are using a CAD command, "..." are the inputs you would put into that command. Replace the LISP name with ZA, save, appload and so on, type in ZA and your drawing should zoom all, with 2 button presses instead of "zoom all", 8 buttons. First LISP made, have a go, get that to work, learn the process to get it working in CAD and then think about what you want to do 1 Quote
BIGAL Posted July 31, 2022 Posted July 31, 2022 Download Notepad++ it has a lsp style option it is well worthwhile for checking open & close brackets, it also has a run lisp from Notepad code, so you can test as you write. See red brackets check 2 Quote
meinfilel Posted August 1, 2022 Posted August 1, 2022 On 7/31/2022 at 3:08 AM, BIGAL said: Download Notepad++ it has a lsp style option it is well worthwhile for checking open & close brackets, it also has a run lisp from Notepad code, so you can test as you write. See red brackets check You can run AutoLISP code from notepad++ and see the results on AutoCAD or it treats it as it was simple LISP? I think the most important point is to have a goal and then gather information towards that goal. At the begging your code may be ugly, not efficient at all etc but if it works, you are on the right tracks. I would recommend this playlist: Quote
Steven P Posted August 1, 2022 Posted August 1, 2022 Notepad++ , sounds great but does it need administrator access to install, or is it a stand alone app? I have never looked at this because if I did ask I am sure the answer would be "No" to get it installed Quote
BIGAL Posted August 1, 2022 Posted August 1, 2022 Steven P not sure about admin rights as I run on a laptop and that is it I am the company. Try it. The run the code in Notepad++ is an extension that you download once you have installed N++. Inside Acad/Bricscad just type N++ and it runs. 1 Quote
Abrasive Posted August 3, 2022 Posted August 3, 2022 I have found a top of help from people here. I use Visual Studio code with a lisp plugin. not sure if its any better than Notepad++ but I'm used to the feel of visual studio. Also this PDF is very informative: http://www.caddsoftsolutions.com/download/AutoLISP Tutorials.pdf Quote
Jonathan Handojo Posted August 5, 2022 Posted August 5, 2022 (edited) On 8/3/2022 at 5:07 PM, Tom Matson said: I have found a top of help from people here. I use Visual Studio code with a lisp plugin. not sure if its any better than Notepad++ but I'm used to the feel of visual studio. Also this PDF is very informative: http://www.caddsoftsolutions.com/download/AutoLISP Tutorials.pdf VS code is definitely one of the best IDE used by many professional programmers out there to do coding, including myself. Even the programmers you'd see in some tutorials in Youtube or Udemy would also use them as well. If you know how to harness the full features that VS code has to offer (such as workspace, snippets, multiple cursors, etc....), it'll save you heaps of time in repetitive typing. The only thing that's bothering me when using AutoLISP with VS Code is the debugging and syntax checking for variable localisation. The Visual Lisp IDE (VLIDE command in AutoCAD 2020 or earlier) offers both features which I find extremely helpful when needing to debug, but this is not there yet in VS Code. One time I tried to do debugging, my CAD just crashed. Usually, even though I'd have to pay for it, I do lessons from Udemy. It has some very high quality tutorials, though sometimes the price ain't cheap. Edited August 5, 2022 by Jonathan Handojo Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.