;------------------------------
; Text importieren 30.6.91 AW
; eingebaut in e3f6
;-----------------------------
(Defun C:Import ()
  (Setvar "Cmdecho" 0)
  (If (= JUST nil) 
    (Setq TSIZE (Getvar "TEXTSIZE") LSPACE (* 2 TSIZE) JUST "L"))
  (If (= EFNAM nil) (Setq EFNAM ""))
  (Setq X (Getstring (Strcat "\nName der ASCII-Datei: <"
    EFNAM ">: ")))
  (If (/= X "") (Setq EFNAM X))
  (Setq EFPNT (Open EFNAM "r"))
  (If
    (= EFPNT nil)
      (Princ (Strcat "\n"(Chr 34) EFNAM (Chr 34) 
                     ": Datei kann nicht ge”ffnet werden!"))
      (Progn
        (Initget 6)
        (Setq X (Getdist (Strcat "\nTexth”he <"
          (Rtos TSIZE 2 3) ">: ")))
        (If (/= X nil) (Setq TSIZE X))
        (Initget 2)
        (Setq X (Getdist (Strcat "\nZeilenabstand <"
          (Rtos LSPACE 2 3) ">: ")))
        (If (/= X nil) (Setq LSPACE X))
        (Initget 1 "Z M R")
        (Setq X (Getpoint "\nStartpunkt oder Zentrieren/Mitte/Rechts: "))
        (Cond 
          ((= (Type X) 'List) (Setq P1 X) (Setq JUST "L"))
          ((= X "Z") (Setq JUST X)
            (Initget 1)
            (Setq P1 (Getpoint "\nZentrieren Punkt: "))
          )
          ((= X "M") (Setq JUST X)
            (Initget 1)
            (Setq P1 (Getpoint "\nMitte Punkt: "))
          )
          ((= X "R") (Setq JUST X)
            (Initget 1)
            (Setq P1 (Getpoint "\nEndpunkt: "))
          )
        )
        (Setq CRNTL (Read-line EFPNT))
        (While
          CRNTL
            (If
              (= JUST "L")
;                 (command "text" p1 0 crntl)
                (Command "Text" P1 TSIZE 0 CRNTL)
                (Command "Text" JUST P1 TSIZE 0 CRNTL)
            )
            (Setq P1 (List (Car P1) (- (Cadr P1) LSPACE)))
            (Setq CRNTL (Read-line EFPNT))
        )
        (Close EFPNT)
      )
  )
  (Princ)
)
