Print Page | Close Window

Lisp, Loops and Lines :-(

Printed From: CAD Forum
Category: EN
Forum Name: AutoCAD
Forum Description: Discussion about AutoCAD and AutoCAD LT, viewers, DWG and DXF formats, Design Review, AutoCAD web, Drive, add-ons
URL: https://www.cadforum.cz/forum_en/forum_posts.asp?TID=4843
Printed Date: 13.Jun.2026 at 05:09


Topic: Lisp, Loops and Lines :-(
Posted By: jpkibble
Subject: Lisp, Loops and Lines :-(
Date Posted: 26.Nov.2010 at 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?Dead



Replies:
Posted By: Vladimir Michl
Date Posted: 26.Nov.2010 at 16:30
You are almost there...
 
The loop should look like:

(command "_PLINE")
(while (setq line (read-line openfile))
 (command line)
);while
(command "")


-------------
Vladimir Michl (moderator)
ARKANCE - https://arkance.world" rel="nofollow - https://arkance.world - Autodesk Platinum Partner


Posted By: jpkibble
Date Posted: 27.Nov.2010 at 08:54
That's great,  another little problem solved making my life 100% easier!

Huge, thanks! Tongue



Print Page | Close Window