AutoLisp Programming Examples
AutoLisp Program Basics
What is AutoLisp?
AutoLisp is based on the common LISP language, widely used in artificial intelligence
applications. As a subset of the LISP language, AutoLisp derives the majority of its
functions directly from the LISP language itself. LISP excels at working with lists, which
is exactly the type of information used in AutoCad. LISP is among the easiest of all
programming languages to learn. AutoLisp programs are written in any text editor such as
DOS EDIT or in Windows NOTE PAD.
Rules:
1. Every AutoLisp function begins and ends with a parenthesis ( ). 2. Any number in an
AutoLisp program that is less than 1, must include the zero before the decimal point.
(0.50, 0.75, 0.0625)
DATA TYPES:
INTEGERS:
Numbers that DO NOT have a decimal point. eg. 1, 10, 25, 100, 64, 0.
REALS:
Numbers that DO have a decimal point. eg. 1.25, 3.6, 25.4, 100.65, 0.00.
STRINGS:
Any alphanumeric character enclosed in double quotes. eg. "LINE",
"BILL", "TOM", "MARY", "APPLE"
LISTS:
Anything enclosed in parentheses. eg. (2.0 3.4 0.0), ("BILL" "TOM"
2.0), ("LINE" 1.0 3.56 0.0).
SYMBOLS:
Any user created AutoLisp variable is a symbol. eg. PT1, PT2, name, xpoint, ypoint.
Converting Data Types:
VARIABLES:
SETQ:
This function sets variables in AutoLisp. Command: (setq a 3.4); sets the variable a
to the real number 3.4 Command: (setq name "TOM"); sets the variable name to the
string "TOM".
GETXXX Functions:
MATH Functions
CONDITION Functions
LOOP Functions
String Manipulation
MORE TO COME SOON......
Back Home