Escolar Documentos
Profissional Documentos
Cultura Documentos
Contact
Site Map
AutoLISP
Beginners' Tutorials
Intermediate Tutorials
Advanced Tutorials
Application Tutorials
Tips'n'Tricks
Visual LISP
Beginners' Tutorials
Intermediate Tutorials
DCL
Beginners' Tutorials
Intermediate Tutorials
VBA
VBA Tutorials
VBA Applications
Tips'nTricks
AutoCAD
Customization Tutorials
Tips'n'Tricks
Reference
AutoLISP Functions
Visual LISP Sample Files
DXF Group Codes
The AutoCAD APIs
DCL Tile Attributes
AutoLISP DCL Functions
System Variables
AutoCAD Object Model
Sin and Cos Functions
VLAX Enumeration
Download
Forum
In AutoLISP, the process of establishing a value for a symbol is called assignment. The common way to do assignment is to
use SETQ. An assignment causes the value of its second argument to become the value of its first argument, which has to be
a symbol. A symbol is a lexical variable, declared implicitly.
SET is somewhat like SETQ except that SET does evaluate its first argument. Therefore the first argument must evaluate to
the name of a dynamic variable (one whose value is to be created dynamically). The only other difference is that SET takes
only two arguments.
A common use of the SET assignment is to define symbols at runtime, and is sometimes more efficient than list construction
when the number of items is not known in advance. As an illustration of this, the following lisp routine example takes a
variable number of points, sorts them by their Y coordinate and draws a line using the sorted points.
(defun c:test ( / j lpt symb)
(setq j 1)
(while (set (read (strcat "point_" (itoa j)))
(getpoint "\nPoint : ")
)
(setq j (1+ j))
)
;; Last point is nil.
(setq j (1- j))
;; Sort the points. See function "sortpoints" below.
(sortpoints j)
;; Initialize the list of points to be passed to (command "_line")
(setq lpt (list ""))
;; Construct the list and set each of our
;; "on the fly" symbols to nil
(while (> j 0)
(setq
symb (read (strcat "point_" (itoa j)))
lpt (cons (eval symb) lpt)
)
(set symb nil)
(setq j (1- j))
)
;; draw the line
(command "_line")
(mapcar 'command lpt)
(princ)
)
AutoLISP
AutoLISP Beginners' Tutorials
AutoLISP Intermediate Tutorials
AutoLISP Advanced Tutorials
AutoLISP Application Tutorials
AutoLISP Tips'n'Tricks
AfraLISP Archive
‘Hey, what's happened to AfraLISP?’ If you've visited our site before, you'll notice some big changes. We're currently
revamping the entire site to bring you updated tutorials and a better user experience. However, if there's something you can't
find, the AfraLISP Archive contains a full copy of the original site as originally created by Kenny Ramage.
Online Books
The ABC's of AutoLISP
The Visual LISP Developer's Bible
AutoLISP Forums
CADTutor
Autodesk Discussion Groups
Autodesk User Group International (AUGI)
The Swamp
Back to top
Home
Cared for by David Watson © 2018