COMPREHENSIVE GUIDE TO LISP ROUTINES?

COMPREHENSIVE GUIDE TO LISP ROUTINES?

Anonymous
Not applicable
6,084 Views
6 Replies
Message 1 of 7

COMPREHENSIVE GUIDE TO LISP ROUTINES?

Anonymous
Not applicable

Does anyone know where I could find a comprehensive guide for writing my own lisp routines? I'd really like to learn the language so I can program my own with ease.

0 Likes
Accepted solutions (2)
6,085 Views
6 Replies
Replies (6)
Message 2 of 7

cadffm
Consultant
Consultant
Are you a programmer (which language)? Or have you also learn programming?

To know the object model is anotger part you have to learn.
And if you want to handle Architecture Objects, lisp isn't the best choice for you.

Why comprehensive?
The most important thing is to start with something, kearning about the syntax and the model object in this case.

https://knowledge.autodesk.com/search-result/caas/CloudHelp/cloudhelp/2018/ENU/AutoCAD-AutoLISP-Tuto...

https://help.autodesk.com/view/OARX/2019/ENU/?guid=GUID-A809CD71-4655-44E2-B674-1FE200B9FE30

http://www.afralisp.net/autolisp/tutorials/index.php?category_id=1

Or books - (yes the paper things)

The really best for the most important things (the basic knowledge, syntax and object model) i know it's not available in english, sorry).

Sebastian

0 Likes
Message 3 of 7

ronjonp
Advisor
Advisor

A comprehensive guide is within Google search .. I'm sure of it. 🙂

0 Likes
Message 4 of 7

doaiena
Collaborator
Collaborator
Accepted solution

As far as i am aware there is no comprehensive guide for autolisp programming. There are bits and pieces scattered all over the place. I myself learned programming through reading tutorials and forums, all from different sources. Here are some topics to learn, and some sources to find more information. It's far from a complete list of things to learn, but it will get you started.

Topics to learn:

1. defining a function - (DEFUN fun...) and (DEFUN c:fun...)

2. setting variables - (SETQ var ...)

3. types of variables - integer, real, string, list, boolean...

4. conditional statements - IF, PROGN and COND /cond is a bit harder to understand at first, but its much more powerfull/

5. creating and manipulating lists - LIST, CONS, APPEND, LENGTH, CAR, CDR, LAST, NTH, REVERSE, MEMBER, ASSOC

6. loops - REPEAT, WHILE, FOREACH

7. selecting entities - ENTSEL, ENTLAST

8. selection sets - SSGET, SSNAME, SSLENGTH, SSADD, SSMEMB

9. learn how to translate between entity and object - VLAX-ENAME->VLA-OBJECT and VLAX-VLA-OBJECT->ENAME

10. learn the difference between AutoLisp Entity and Visual Lisp Object and how to read and edit their properties - 

ENTGET, ENTMOD, DUMPALLPROPERTIES, GETPROPERTYVALUE, SETPROPERTYVALUE - for autolisp entities
VLAX-DUMP-OBJECT, VLA-GET..., VLA-PUT...  - for visual lisp objects

11. learn the autocad object model - http://help.autodesk.com/view/OARX/2018/ENU/?guid=GUID-A809CD71-4655-44E2-B674-1FE200B9FE30#GUID-A80...

12. working with autocad variables - GETVAR, SETVAR

13. advanced functions you should look at - SET, MAPCAR, LAMBDA, APPLY, VL-SOME, VL-EVERY, EVAL, VLAX-CREATE-OBJECT, VLAX-INVOKE, VLAX-INVOKE-METHOD, VLAX-GET-PROPERTY, VLAX-PUT-PROPERTY

 

Here are some tutorials that may help you:
http://www.afralisp.net/autolisp/
http://www.afralisp.net/visual-lisp/
http://www.jefferypsanders.com/autolisptut.html

Forums are also a great resource and many questions you may have are already answered there.
http://www.theswamp.org/index.php
http://www.cadtutor.net/forum/forum.php
http://forums.augi.com/index.php
http://www.lee-mac.com/index.html
https://forums.autodesk.com/

This is AutoCAD's Functions Reference. It has all the functions listed with detailed usage example and code example. If you are searching for a function, or you aren't sure how to use a particular function, this is the place to go.
http://help.autodesk.com/view/OARX/2018/ENU/?guid=GUID-4CEE5072-8817-4920-8A2D-7060F5E16547

Message 5 of 7

john.uhden
Mentor
Mentor
Accepted solution

Do a Google search for "The AutoLisp Bible" by David Stein.  His knowledge and brilliance are oustanding.  I know because I had the privilege to upgrade his proprietary work for a major conglomerate.  I learned a bundle about more complex issues.

Though for customary AutoLisp usage, I found that trial and error on my own were my best teachers.  But then there are little functions by geniuses who contributed to this forum in years past that are purely remarkable to me, such as Doug Wilson's transpose function, and @_gile's swap function, and Stephan Koster's use of a long (and ...).

With no intended offense to current contributors, I have the perception that the geniuses of years ago were more clever than those contributing these days.  I miss seeing them here.  But that's probably because I'm just an old fart trying to hang on to what I thought I used to do fairly well.  It's weird what it does to you when a long time friend and coworker dies and was younger than you.  I really dislike funerals, though I love one of those tricky questions I've heard... "What's the difference between an Irish wedding and an Irish funeral?"  "There's one less drunk at the funeral."

Just enjoy learning.  It helps to keep you young.

John F. Uhden

Message 6 of 7

reinaldo_togores
Contributor
Contributor

I have written a book on this. Take a look at:

http://lispexpert.blogspot.com/2018/07/release-2019-edition.html

 

Message 7 of 7

Anonymous
Not applicable

Refer to my Lisp Functions Sheet. You will get better Idea

 

Best auto Lisp functions Catogerization

0 Likes