Print Page | Close Window

Simple Lisp Problem?

Printed From: CAD Forum
Category: EN
Forum Name: AutoCAD
Forum Description: Discussion about AutoCAD and AutoCAD LT, viewers, DWG and DWF formats, Design Review, AutoCAD 360, add-ons
URL: https://www.cadforum.cz/forum_en/forum_posts.asp?TID=4862
Printed Date: 31.May.2026 at 19:32


Topic: Simple Lisp Problem?
Posted By: jpkibble
Subject: Simple Lisp Problem?
Date Posted: 29.Nov.2010 at 16:58
Hi,

The lisp below works great for extracting a list of comma separated values from a csv file. In this case two columns with x coordinates in one and y coords in another.

However when I try and use car and cadr to extract the first column value from the second CAD returns an error.

I'm sure this one's about the data type not being a list.

Can anyone help?




(defun c:csv ()

(setq selfile (getfiled "Select File" "" "csv" 0))

(setq openfile (open selfile "r"))

(while (setq line (read-line openfile))

(defun c:csv ()

(setq selfile (getfiled "Select File" "" "csv" 0))

(setq openfile (open selfile "r"))

(while (setq line (read-line openfile))

(setq linex (car line))
(setq liney (cadr line))

(princ "\n")
(princ line)
(princ "\n")
(princ linex)
(princ "\n")
(princ liney)

)



)




Print Page | Close Window