Display full version of the post: Lisp, Loops and Lines :-(

jpkibble
26.11.2010, 15:42
Hi I'm trying to draw a simple polyline from a csv file of x and y coordinates.I can open and read the csv file fine but can't get a loop to work within a line command drawing the line from point to point in a while loop.I've tried lots of things without success,  the code below best explains what I'm trying to acheive.(defun c:csv ()(setq selfile (getfiled "Select File" "" "CSV" 0))(setq openfile (open selfile "r"))(command "pline" (while (setq line (read-line openfile)))))Any ideas?

Vladimir Michl
26.11.2010, 16:30
You are almost there...
 
The loop should look like:
[CODE]
(command "_PLINE")
(while (setq line (read-line openfile))
 (command line)
);while
(command "")
[/CODE]

jpkibble
27.11.2010, 08:54
That's great,  another little problem solved making my life 100% easier!Huge, thanks!