(DEFUN C:PR ( / ) (while (setq outfn (ustr 0 "\nOutput Filename " outfn "")) (if outfn (progn (setq ofnsl (strlen outfn)) (setq ofpfx (substr outfn 1 (- ofnsl 4))) (setq ofsfx (substr outfn (- ofnsl 3))) (if incr (setq incr (+ incr 1)) (setq incr 1) );if (setq incrt (substr (itoa (fix incr)) 1 1)) (setq outfn (strcat ofpfx incrt ofsfx)) );progn );if (setq prg (car (ENTSEL "Select Existing Grade Polyline "))) (setq outf (open outfn "a")) (while (if (not (eq (cdr (assoc 0 (entget (entnext prg)))) "SEQEND")) (progn (setq prg (entnext prg)) (setq sta (rtos (cadr (assoc 10 (entget prg))))) (setq elev (rtos (/ (caddr (assoc 10 (entget prg))) 10.0000))) (setq ostr (strcat sta "," elev)) (write-line ostr outf) );progn );if );while (close outf) );while (PRINC) );defun