ichavarria Posted May 31, 2016 Posted May 31, 2016 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. Quote
Lee Mac Posted May 31, 2016 Posted May 31, 2016 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")) ) (progn (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) ) ) (princ) ) Quote
ichavarria Posted May 31, 2016 Author Posted May 31, 2016 Thank you very much Lee Mac It is exactly what I had been long looking for. Many thanks for your help. Quote
Recommended Posts
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.