(defun c:pp () (setvar "cmdecho" 0) (command "undo" "g") (if (setq point (getpoint "\nfrom point")) (progn (setq draw t ss (ssadd) pts nil pts (cons point pts) ) (while draw (initget 128) (setq point (getpoint (car pts) "\nUndo/Reverse/Close/<Endpoint to line>:")) (cond ((= point "u") (if (= (length pts) 1) (print "can't undo.") (progn (setq pts (cdr pts)) (command "zoom" "c" (car pts) "100") (command "erase" (entlast) "") ) ) ) ((= point "r") (command "zoom" "c" (car (reverse pts)) "100") (setq point (getpoint (car (reverse pts)))) (command "pline" (car (reverse pts)) point "") (command "zoom" "c" point "100") (setq pts (cons point (reverse pts)) ss (ssadd (entlast) ss) ) ) ((= (type point) 'list) (command "zoom" "c" point "100") (command "pline" (car pts) point "") (setq pts (cons point pts) ss (ssadd (entlast) ss) ) ) ((or (= point nil) (= point "e") (= point "c")) (command "pline" (car pts) (car pts) "") (setq ss (ssadd (entlast) ss)) (setq draw nil) ) (t (print "输入错误!只能输入点坐标或关键字.")) ) ) (if (> (length pts) 1) (progn (command "pline") (while pts (command (car pts)) (setq pts (cdr pts)) ) (if (= point "c") (command "c") (command "") ) (command "erase" ss "") ) ) ) ) (command "undo" "e") (prin1) ) |