Jump to content

Import text from csv (X,Y,Code)


Recommended Posts

Hi, i'm want to import the code (or description) from csv file (X,Y,Code) on the coordinates of each point.


I can do it in excel, but i'm looking for a easy way.






The layer could be current, height 2, and rotation 0. I can change this properties later, so no problem about it.



Please excuse my limited English, corrections are welcome.



Many thanks in advance.

Link to comment
Share on other sites

Very quickly written:

(defun c:txtin ( / csv des ins lst str )
   (if (and (setq csv (getfiled "Select CSV File" "" "*" 0))
            (setq des (open csv "r"))
           (while (setq str (read-line des))
               (while (vl-string-position 44 str)
                   (setq str (vl-string-subst "\"\"" "," str))
               (if (and (setq  lst (read (strcat "(\"" str "\")")))
                        (setq  ins (mapcar 'distof lst '(2 2)))
                        (caddr lst)
                   (entmake (list '(0 . "TEXT") '(40 . 2.0) (cons 10 ins) (cons 1 (caddr lst))))
           (close des)

Link to comment
Share on other sites

Thank you very much Lee Mac :)


It is exactly what I had been long looking for. Many thanks for your help.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...