Registered forum members do not see this ad.
Working code:
Code:;;; Program to read the output data from the Corpson6 coordinate conversion ;;; By Ron Auble, 01/19/07, Auble Consulting. Last update 01/19/07 ;;; ;;; Passed: Nothing, prompted to select a data file ;;; Return: List of lines from data file in the form of '("Label" X-value Y-value) ;;; (defun ReadUTM ( / FName LINE xFN Comma LblStr RemStr Xord Yord DatITM DatLST) (setq FName (getfiled "Select Data File" (getvar "DWGPREFIX") "txt" 0)) (if FName (if (setq FH (open FName "r")) (while (setq LINE (read-line FH)) (if LINE (if (setq Comma (vl-string-position (ascii ",") LINE )) (if (setq LblStr (substr LINE 1 Comma)) (if (setq RemStr (substr LINE (+ Comma 2)) Comma (vl-string-position (ascii ",") RemStr) ) (if (setq Xord (substr RemStr 1 Comma) RemStr (substr RemStr (+ Comma 2)) Comma (vl-string-position (ascii ",") RemStr) Yord (substr RemStr 1 Comma) ) (progn (setq DatITM (list LblStr (atof Xord) (atof Yord)) DatLST (append DatLST (list DatITM)) ) ) (princ (strcat "\n Bad line '" LINE "'")) ) ) ) ) (close FH) ) ) (princ "\n Unable to Open File!") ) (princ "\n No File Picked!") ) (if DatLST (setq DatLST DatLST) (eval nil) ) ) ;;;____________________________________________________________________________ ;;; ;;; Program to Insert Points and Text at each location in list ;;; ;;; (defun C:PlacePTS ( / PosLST ITM Lbls Xord Yord TxtPT) (setq PosLST (ReadUTM)) (if PosLST (progn (setvar "CMDECHO" 0) (command "UNDO" "Begin") (foreach ITM PosLST (setq Lbls (car ITM) Xord (cadr ITM) Yord (caddr ITM) ) (princ (strcat "\n Placing " Lbls)) (command) (if (> (atoi Lbls) 5) (setq TxtPT (polar (list Xord Yord 0.0) 0.0 -700.0)) (setq TxtPT (polar (list Xord Yord 0.0) 0.0 0.0)) ) (command "_Text" "_non" TxtPT "150" "0" Lbls) (command) ) (command "UNDO" "End") (setvar "CMDECHO" 1) (princ (strcat "\n Placed " (itoa (length PosLST)) " items.")) ) (princ "\n Nothing to place.") ) (princ) )
Registered forum members do not see this ad.
A quick modification of my code from here, should perform as required:
Code:(defun c:txtatpt ( / f p s x y ) (if (and (setq f (getfiled "" "" "csv" 16)) (setq f (open f "r")) ) (progn (while (setq n (read-line f)) (if (and (setq p (vl-string-search "," n)) (setq s (substr n 1 p)) (setq p (vl-string-search "," (setq n (substr n (+ p 2))))) (setq x (distof (substr n 1 p))) (setq y (distof (substr n (+ p 2)))) ) (entmake (list '(0 . "TEXT") (list 10 x y 0.0) (cons 1 s) (cons 40 (getvar 'textsize)) ) ) ) ) (close f) ) ) (princ) )
Lee Mac Programming
With Mathematics there is the possibility of perfect rigour, so why settle for less?
Just another Swamper
Bookmarks