Hi George,
Give this a shot mate:
- (defun c:mem ( / *error* block old pt scale val var ) (setq block "memnum") ;; Block to be Inserted (defun *error* ( msg ) (if old (mapcar 'setvar var old)) (or (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*") (princ (strcat "\n** Error: " msg " **"))) (princ) ) (setq var '("CMDECHO" "ATTREQ") old (mapcar 'getvar var)) (mapcar 'setvar var '(0 1)) (if (or (tblsearch "BLOCK" block) (findfile (strcat block ".dwg")) ) (if (and (setq val (getint "\nEnter member number to start with: ")) (progn (initget 6) (setq scale (getint "\nEnter scale factor: ")) ) ) (while (setq pt (getpoint "\nPick next Point: ")) (command "_.-insert" block "_S" scale "_non" pt "" (itoa val)) (setq val (1+ val)) ) ) (princ (strcat "\n--> " block ".dwg not Found.")) ) (mapcar 'setvar var old) (princ))
I've added some error trapping to your routine to check for valid input and existence of the block to be inserted. |