π§ Lesson 5-5 β Using Built-in Functions in AutoLISP
Learn essential AutoLISP functions to store values, define commands, and manipulate data.
π What Youβll Learn
By the end of this lesson, youβll be able to:
Use key AutoLISP functions like setq, defun, princ, and prompt
Perform basic math operations using built-in functions
Combine and manipulate strings
Understand how these functions fit into real-world AutoCAD routines
π§ Why It Matters
AutoLISP offers dozens of built-in functions, but a few form the core of almost every routine. Mastering these will help you write smarter scripts, capture user input, and output clean results to the user.
π οΈ Tools Youβll Use
Function
Purpose
setq
Assigns values to variables
defun
Defines a new function or command
princ
Silently returns control to AutoCAD
prompt
Displays a message in the command line
+, -, *, /
Perform arithmetic operations
strcat
Combine strings
strlen
Return string length
π§ Lesson Structure
1οΈβ£ setq β Assign Values
setq (short for set quoted) is used to store a value in a variable.