In news:5183d104$0$37131$
4faf...@reader1.news.tin.it,
Il grande fardello <nonte...@virgilio.it.invalid> typed:
Aggiungo che ho un lisp che fa lo stesso lavoro perfettamente ma con dati
digitati da tastiera.
Rieccolo:
; *********************************************************************
; DISEGNA UN PUNTO DI COORDINATE POLARI DATE (Punto per polari)
; *********************************************************************
(defun c:polari (/ ht xyst xytx xnomep ynomep postx nomep nomep1 nomestr
stringa staz ang1 np x y dtr dis pt)
(setvar "blipmode" 1)
(setvar "AUNITS" 2)
(setvar "ANGDIR" 1)
(setvar "ANGBASE" ( * pi 0.5))
(setvar "AUPREC" 4)
(setvar "LUNITS" 2)
(setvar "LUPREC" 3)
(setvar "PDMODE" 3)
(setvar "PDSIZE" 2.0000)
(setvar "OSMODE" 0)
(setvar "CMDECHO" 0)
;se non esiste il layer TESTI, lo crea
(IF (not (TBLSEARCH "LAYER" "TESTI"))
(COMMAND "_LAYER" "_N" "TESTI" "_C" "1" "TESTI" ""));fine if
;se non esiste il layer PUNTI, lo crea
(IF (not (TBLSEARCH "LAYER" "PUNTI"))
(COMMAND "_LAYER" "_N" "PUNTI" "_C" "3" "PUNTI" ""));fine if
;se HTES non � impostato, preimposta HTES
(if (not htes) (setq htes 4.0));fine if
;chiede l'altezza per il testo
(setq ht (getreal (strcat "\nAltezza testi <" (rtos htes 2 2) ">: ")));fine
setq
;se HT non � stato impostato, significa che � stato confermato HTES, quindi
lo assegna
(if ht (setq htes ht));fine if
(command "stile" "" "" htes "" "" "" "" "")
(setq STAZ nil)
(while (not STAZ)
(setq staz (getint "\nSTAZIONE N.: "))
);wend
(setq XYST nil)
(while (not XYST)
(setq xyst (getpoint "\nCoordinate STAZIONE: "))
);wend
(setq xytx (LIST (+ (* 2 htes) (CAR XYST)) (+ (* 2 htes) (CADR XYST))))
(COMMAND "layer" "R" "Punti" ""
"punto" xyst
"layer" "R" "Testi" ""
"testo" xytx 100 staz
);fine command
(setq nomep (1+ staz) ang1 T)
(setq nomestr (getstring (strcat "\nPunto battuto: <" (itoa nomep) ">")))
(if (not nomestr) ;se nomestr � = NIL (ha ricevuto un INVIO)
(setq nomestr (itoa nomep)) ;imposta nomestr=nomep, ma informato STRING
(setq nomep (atoi nomestr)) ;altrimenti reimposta nomep=nomestr, ma in
formato INTEGER
);fine if
(while ang1 ;finch� ang1 � impostato... continua il ciclo
(setq ang1 (getreal "\nAngolo: "))
(if ang1
(progn
(initget 1)
(setq dis (getreal "\nDistanza: "))
(setq dtr (* pi (/ ang1 200.0)))
(setq x (+ (CAR XYST) (* dis (sin dtr))))
(setq y (+ (CADR XYST) (* dis (cos dtr))))
(setq pt (list x y))
(setq xnomep (+ X htes))
(setq ynomep (+ y htes))
(setq postx (list xnomep ynomep))
(command "layer" "R" "Punti" ""
"punto" pt
"layer" "R" "Testi" ""
"testo" postx 100 nomep
);fine command
(setq nomep (1+ nomep)
NOMESTR (itoa nomep)
nomep (getint (strcat "\n \n \nPunto battuto n.<" NOMESTR ">: "))
);fine setq
(if nomep (setq NOMESTR (itoa nomep))(setq nomep (atoi nomestr)));fine
if
);fine progn
);fine if
);fine while
(prompt "\n \nTerminato")
(princ)
);fine defun
--
Ciao