home *** CD-ROM | disk | FTP | other *** search
/ Share Gallery 1 / share_gal_1.zip / share_gal_1 / GR / GR505.ZIP / LSP.EXE / SM.LSP < prev    next >
Text File  |  1989-01-28  |  971b  |  32 lines

  1. (defun C:SM ()
  2. ; variable set-up
  3.   (setvar "CMDECHO" 0)
  4.   (setq lun (getvar "LUNITS"))
  5.   (setq lup (getvar "LUPREC"))
  6.   (setq us "%%U")
  7.   (setq dd "DONE")
  8. ; input requirements
  9.   (setq cf
  10.   (getstring "\n Converting Standard to Metric ? < Y or N > : "))
  11.   (setq cf (strcase cf))
  12.   (if (or (= cf "Y") (= cf "N"))
  13.   (setq dp
  14.   (getint (strcat "\n Decimal Points ? < "(itoa lup)" > : ")))
  15.   (c:sm))
  16. ; function call to convert standard to metric
  17.        (setq a (ssget))
  18.        (setq n (sslength a))
  19.        (setq index 0)
  20.        (repeat n
  21.             (setq b1 (entget (ssname a index)))
  22.             (setq index (1+ index))
  23.             (setq c (assoc 1 b1))
  24.             (if (= cf "Y")
  25.             (setq d (cons (car c) (* (atof(cdr c)) 25.4)))
  26.             (setq d (cons (car c) (/ (atof(cdr c)) 25.4))))
  27.             (setq d1 (cons (car d) (rtos(cdr d)2 dp)))
  28.             (setq b2 (subst d1 c b1))
  29.             (entmod b2)
  30.             )
  31. (eval dd)
  32. )