文档介绍:autolisp程序入门教学资料(AutoLISP program introductory teaching materials)
Introduction to AutoLISP programs
resources material
I. brief introduction of AutoLISP (advantages and disadvantages)
AutoLISP language is the main tool for developing Autocad. It is the product of bination of LISP language and Autocad. It plays an important role in the development and expansion of Autocad. It is because of the open architecture represented by AutoLISP that Autocad has been in an invincible position in numerous CAD petitions.
AutoLISP is an interpreted language, can be run directly in Autocad, rather than piled language with the help of the original program must piled and linked to piler to generate executable code modules, the user only needs the help of a text editor (such as DOS's "EDIT" program) can be programmed.
AutoLISP (List Processing Language) is a kind of list processing language? Quot; table "is the data structure of AutoLISP language unique, widely used in AutoLISP, the table is an effective method for a large amount of data stored in a variable. For example, AutoCAD represents three dimensional points in the form of three real numbers (X, Y, Z).
Two. Assignment method in AutoLISP
Unlike puter languages use infix method "to represent program statements (expression) and the" prefix ".
For example, in the C language, assign 125 to the real number X and write it:
X = 125;
The operator "=" is placed between operands X and 125.
And AutoLISP is written:
(setq X 125)
The operator "setq" is placed before operands X and 125.
"Setq" is the most important assignment function of AutoLISP. Almost all of the variable assignments should be implemented by quot; setq.
Three. How to add a mand to AutoCAD (or how to define a function)
Structure and loading of general program
In the following example, we will understand the structure of the general program of AutoLISP language, how to define a executable function in AutoCAD, the use of "setq", and how to load programs in A