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
Nesha
Add pictures here
✖
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

... (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
--
ArchTools: Architektur-Werkzeuge für AutoCAD (TM)
ArchDIM - architekturgerechte Bemaßung und Höhenkoten
  Click to see the full signature.
Add pictures here
✖
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

Polytechforum.com is a website by engineers for engineers. It is not affiliated with any of manufacturers or vendors discussed here. All logos and trade names are the property of their respective owners.