(DEFUN C:FIXBD () (IF check_for_doslib NIL (LOAD "check_for_doslib" "\nFile CHECK_FOR_DOSLIB.LSP not loaded! ") ) ;_ end of IF (SETQ bd_file (DOS_GETFILED "Select a bearing/distance file" (GETVAR "dwgprefix") (STRCAT "File (*.txt)|*.txt|All files (*.*)|*.*||") ) ;_ end of dos_getfiled ) ;_ end of setq (SETQ bd_line_lst NIL bd_line_raw_lst NIL ) (SETQ opn_bd_file (OPEN bd_file "r")) (WHILE (SETQ rd_bd_line (READ-LINE opn_bd_file)) (SETQ bd_line_raw_lst (APPEND bd_line_raw_lst (LIST rd_bd_line))) ) ;_ end of WHILE (CLOSE opn_bd_file) (COND ((WCMATCH (CAR bd_line_raw_lst) "*\t*") (SETQ bd_line_lst (MAPCAR '(LAMBDA (x) (DOS_STRTOKENS x "\t")) bd_line_raw_lst)) ) ((WCMATCH (CAR bd_line_raw_lst) "* *") (SETQ bd_line_lst (MAPCAR '(LAMBDA (x) (DOS_STRTOKENS x " ")) bd_line_raw_lst)) ) (T (SETQ bd_line_lst NIL)) ) ;_ end of COND (IF bd_line_lst (PROGN (SETQ fixed_bd_lst (MAPCAR '(LAMBDA (x) (IF (EQUAL x (LIST "End")) x (IF (WCMATCH (CAR x) "[NS]##.##.##[EW]") (LIST (STRCAT (SUBSTR (CAR x) 1 3) "d" (SUBSTR (CAR x) 5 2) "'" (SUBSTR (CAR x) 8 2) "\"" (SUBSTR (CAR x) 10) ) ;_ end of STRCAT (IF (WCMATCH (CADR x) "*,*") (EVAL (CONS 'STRCAT (DOS_STRTOKENS (CADR x) ","))) (CADR x) ) ) ;_ end of LIST nil ) ;_ end of IF ) ;_ end of IF ) ;_ end of LAMBDA bd_line_lst ) ;_ end of MAPCAR ) ;_ end of SETQ (IF (MEMBER NIL fixed_bd_lst) (ALERT "There was a malformed bearing in the file!") (PROGN (SETQ opn_bd_file (OPEN bd_file "w")) (FOREACH n fixed_bd_lst (IF (EQ (LENGTH n) 2) (WRITE-LINE (STRCAT (CAR n) " " (CADR n)) opn_bd_file) (WRITE-LINE (CAR n) opn_bd_file) ) ;_ end of IF ) ;_ end of FOREACH (CLOSE opn_bd_file) ) ;_ end of PROGN ) ;_ end of IF ) ;_ end of PROGN (ALERT "No match for 'tab' or 'space'") ) ;_ end of IF ) ;_ end of DEFUN ;|«Visual LISP© Format Options» (120 2 15 2 T "end of " 100 9 2 0 nil nil nil T T) ;*** DO NOT add text below the comment! ***|;