这是我的建议:
- (defun c:test ( / ext sel sss listOfSelSets )
- (while (null ext)
- (setvar 'errno 0)
- (if sss (initget "Undo"))
- (setq sel (entsel (strcat "\nPick Object to Erase" (if sss " [undo]: " ": "))))
- (cond
- ((= 7 (getvar 'errno))
- (princ "\nMissed, try again.")
- )
- ((= "Undo" sel)
- (if listOfSelSets
- (progn
- (setq sss (car listOfSelSets)
- listOfSelSets (cdr listOfSelSets))
- (repeat (sslength sss)
- (entdel (ssname sss 0))
- (ssdel (ssname sss 0) sss)
- )
- )
- (prompt "\nNothing to undo...")
- )
- )
- ((= 'ename (type (car sel)))
- (setq sss (ssget "x" (list (cons 8 (cdr (assoc 8 (entget (car sel))))))))
- (command "erase" sss "")
- (setq listOfSelSets (cons sss
- listOfSelSets))
- )
- ((setq ext t))
- )
- )
- (princ)
- )
|