home *** CD-ROM | disk | FTP | other *** search
/ Current Shareware 1994 January / SHAR194.ISO / cad_util / v8n8_cad.zip / TXTIN2.LSP < prev   
Lisp/Scheme  |  1993-07-23  |  1KB  |  45 lines

  1. (defun C:txtin (/ fln sty pt1 hgt rot f e txt)
  2.    (setq fln (getstring "\nFile name to import  "))
  3.    (setq sty (getstring "\nSTYLE name or <ENTER> to             keep style  "))
  4.    (setq pt1 (getpoint "\nPick text beginning point"))
  5.    (setq hgt (getdist pt1 "\nHeight or <ENTER> if             fixed height"))
  6.    (setq rot (getangle pt1 "\nText rotation  "))
  7.    (if (= rot nil)(setq rot 0))
  8.    (setq rot (rtd rot))
  9.    (setq f (open fln "r"))
  10.    (if (/= sty "") (command "text" "style" sty ^c))
  11.    (setq txt (read-line f))
  12.    (if (= hgt nil) (command "text" pt1 rot txt))
  13.    (if (/= hgt nil) (command "text" pt1 hgt rot txt))
  14.    (setq e 1)
  15.    (while e
  16.      (setq txt (read-line f))
  17.      (if (= txt nil) (setq e nil))
  18.      (command "text" "" txt)
  19.    )
  20.    (close f)
  21.  )
  22.  
  23. (defun rtd (a)
  24.    (/ (* a 180.0) pi))
  25.  
  26. (defun C:txtout  (/ fln f a n index e1 e txt)
  27.    (setq fln (getstring "\nFile name:  "))
  28.    (setq f (open fln "w"))
  29.    (setq a (ssget))
  30.    (setq n (sslength a))
  31.    (setq index (- n 1))
  32.    (repeat n
  33.      (setq e1 (entget (ssname a index)))
  34.      (setq index (- index 1))
  35.      (setq e (assoc 0 e1))
  36.      (if (= "TEXT" (cdr e))
  37.        (progn
  38.          (setq txt (cdr (assoc 1 e1)))
  39.          (write-line txt f)
  40.        )
  41.      )
  42.    )
  43.    (close f)
  44.  )
  45.