TekenaarNL Posted May 27, 2013 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
Murph_map Posted May 27, 2013 Posted May 27, 2013 AutoCAD LT doesn't support LISP, have you tried the DataExtract tools? Quote
satishrajdev Posted May 27, 2013 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
TekenaarNL Posted May 27, 2013 Author 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
TekenaarNL Posted May 27, 2013 Author Posted May 27, 2013 Thnx Satishrajdev ! It did the trick . Quote
elimgo Posted December 17, 2015 Posted December 17, 2015 Hi satishrajdev, Thank you for the code! This is what i need Hope you have a good day, man Quote
Madruga_SP Posted May 14, 2018 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
BIGAL Posted May 15, 2018 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
Madruga_SP Posted May 15, 2018 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
Mohammad Ahmed-1 Posted September 4, 2019 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
BIGAL Posted September 4, 2019 Posted September 4, 2019 Search here or google loading lisp programs. 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.