;;;Subroutine to convert a real no into a station string. If m_units=T then string is metric. ;;; ;;;> Author: Henry C. Francis ;;;> 425 N. Ashe St. ;;;> Southern Pines, NC 28387 ;;;> http://paracadd.com ;;;> All rights reserved. ;;; ;;;> COPYRIGHT: ;;;> EDITED: 10-07-2005 ;;; (defun stait (areal staprec /) ;;; (if staprec nil (setq staprec 1)) ;;; (princ "\nReal = ") ;;; (princ real) ;;; (princ "\nprecision = ") ;;; (princ staprec) (if m_units (progn (setq stanum (atof (rtos areal 2 staprec)) stahun (fix (/ stanum 1000)) starem (- stanum (* stahun 1000)) ) ;_ end of setq (strcat (itoa stahun) (if(< stanum 0) "-" "+") (if (and (<(abs starem)100) (>(abs starem)9)) (strcat "0" (rtos starem 2 staprec)) (if (<(abs starem)10) (strcat "00" (rtos (abs starem) 2 staprec)) (rtos (abs starem) 2 staprec) ) ;_ end of if ) ;_ end of if ) ;_ end of strcat ) ;_ end of progn (progn ;;; (PRINC "\nareal=") ;;; (PRINC areal) ;;; (PRINC "\nstaprec=") ;;; (PRINC staprec) ;;; (princ) (setq stanum (atof (rtos areal 2 staprec)) stahun (fix (/ stanum 100)) starem (- stanum (* stahun 100)) ) ;_ end of setq (strcat (itoa stahun) (if(< stanum 0) "-" "+") (if (<(abs starem)10) (strcat "0" (rtos (abs starem) 2 staprec)) (rtos (abs starem) 2 staprec) ) ;_ end of if (COND ((AND (> staprec 0)(not(wcmatch (rtos (abs starem) 2 staprec) "*.*"))) (COND ((EQ staprec 1) ".0") ((EQ staprec 2) ".00") ((EQ staprec 3) ".000") ((>= staprec 4) ".0000") (T "") )) ((AND (EQ staprec 2)(not(wcmatch (rtos (abs starem) 2 staprec) "*.##"))) "0") ((EQ staprec 3) (COND ((wcmatch (rtos (abs starem) 2 staprec) "*.#") "00") ((wcmatch (rtos (abs starem) 2 staprec) "*.##") "0") (T "") )) ((>= staprec 4) (COND ((wcmatch (rtos (abs starem) 2 staprec) "*.#") "000") ((wcmatch (rtos (abs starem) 2 staprec) "*.##") "00") ((wcmatch (rtos (abs starem) 2 staprec) "*.###") "0") (T "") )) (T "") ) ) ;_ end of strcat ) ;_ end of progn ) ;_ end of if ) ;_ end of defun ;|«Visual LISP© Format Options» (72 2 40 2 T "end of " 60 9 0 0 0 T T nil T) ***Don't add text below the comment!***|;