我试图在你的代码中添加一行代码,看看我是否能更好地理解这门语言。
我想将这段代码合并到另一个lisp例程中,但我想首先尝试在代码中添加一行简单的代码。
添加了粗体代码。
- (defun c:hol ( / rows cols rowd rowv rowh hole )
-
- [b] (setq ins (getpoint "\nInsertion Point"))
- (setq len1 (getpoint "\nLength of Line"))[/b]
- (setq rows (getint "\nEnter the number of rows (---) <2>: ")
- cols (getint "\nEnter the number of columns (|||) <3>: ")
- rowd (getdist (strcat "\nBeam guage <" (rtos 30) ">: "))
- rowv (getdist (strcat "\nVertical center / center <" (rtos 50) ">: "))
- rowh (getdist (strcat "\nHorizontal center / center <" (rtos 50) ">: "))
- hole (getdist (strcat "\nHole diameter " (rtos 17.5) ">: "))
- )
- (if (= rows nil)(setq rows 2))
- (if (= cols nil)(setq cols 3))
- (if (= rowd nil)(setq rowd 25))
- (if (= rowh nil)(setq rowh 50))
- (if (= rowv nil)(setq rowv 25))
- (if (= hole nil)(setq hole 17.5))
- [b] (setq ins (getpoint "\nSelect insertion point: "))
- (setq pt02 (polar ins (dtr 90.0) len1 )) [/b]
- (if (> cols 1)(setq ins (polar ins pi (/ (* (1- cols) rowh) 2.0))))
- (repeat cols
- (setq lstpnt (polar ins (* pi 1.5) rowd))
- [b] (command "line" ins pt02 "") [/b]
- (entmake (list (cons 0 "circle")(cons 10 lstpnt)(cons 40 (/ hole 2.0))))
- (repeat (1- rows)
- (setq lstpnt (polar lstpnt (* pi 1.5) rowv))
- (entmake (list (cons 0 "circle")(cons 10 lstpnt)(cons 40 (/ hole 2.0))))
- )
- (setq ins (polar ins 0 rowh))
- )
- (princ)
- )
- (defun dtr (x)
- (* pi (/ x 180.0))
- )
|