Professional Documents
Culture Documents
1960
.
AutoLISP LISP AutoCAD
. AutoLISP AutoCAD
AutoCAD .
AutoLISP TEXT EDITOR .
AutoCAD load .
(LISP)
1. Text Editor .
layer .
(defun c:lm() --> (lm:)
(setvar "cmdecho" 0)
(command "layer" "m" "1" "c" "green" ""
"m" "2" "c" "red" ""
"m" 3" "c" "yellow" ""
2. *.lsp .
makelayer.lsp . AutoCAD support
.
3. AutoCAD load .
command : appload( ) -->
4. LISP .
command : lm -->
(defun ) .
, lm (setvar)~(pric) .
Enter .
,
lm .
http://www.gumji.info/
acad.pgp .
.
1. Line
Notepad.exe
(:test1.lsp LSP)
load .
"line" "Li" .
c: "Li" .
"aa"
2. (defun ?
. (defun .
. "(" .
3. c: ?
command .
"c:" .
.
"Li" () . . .
4. (command "line")?
command .
"line"
.
!
(0,0) (100,100) .
.
(0,0) 10 .
center point,
.
5. "(" ")" .
.
.
.
"1+2"
(+ 1 2) .
1. () .
.
2. !! .
3. .
.
123 + 456 -> (+ 123 456)
123 x 456 -> (* 123 456)
546 - 123 -> (- 546 123)
345 / 123 -> (/ 345 123)
4.
.
1 + 2 + 3 + 4 + 5 -> (+ 1 2 3 4 5)
5 x 4 x 3 x 2 x 1 -> (* 1 2 3 4 5)
,
.
1 + ( 3 x 4 ) -> (+ 1 ( * 3 4))
( 4 / 2 ) -4 -> (- (/ 4 2) 4)
5. .
command :
. .
command: (+ 1 3)
(+ 1 3) . '4' .
.
.
1. ?
.
3.131492 .
3.141592 pi
pi 3.141592 .
(setq pi 3.141592)
.
2. (setq ?
. .
.
3. (setq A B)
B A , .
.
4.
(setq test1 3456.789)
3456.789 test1
. test1 3456.789
.
test1 <-- 3456.789 ,
test1 = 3456.789 .
.
(setq test1 123)
(setq test2 456)
(setq test3 (+ test1 test2))
5.
(setq test4 "this is sample")
!! " " . !!
test4 this is sample .
6.
, .
,
.
()
.
1. ...
(setq a 1)
(setq b 2)
(setq c 3)
. 1:1
(setq ,
.
(setq a 1
b2
c 3)
.
.
2. () .
(;) .
.
; .
(defun c:test()
; .
(setq a 1
; a 1 .
b2
; b 2 .
c3
; c 3 .
d (+ a b c)) ; a+b+c d .
)
; .
); end of defun
(;)
.
.
.
.
.