(defun c:T_export(/ *error* file sset ename lst i p string)
(vl-load-com)
(defun *error* (s)
(if file (close file))
(cond
( ( not s ) )
( (member s '("Function cancelled" "quit / exit abort") ) )
( (princ (strcat "\n---->Error:" s) ) )
)
(princ))
(if (setq sset (ssget "_:L" '((0 . "TEXT,MTEXT"))))
(progn
(if (setq file (open (strcat (getvar 'dwgprefix) "Text Coordinates.csv") "w"))
(progn
(write-line (strcat "String Name" "," "X" "," "Y") file)
(repeat (setq i (sslength sset))
(setq ename (entget (ssname sset (setq i (1- i)))))
(if
(or
(= "MTEXT" (cdr (assoc 0 ename)))
(and
(zerop (cdr (assoc 72 ename)))
(zerop (cdr (assoc 73 ename)))
)
)
(setq p (cdr (assoc 10 ename)))
(setq p (cdr (assoc 11 ename)))
)
(setq string (cdr (assoc 1 ename)))
(write-line (strcat string "," (rtos (car p)) "," (rtos (cadr p))) file)
)
(close file)
(alert "\nVertex Points exported to csv file.")
(alert (strcat "File saved in - "(getvar 'dwgprefix) "Text Coordinates.csv"))
)
(alert "\nCSV file Currenty running, Close it first.")
)
)
(*error* "Nothing selected")
)
(*error* nil)
(princ)
)