THE GREYED OUT LINKS ON THE RIGHT WILL BE ACTIVATED STEP BY STEP. (SEE ALSO THE MAIN PAGE)

Friday, August 21, 2009

AutoLISP Forums

With Infos on AutoCAD AND BricsCAD:
theswamp.org: AutoLISP Forum !should know!
One of the most famous forums. I also found interesting BricsCAD related threads there. For using the search option you have to be registered, but that is IMHO well worth it.

With Special Focus On AutoCAD:
Autodesk Discussion Groups: Forum: Visual LISP, AutoLISP and General Customization Issues

AUGI: AutoLISP Forum

AutoLISP.com: AutoLISP Forum

AutoCAD Everything / LISP Routines Forum

CADTutor: AutoLISP, VBA, the CUI & Customisation Forum

CADchat cad forums: Autodesk Programming

CAD Forum: AutoCAD
A general AutoCAD forum that is also used for programming topics.

With Special Focus On BricsCAD:
Bricsys BricsCAD Forum
The official BricsCAD forum. All kinds of questions, also programming related.

IntelliCAD.net: Customization Forum

Special Subjects:
OpenDCL Forums

Monday, August 17, 2009

Display-Troubles with FireFox 3.5 & AfraLisp.net

EDIT: 2010/04/19: The issue has meanwhile been solved at it's roots since the whole AfraLISP-website got a redesign.

I already know of some users, that had problems in FireFox 3.5 to display the AfraLisp.net pages correctly. (Some others experience no problems.) I also had that problem. The text displayed as white text on a white background. That it is still there you could only see, if you seleced it (i.e. Strg+A). Strangely that is the only site where I noticed that behavior. Also with previous versions of FireFox the site got displayed correctly.

The only (satisfying) solution, that I found is this:
1) Install the FF-add-on "Stylish".
2) Create a new style with/inside this add-on with this content:
@-moz-document url-prefix('http://www.afralisp.net/') {
* { color: black }
}

3) That's it. Check the AfraLisp.net site, whether it is displayed correctly. (Some texts of links are black afterwards instead of having the correct link-color, but the underline should have the correct color.)

Isolated Topics for Advanced Beginners

2010/02/08:
ADDED: AutoLISP Coding Stlye-Link
CHANGED: Title
**
AutoLISP Coding Style (Reini Urban's AutoLISP FAQ) !should know!
Some links in this article are broken, but the information available is still useful.

ACET Functions at afralisp.net or
ACET Functions at jtbworld.com (zip -> pdf) !should know!
The documentation of a part of the ACET-functions (ACET = AutoCad Express Tools), which are NOT documented in the developer's help file (except for pityful 5 ones and at least 3 of those should really be listed under "Externally Defined Commands"). I will write more about the ACET-functions later on under the section "The ACET-functions in more detail". (In case the AfraLisp.net site gets display incorrectly in FireFox 3.5 or higher then look here.)

DOSLib - "The" AutoLISP Windows OS-extension !should know!
"DOSLib, is a library of AutoLISP-callable functions that provides a variety of Windows operating system capabilities to AutoCAD." [quote from the linked site] It is NOT an integral part of AutoLISP or AutoCAD. You have to download it from this third party website and intall it separatly. For the download you only have to fill in your e-mail address. Good thing: You can also download older version's that already work from AutoCAD R12 upwards and it's free! For those who need it's functions, it is surely worth it. (There are also a few Windows OS-functions as part AutoLISP itself as well as part of the ACET-functions (see above). These include i.e. functions working with the Windows registry, the Windows environment variables, the file system and beep sounds. For more details see the the appropriate references.)

Some of the next few links take you to freely downloadable course material of former Autodesk University (AU) courses. For downloading you have to register for free, which is IMHO well worth it.

AutoLISP Editor: It Should be Easy...It Is! (AU material)
"Checking Brackets; Watching Variables; Watching programs execute; Finding errors; Naming conventions" [quote from the linked site]

AutoLISP Level Two: Beyond the Crash Course (AU material)
"Working with selection sets; set filtering; entity modification; user input qualification; error handlers; and system variable manipulation. [...] Valuable tips to help you debug your code fast. [...] Prerequisites: [...] You should have attended 'The AutoLISP Crash Course'" [quote from the linked site] (The link to "The AutoLISP Crash Course" material is available under the section "Single Articles for Total Beginners".)

AutoLISP by Example, Part I (AU material)
"How to get information from users and the drawing; perform calculations; create transparent commands; manage and convert strings; utilize conditional functions; apply functions that loop through data; include error trapping in new commands; and maybe even take a peek at making AutoLISP interact with MS-DOS." [quote from the linked site]

AutoLISP by Example, Part II (AU material)
"Prerequisite: you must take AutoLISP by Example, Part I" [quote from the linked site]

Good Habits for Coding in Visual LISP (AU material)
"Identifying functions for use as toolbox routines; Autoloading beyond (autoload); Tools for getting input and handling errors; Storing data in a drawing; Accessing unopened drawings" [quote from the linked site]

LISP: Advance Yourself Beyond A Casual Programmer (AU material)
"Using advanced functions like Mapcar, Lambda, Apply,etc.; Using the Visual Lisp extensions and the development environment more than just a fancy text editor; Creating reactors-based programs that run automatically as your drawing changes; Harnessing the power of Visual Basic in Lisp; Mastering the art of recursive programming" [quote from the linked site]

Error Trapping and Good Programming Practices (pdf)
"... learn to apply some simple concepts to produce friendly, courteous AutoLISP programs." [quote from the linked document]

OpenDCL: DCL Has Evolved! (AU material)
"Creating stunning dialogs/forms (GUI) for your AutoLISP applications; Creating a tool palette like front end that interacts with your AutoLISP code; Easily adding a configuration tab to the AutoCAD Options dialog; Securely embedding your GUI into a VLX file" [quote from the linked site]

AutoCAD Hacker’s Handbook (incl. ActiveX) (pdf)
"Step into the mind of an Express Tools programmer and learn his favorite tricks." "How to display a dialog version of a command from lisp; Tips for Entity creation with Lisp; Error handling with the Express Tools error handler; Some common programming mistakes; Lisp performance tips; Tips for optimizing list processing; Error trapping with vl-catch-all-apply ...How to catch a lisp error and continue processing; How to call VBA/ActiveX functions from lisp; Tips for getting VBA/ActiveX API information; Methods of storing data so that is can accessed across drawings and/or across AutoCAD sessions" [quotes from the linked document]

Visual LISP: Using AutoCAD [ActiveX] Automation
"How to use — from within Visual LISP — some of the ActiveX tools built into AutoCAD software." [quote from the linked site]

A Few Basic AutoLISP Samples (incl. ActiveX) by John Prentice
Basic Command Function; Degrees to radians; Entity Data Extract; Erase All (Except); Intersection Solid; List Add; List Remove; Mid-Point Polar; Mid-Point XY; Nearest Polar; Radians to Degrees; Random Function; Setup Function; VLA Conversion; VLA Solid Volume; VLA Centroid; VLA Radius of Gyration; VLA Solid Interference; VLA Solid Bounding Box

Chosen Articles for Total Beginners

The following links take you to freely downloadable course material of former Autodesk University (AU) courses. For downloading you have to register for free, which is IMHO well worth it.

Fundamentals of AutoLISP (AU material)
"The class provides over 30 examples of code to help the student understand the syntax of this programming language. The material is designed for intermediate-level AutoCAD users who have never programmed in AutoLISP before." [quote from the linked site]

The AutoLISP Crash Course (AU material)
"This course starts at the beginning and rapidly moves you through concepts such as lists, accessing the command line, storing and retrieving variables, writing your own command functions, working with simple sets, and controlling AutoCAD's start-up to achieve greater standardization of your AutoCAD environment." [quote from the linked site]

AutoLISP for CAD Managers (AU material)
"This course lays out the basics of AutoLISP, using a building block approach with practical examples that you can use every day. We'll cover [how to] control system startup, how to load files from a network location, some basic syntax, accessing the command line, creating your own user command functions and undefining/redefining commands [...]. This class assumes you have intermediate AutoCAD capability [...]. No prior AutoLISP experience is necessary." [quote from the linked site]

Sunday, August 16, 2009

Special References

2010/06/21:
entry updated (-> AutoCAD's Commands Reference (at cadmaro.de))
**
AutoCAD Commands and System Variables:
The AutoCAD user's help file of course has lists of the commands and the system variables (sorted alphabetically). However, these are only for the current AutoCAD version. Here are some more listings which also take older versions into account:

AutoCAD Commands (at hyperpics.com)
for all AutoCAD versions from release 2000 upward in comparison

AutoCAD commands dictionary (at cadforum.cz)
for all AutoCAD versions starting from release R12 upward. It shows the version when the commands where introduced. Typing into the input-field immediately shows all matching commands. It also comes in a couple of local language-versions (i.e.: German, French, Spanish, Italian, Portuguese).

AutoCAD's Commands Reference (at cadmaro.de)
for AutoCAD versions from release 2002 upward in comparison (to the most recent previous release) with command options 
Attention: Although the linked site is primarily in German, it compares the German and English command's counterparts side by side. This means that all the commands are visible in English too - you just have to look closely. On the top of the page you can select the AutoCAD version. In the table, yellow (red for 2010) means new command, cream means changed command and blue (grey for 2010) means that the command is not supported/available anymore.

AutoCAD's System Variables Reference (at hyperpics.com)
for all AutoCAD versions from release 2000 upward in comparison

AutoCAD system variables (at cadforum.cz)
for all AutoCAD versions starting from release R12 upward. It shows the version when the system variables where introduced. Typing into the input-field immediately shows all matching variables. 

DXF:
AutoCAD's DXF References (at autodesk.com)
for all AutoCAD versions from release 13 upward (The current one is also part of the Developer's Documentation in the help file.)

ActiveX/COM (used i.e. in AutoLISP and VBA):
Acad-AX-History-Methods-Properties (pdf) (xls) (at cadwiesel.de)
for the AutoCAD versions 2000 to 2006 in comparison

AutoLISP Functions References:
There is the "AutoLISP Function Synopsis" in the developer's help file in the chapter "AutoLISP Developer's Guide" / "Appendixes" and especially for the DCL-functions there is the "Programmable Dialog Box Reference" in the chapter "AutoLISP Developer's Guide" / "Working with Programmable Dialog Boxes". For whom ever that is not enough, here are some more:

(Asmi(Tools)) AutoLISP Help (at asmitools.com)
A general AutoLISP functions reference "sorted according to purpose" into 28 categories and with "additional examples" by Aleksandr Smirnov. It also shows at least the documented ActiveX-functions and the DCL-functions.

Visual LISP Function Reference Chart (pdf A4) (pdf A3) (by Dr. June-Hao Hou)
A similar AutoLISP functions reference for AutoCAD 2000/2002/2004, sorted into 50 categories with ActiveX functions and a few important system variables but no DCL functions. (The name of course is misleading - see my AutoLISP-Intro, 5th par. ff. "Secondly...")

Catalog of Function Definitions by Ron Leigh (at ronleigh.info)
Another (older) AutoLISP functions reference sorted into 21 categories. It does not show any ActiveX-functions nor any DCL-functions.

AutoLISP Functions (pdf) (jadp.co.uk)
Yet another (older) AutoLISP functions reference sorted into 32 categories. It also includes the DCL-functions but no ActiveX-functions. The advantage might be, that it is on pdf, so it may be easier to print.

Other AutoLISP Specific References:
OpenDCL (Runtime) Reference (at opendcl.com)
For more on OpenDCL see their Homepage. (This link is also available under the section "AutoLISP: Online-Tutorials".)

ACET Functions Reference (html) (at afralisp.net) or
ACET Functions Reference (zip -> pdf) (at jtbworld.com)
I will write more about the ACET-functions later on under the menu-link "The ACET-functions in more detail". (These links are also available under the section "AutoLISP: Single Articles for Adv. Beginners". And in case the AfraLisp.net site gets display incorrectly in FireFox 3.5 or higher then look here.)

DOSLib Reference (at en.wiki.mcneel.com)
The Reference on their Homepage gives you only a brief overview. For more details you have to download their product and look into the included help file. (This link is also available under the section "AutoLISP: Single Articles for Adv. Beginners".)

Real Books

I really only now German AutoLISP books.

But if someone knows about a good English AutoLISP book I would be happy to read about it in the comments. Thanks.

But maybe ... my best tip for a real AutoLISP beginner would be:
AutoCAD: Secrets Every User Should Know (link to amazon.com)
by Dan Abbott; ISBN-10: 0470109939; ISBN-13: 978-0470109939
Why? Because it has 2 chapters (92 pages) about AutoLISP, wich should be enough to get one started, next to all other kinds of useful AutoCAD stuff - at least, if you can believe that bunch of >10 reviewers, which is a big enough number for me, coupled with that percentage of positive feedback (wow!), that I would put my trust in them if I was an AutoLISP beginner. - And no, I don't get payed, neither by amazon nor by Dan nor by his publisher ;)

AutoLISP Online-Tutorials

As mentioned in my AutoLISP-Intro for Beginners be aware first that there is an AutoCAD Developer Reference for AutoLISP that you find among the help files that come with your AutoCAD installation. Beyond that the following links might be of interest.

General AutoLISP and the "old" DCL:
AutoLISP Learning Series
The first of a series of 14 lessons on AutoLISP published by Autodesk. This is another tutorial than the one in the help file.

AfraLisp.net
A whole lot of tutorials and infos on AutoLISP, the "old" DCL and more by Kenny Ramage & David Watson (incl. a nice tutorial focused on ActiveX - Kenny calls it "Visual Lisp Tutorials"). This site offers a lot of valuable knowledge and is written very well. (In case the AfraLisp.net site gets display incorrectly in FireFox 3.5 or higher then look here.)

Daily Autocad: Intro to AutoLISP (1), 2, 3, 4, 5, 6, 7, 8, 9, 10
Tutorials on AutoLISP by Orhan Toker covering quite some basics but unfortunately discontinued after lesson 10

JefferyPSanders.com
Tutorials on AutoLISP and the "old" DCL by ... yep, by Jeffery P. Sanders ;)

Ron Leigh AutoLISP Programming
Tutorial on AutoLISP by ... (another "easy killer") yep, by Ron Leigh (;

Draftsperson.net
Tutorial on AutoLISP by Draftsperson?? ... nooouu! It's by Allan Wise!

Visual LISP - Programming for Productivity
Tutorial on AutoLISP by Bill Kramer - straight and easy

Tailoring AutoCAD
Tutorial on AutoLISP and customization with 20 chapters by Ralph Grabowski. It is quite older (based on AutoCAD R13) but the basics are still the same.

The ABC's of AutoLISP
A book on AutoLISP by George Omura (-> here an interview with him) as a website. The book was originally published in 1990. So it's really old. But it certainly covers the very basics and might be of interest for the one or the other reader.

Special Subjects:
Getting Started with DCL Dialogs
Tutorial on the "old" DCL hosted by the AutoLISP Exchange website

OpenDCL - the new and better DCL !should know!
OpenDCL is NOT an integral part of AutoLISP or AutoCAD. You have to download it from this third party website and intall it separatly. It works only from AutoCAD 2004 upward. Good thing: it is free! Everything is explained on their website. It's really well done. Check it out.

The Visual LISP Developers Bible
"Visual LISP Development with AutoCAD 2004" - An advanced tutorial with special focus on ActiveX by David M. Stein; (The AutoLISP basics are NOT covered in here but other tutorials may have some info on ActiveX.)

Saturday, August 15, 2009

My AutoLISP-Intro for Beginners

A First Thought About AutoLISP:
At first, because of a few people talking AutoLISP down and claiming that it won't be here for much more longer (maybe they are confusing it with VBA?), I want to emphasize that AutoLISP will still be around for quite some time going by what Autodesk (AutoCAD) and Bricsys (BricsCAD) related people write. It also makes sense for Autodesk and Bricsys to keep it, especially even more so since VBA really is gradually disappearing. AutoLISP is fairly easy to learn and at the same time pretty powerful. In a way the ideal environment for advanced drafters, CAD managers and the like people, who want to do some CAD programming but do not do it all the time and don't want to or can not invest into learning a more complex language like the .NET dialects or even C++. (Besides the learning curve, with these languages it also takes longer to write a program.) So, if you decide to learn AutoLISP you will still be able to use it for a long time.

The First Learning Ressource:
The first and most important learning ressource, which you should be aware of, certainly is the help file that ships with AutoCAD. The subheadings "AutoLISP, Visual LISP and DXF" as well as "ActiveX-Automation and VBA" lead to Autodesk's Developer Documentation. It is advisable to study these pages first, but it is not imperative. There also is a lot of comprehensive information available online (see the other sections of this site). You should at least, however, keep Autodesk's Documentation in mind as a reference work - it's probably most important usage.

For easier reference I put a link to the developer's help file onto my computer-desktop. You should be able to find the chm-file under this or a similar path: "C:\Program Files\AutoCAD 2010\Help\acad_dev180.chm". In AutoCAD 2008, by the way, the chm-file was called only "acad_dev.chm".

For understanding how to use ActiveX (or COM as it is also called sometimes) in AutoLISP (this i.e. includes all the vlax- and vlr-functions and others) the Developer's Documentation inside the help file offers the "AutoLISP Developer's Guide" and therein the subheading "Using the Visual LISP Environment" / "Working with ActiveX". Since this extended topic, however, is more difficult to understand for many, especially if you are completely new to ActiveX/COM, I highlighted ActiveX related words on the AutoLISP learning pages of this site, so that you can find these links more easily.

Clarifying Some Confusion Regarding AutoLISP, Visual LISP and ActiveX:
As a last thought in this intro I want to clarify what AutoLISP, Visual LISP and ActiveX is (to each other) and what it is not. (At least according to my point of view.) Unfortunately these three sometimes get a little mixed up with each other by some. Even Autodesk itself is unclear (at least to me) in it's expressions in the help file and on the website regarding this.

Basically said, AutoLISP is the programming language that provides the foundation for using the other two.

Visual LISP really is the name of the IDE (integrated development environment) in AutoCAD that you write AutoLISP code with. The IDE is, so to say, a "visual" aid because before the IDE there was nothing (provided by Autodesk). You had to write your code in a normal text editor like notepad (or buy a 3rd-party environment). In BricsCAD it is still like that. That is why there is no Visual LISP in BricsCAD, although it supports the same language with the same functions. (Side-Info: Today, the only 3rd-party-AutoLISP-Editor, that I know of, is "LispLink". In demo-mode - without a license - this program allows only 100 lines of code to be viewed and edited. Any further lines will be cut. So don't save, if you open any larger files with it! The good side is that there is no expiration date.)

ActiveX (which is also called COM by some) is really another programming interface altogether. However, at the same time when AutoCAD got it's Visual LISP IDE it also got a whole new set of functions that make use of this other ActiveX-interface. Unfortunately these set of functions is called "Visual LISP functions" or similar. (Although I prefer the term "ActiveX functions".) Why unfortunately? Because the ActiveX interface really does not have much to do with the Visual LISP IDE at all. ActiveX is also used by VBA and can be used by .NET and almost any modern programming language. ActiveX is also used by the AutoLISP in BricsCAD without the Visual LISP IDE. So now, because of this mishap it sometimes sounds as if there was a new language created called "Visual LISP", replacing "AutoLISP", which is of course NOT the case. AutoLISP is still called AutoLISP, even though it has some functions more. That happens to many programming languages all the time, that they experience some extensions but that does not change the actual name of the programming language itself.

So, you see that these three are really three different things apart from each other, although they of course use each other. (The Visual LISP IDE uses AutoLISP and AutoLISP uses ActiveX.) Just be aware, that when you read "Visual LISP", as long as it is not referring to the IDE, you may read as well "AutoLISP". If you have a different opinion, I don't want to stop you. I just want to make my statement, the way I see it.

And now have fun checking out all the links. ;)