TekenaarNL Posted May 27, 2013 Share Posted May 27, 2013 Hi, I have been searching for a lisp to export txt to excel. Every lisp i've come across doesn't quite cut it. We use AutoCAD LT 2013 and AutoCAD 07. I want from every txt object (of a certain layer) the content + the X and Y coordinates. Hope that you guys cab help me out. Greetz, TekenaarNL Quote Link to comment Share on other sites More sharing options...
Murph_map Posted May 27, 2013 Share Posted May 27, 2013 AutoCAD LT doesn't support LISP, have you tried the DataExtract tools? Quote Link to comment Share on other sites More sharing options...
satishrajdev Posted May 27, 2013 Share Posted May 27, 2013 Hi, I am using following routine in Autocad 2007 to export text with X & Y ID, I hope this what you were looking for...... (defun c:EXT (/ file dta p i) ;;; Creat CSV File (if (and (setq file (open (getfiled "specify output file" "c:/" "csv" 1) "w") ) (setq dta (ssget '((0 . "text,mtext")))) ) (progn (write-line "Sr No,X-Coord ,Y-Coord ,Text Value" file ) (princ "Initial number of point ID <") (princ no) (princ ">:") (setq nno (getint)) (if (= nno nil) (terpri) (setq no nno) ) (setq no (- no 1)) (terpri) (princ "Sr No X-Coord Y-Coord Text " ) (repeat (setq i (sslength dta)) (setq eb (entget (ssname dta (setq i (1- i))))) (setq p (cdr (assoc 10 eb))) (setq txv (cdr (assoc 1 eb))) (setq no (+ no 1)) (terpri) (princ " ") (princ no) (princ ". ") (princ (rtos (car p) 2 3)) (princ " ") (princ (rtos (cadr p) 2 3)) (princ " ") (princ txv) ;;;Output Details of CSV file (write-line (strcat (rtos no 2 1) "," (rtos (car p) 2 3) "," (rtos (cadr p) 2 3) "," txv ) file ) ) (close file) ) ) (Princ) ) (princ "\n Type >EXT< to run this Routine" ) Quote Link to comment Share on other sites More sharing options...
TekenaarNL Posted May 27, 2013 Author Share Posted May 27, 2013 I know that LT doesn't support LISP, that's wy I also use CAD 2007 (standard version). The Dataextract in 2007 doesn't work. None of the cad tools do the trick. ___________________________________________________________________________________________________________________________ AutoCAD LF 2013: G.204.0.0 SP2 AutoCAD 2007: V1.0 Quote Link to comment Share on other sites More sharing options...
TekenaarNL Posted May 27, 2013 Author Share Posted May 27, 2013 Thnx Satishrajdev ! It did the trick . Quote Link to comment Share on other sites More sharing options...
satishrajdev Posted May 27, 2013 Share Posted May 27, 2013 I m glad to heard that... Quote Link to comment Share on other sites More sharing options...
elimgo Posted December 17, 2015 Share Posted December 17, 2015 Hi satishrajdev, Thank you for the code! This is what i need Hope you have a good day, man Quote Link to comment Share on other sites More sharing options...
Madruga_SP Posted May 14, 2018 Share Posted May 14, 2018 Hi, I am using following routine in Autocad 2007 to export text with X & Y ID, I hope this what you were looking for...... (defun c:EXT (/ file dta p i) ;;; Creat CSV File (if (and (setq file (open (getfiled "specify output file" "c:/" "csv" 1) "w") ) (setq dta (ssget '((0 . "text,mtext")))) ) (progn (write-line "Sr No,X-Coord ,Y-Coord ,Text Value" file ) (princ "Initial number of point ID <") (princ no) (princ ">:") (setq nno (getint)) (if (= nno nil) (terpri) (setq no nno) ) (setq no (- no 1)) (terpri) (princ "Sr No X-Coord Y-Coord Text " ) (repeat (setq i (sslength dta)) (setq eb (entget (ssname dta (setq i (1- i))))) (setq p (cdr (assoc 10 eb))) (setq txv (cdr (assoc 1 eb))) (setq no (+ no 1)) (terpri) (princ " ") (princ no) (princ ". ") (princ (rtos (car p) 2 3)) (princ " ") (princ (rtos (cadr p) 2 3)) (princ " ") (princ txv) ;;;Output Details of CSV file (write-line (strcat (rtos no 2 1) "," (rtos (car p) 2 3) "," (rtos (cadr p) 2 3) "," txv ) file ) ) (close file) ) ) (Princ) ) (princ "\n Type >EXT< to run this Routine" ) Fantastic code! I'd like to insert just the selected texts from excel. Is it possible? Thanks Quote Link to comment Share on other sites More sharing options...
BIGAL Posted May 15, 2018 Share Posted May 15, 2018 If you want direct to excel no problems, there is just so many examples out there just google Autocad to excel. Quote Link to comment Share on other sites More sharing options...
Madruga_SP Posted May 15, 2018 Share Posted May 15, 2018 If you want direct to excel no problems, there is just so many examples out there just google Autocad to excel. Thank you for advice. I'm going to searching a code on the google. Quote Link to comment Share on other sites More sharing options...
Mohammad Ahmed-1 Posted September 4, 2019 Share Posted September 4, 2019 On 27/05/2013 at 15:04, satishrajdev said: Hi, I am using following routine in Autocad 2007 to export text with X & Y ID, I hope this what you were looking for...... (defun c:EXT (/ file dta p i) ;;; Creat CSV File (if (and (setq file (open (getfiled "specify output file" "c:/" "csv" 1) "w") ) (setq dta (ssget '((0 . "text,mtext")))) ) (progn (write-line "Sr No,X-Coord ,Y-Coord ,Text Value" file ) (princ "Initial number of point ID <") (princ no) (princ ">:") (setq nno (getint)) (if (= nno nil) (terpri) (setq no nno) ) (setq no (- no 1)) (terpri) (princ "Sr No X-Coord Y-Coord Text " ) (repeat (setq i (sslength dta)) (setq eb (entget (ssname dta (setq i (1- i))))) (setq p (cdr (assoc 10 eb))) (setq txv (cdr (assoc 1 eb))) (setq no (+ no 1)) (terpri) (princ " ") (princ no) (princ ". ") (princ (rtos (car p) 2 3)) (princ " ") (princ (rtos (cadr p) 2 3)) (princ " ") (princ txv) ;;;Output Details of CSV file (write-line (strcat (rtos no 2 1) "," (rtos (car p) 2 3) "," (rtos (cadr p) 2 3) "," txv ) file ) ) (close file) ) ) (Princ) ) (princ "\n Type >EXT< to run this Routine" ) On 27/05/2013 at 15:04, satishrajdev said: Hi, I am using following routine in Autocad 2007 to export text with X & Y ID, I hope this what you were looking for...... (defun c:EXT (/ file dta p i) ;;; Creat CSV File (if (and (setq file (open (getfiled "specify output file" "c:/" "csv" 1) "w") ) (setq dta (ssget '((0 . "text,mtext")))) ) (progn (write-line "Sr No,X-Coord ,Y-Coord ,Text Value" file ) (princ "Initial number of point ID <") (princ no) (princ ">:") (setq nno (getint)) (if (= nno nil) (terpri) (setq no nno) ) (setq no (- no 1)) (terpri) (princ "Sr No X-Coord Y-Coord Text " ) (repeat (setq i (sslength dta)) (setq eb (entget (ssname dta (setq i (1- i))))) (setq p (cdr (assoc 10 eb))) (setq txv (cdr (assoc 1 eb))) (setq no (+ no 1)) (terpri) (princ " ") (princ no) (princ ". ") (princ (rtos (car p) 2 3)) (princ " ") (princ (rtos (cadr p) 2 3)) (princ " ") (princ txv) ;;;Output Details of CSV file (write-line (strcat (rtos no 2 1) "," (rtos (car p) 2 3) "," (rtos (cadr p) 2 3) "," txv ) file ) ) (close file) ) ) (Princ) ) (princ "\n Type >EXT< to run this Routine" ) How can i use this code in autocad Quote Link to comment Share on other sites More sharing options...
BIGAL Posted September 4, 2019 Share Posted September 4, 2019 Search here or google loading lisp programs. Quote Link to comment Share on other sites More sharing options...
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.