示例代码
- (defun c:sample (/ doyourthing a b c)
- (defun doyourthing (ls / pt)
- (princ (strcat "\nCurrent Beam size " "\t\t" (car ls)))
- (setq pt (getpoint "\nTesting purposes: Pick Point"))
- (command "_rectangle" "_non" pt "_non" (strcat "@" (itoa (cadr ls))
- "," (itoa (caddr ls))))
- )
- (setq marker (if (null marker) 0 marker))
- (while
- (progn
- (initget "Y L D")
- (setq a (getkword (if lst
- "\nCreate New List/"L" for Existing list [Yes/List/Done]?: "
- "\nCreate List [Yes/Done]: ")))
- (if (eq a "D") nil T)
- )
- (cond ((eq a "L")
- (foreach itm (reverse lst)(print itm)(princ))
- (setq b (getint "\nEnter List number: "))
- (setq c (nth (1- b) (reverse lst)))
- (doyourthing c)
- )
- ((eq a "Y")
- (prompt "\nEnter Data:")
- (setq b (getint "\nSpecify Depth of Beam: "))
- (setq c (getint "\nSpecify Heigth of Beam: "))
- (if (not (setq d (assoc (setq nm (strcat (itoa b) "X" (itoa c))) lst)))
- (setq lst (cons (list nm b c (setq marker (1+ marker))) lst)
- c (car lst))
- (progn
- (princ "\Data Already Exist, using previous Data")
- (setq c d))
- )
- (doyourthing c)
- )
- )
- );while (princ)
- )
HTH公司 |