CADLisp Tools

Variables

(setq)

Assign a value to an AutoLISP symbol and return the stored value.

What it does

setq stores values for later use. It can assign one or several symbol/value pairs.

Simple example

(setq quantity 12)

Practical CAD example

(setq point (getpoint "\nPick insertion point: "))

The chosen coordinate list is stored in point.

Common mistakes

  • Quoting the variable name: use (setq count 1), not (setq 'count 1).
  • Forgetting that unlocalized variables can remain defined after a command finishes.
  • Assuming cancelled input always returns a usable value.

Related functions