Please help: How to read coordinates from a txt file

I need to read x,y,z coordinates from an ASCII file and then draw points
with this coordinates in AutoCAD. Can anybody help me suggesting the
AutoLISP function(s) that I should use and the pseudo code or algorithm.
Thanks in advance
Reply to
Nenad Markovic
Loading thread data ...
"Nenad Markovic" schrieb:
... (setq filehandle (open "path/filename" "r")) (while (setq line (read-line filehandle)) ;; if your string is not "x,y,z" ;; then process the string here (setq datalist (cons line datalist)) ) (close filehandle) (foreach pt (reverse datalist) (command "._POINT" pt) ) ...
I don't know how your file is formatted. If it is x,y,z in each single line, then you can pass the string directly to the POINT command, or if you need the coordinates in LISP format then you could substitute (vl-string-subst) the commas with spaces, add (strcat) a leading "(" and a trailing ")" to each line (inside the while loop) and use (setq datalist (cons (read line) datalist))
Tom Berger
Reply to
Tom Berger

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.