Converting from Inches to Meters

AutoCAD AutoLISP & Visual LISP

 
Converting from Inches to Meters
 
 
 

If the current drawing units are engineering or architectural (feet and inches), the following routine converts a user-specified distance of inches into meters:

(defun C:I2M ( / eng_len metric_len eng metric)
  (princ "\nConverting inches to meters. ")
  (setq eng_len 
    (getdist "\nEnter a distance in inches: "))
  (setq metric_len  (cvunit eng_len "inches" "meters"))
  (setq eng (rtos eng_len 2 4) 
        metric (rtos metric_len 2 4))
  (princ 
    (strcat "\n\t" eng " inches = " metric " meters."))
  (princ)
)