(defun c:txt-punti-linee (/ PuntoPrec) (if (not scala-txt)(setq scala-txt(getreal "\n Altezza delle scritte: "))) (setq tipo(getint "\n Punti 2D o 3D <2/3>: ")) (setvar "cmdecho" 0) (setq nomefile(getfiled "Selezionare il nome del File di punti" "" "txt" 4)) (setq Separatore ";") (setq nome-f(open nomefile "r")) (setq conta 1) (setq riga(read-line nome-f)) (while riga (setq lriga(strlen riga)) (setq i 0) (setq Valore "") (setq n "" x "" y "" z "") (repeat lriga (lett-car) (if (/= lett-chr Separatore) (setq Valore(strcat Valore lett-chr)) (cond ((= n "")(setq n Valore Valore "")) ((= x "")(setq x Valore Valore "")) ((= y "")(setq y Valore Valore "")) ((= z "")(setq z Valore Valore "")) ) ) (princ "\r Attendere... inserimento punto n. ")(princ n) ) (cond ((= n "")(setq n Valore Valore "")) ((= x "")(setq x Valore Valore "")) ((= y "")(setq y Valore Valore "")) ((= z "")(setq z Valore Valore "")) ) (setq punto(list (atof x) (atof y) (atof z))) (setq puntoxy(list (atof x) (atof y) 0.0)) (command "_layer" "_m" "0_PUNTI" \R) (if PuntoPrec (progn (command "_layer" "_m" "0_LINEE" \r) (if (= tipo 3)(command "_line" PuntoPrec Punto \r)(command "_line" PuntoPrec puntoxy \r)) )) (if (= tipo 3) (progn (command "_point" punto \r) (setq PuntoPrec punto) ) (progn (command "_point" puntoxy \r) (setq PuntoPrec puntoxy) ) ) (setq xy(polar puntoxy 0 (/ scala-txt 2))) (setq xygiu(polar xy (* pi 1.5) (* scala-txt 1.3))) (setq xysu(polar xy (* pi 0.5) (* scala-txt 0.3))) (command "_layer" "_m" "0_CODICI" \R) (command "_text" "_c" xysu (rtos scala-txt 2 2) "0" n \r) (command "_layer" "_m" "QUOTE" \R) (command "_text" "_c" xygiu (rtos scala-txt 2 2) "0" (rtos (atof z) 2 2) \r) (setq conta(+ conta 1)) (setq riga(read-line nome-f)) (if (= riga "")(setq riga(read-line nome-f))) ) (close nome-f) (princ) ) (defun lett-car () (setq i(+ i 1)) (setq lett-chr(substr riga i 1)) ) (setq tipo nil) (setq scala-txt nil) (princ "\n Software per l'inserimento nel disegno di punti") (princ "\n 2D o 3D e le linee che li uniscono. Le coordinate vengono lette da un file .txt") (princ "\n avente un punto su ogni riga.") (princ "\n Formato della riga: CODICE;X;Y;Z separati da un punto e virgola.") (princ "\n ") (princ "\n Digitare TXT-PUNTI-LINEE per lanciare il programma!") (princ)