(defun c:emp (/ scala-txt ListaPunti ListaNumeri) (if (not scala-txt)(setq scala-txt(getreal "\n Altezza delle scritte: "))) (setq OScorr(getvar "OSMODE")) (setq LAcorr(getvar "CLAYER")) (setvar "OSMODE" 0) (setvar "cmdecho" 0) (setq nomefile(getfiled "Selezionare il nome del File .emp" "" "emp" 4)) (setq Separatore "|") (setq nome-f(open nomefile "r")) (setq conta 1) (setq riga(read-line nome-f)) (while riga (setq codice(substr riga 1 1)) (cond ((= codice "8")(Carica-punto riga)) ((= codice "7")(Carica-contorno riga)) ) (setq conta(+ conta 1)) (setq riga(read-line nome-f)) (if (= riga "")(setq riga(read-line nome-f))) ) (close nome-f) (setvar "OSMODE" OScorr) (setvar "CLAYER" LAcorr) (princ) ) ;;; ;;; ;;; (defun Carica-contorno (riga) (setq lriga(strlen riga)) (setq i 0) (setq Valore "") (setq cod "" num "" nn "" ListaNumeri nil) (repeat lriga (lett-car) (if (/= lett-chr Separatore) (setq Valore(strcat Valore lett-chr)) (cond ((= cod "")(setq cod Valore Valore "")) ((= num "")(setq num Valore Valore "")) ((= (substr Valore (strlen Valore) 1) "%")(setq ListaNumeri (cons Valore ListaNumeri) Valore "")) ) ) ) (cond ((= cod "")(setq cod Valore Valore "")) ((= num "")(setq num Valore Valore "")) ((= (substr Valore (strlen Valore) 1) "%")(setq ListaNumeri (cons Valore ListaNumeri) Valore "")) ) (command "_layer" "_m" "00_CONTORNI" \R) (setq i 0) (repeat (- (length ListaNumeri) 1) (setq vert0 (cdr (assoc (nth i ListaNumeri) ListaPunti))) (setq vert1 (cdr (assoc (nth (1+ i) ListaNumeri) ListaPunti))) (command "_line" vert0 vert1 \r) (setq i(1+ i)) ) ) ;;; ;;; ;;; (defun Carica-punto (riga) (setq lriga(strlen riga)) (setq i 0) (setq Valore "") (setq cod "" n "" y "" x "") (repeat lriga (lett-car) (if (/= lett-chr Separatore) (setq Valore(strcat Valore lett-chr)) (cond ((= cod "")(setq cod Valore Valore "")) ((= n "")(setq n Valore Valore "")) ((= y "")(setq y Valore Valore "")) ((= x "")(setq x Valore Valore "")) ) ) ) (cond ((= cod "")(setq cod Valore Valore "")) ((= n "")(setq n Valore Valore "")) ((= y "")(setq y Valore Valore "")) ((= x "")(setq x Valore Valore "")) ) (setq punto(list (atof x) (atof y))) (command "_layer" "_m" "00_PUNTI" \R) (command "_point" punto \r) (setq ListaPunti (cons (list n (atof x) (atof y)) ListaPunti)) ; scrivo il codice in AutoCAD... (setq xy(polar punto 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" "00_CODICI" \R) (command "_text" "_c" xysu (rtos scala-txt 2 2) "0" n \r) ) ;;; ;;; ;;; (defun lett-car () (setq i(+ i 1)) (setq lett-chr(substr riga i 1)) ) ;;; ;;; ;;; (princ "\n Software per l'inserimento nel disegno di punti da un file .emp") (princ "\n ") (princ "\n Digitare EMP per lanciare il programma!") (princ)