(defun c:Lw_export (/ *error* file sset ename lst i)
(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 . "LWPOLYLINE,POLYLINE"))))
(progn
(if (setq file (open (strcat (getvar 'dwgprefix)
"Lwpolyline Vertex List.csv"
)
"w"
)
)
(progn
(write-line (strcat "X" "," "Y") file)
(repeat (setq i (sslength sset))
(setq ename (vlax-ename->vla-object
(ssname sset (setq i (1- i)))
)
)
(setq lst (vlax-safearray->list
(vlax-variant-value
(vla-get-coordinates ename)
)
)
)
(repeat (/ (length lst) 2)
(write-line
(strcat (rtos (car lst))
","
(rtos (cadr lst))
)
file
)
(setq lst (cddr lst))
)
)
(close file)
(alert "\nVertex Points exported to csv file.")
(alert (strcat "File saved in - "
(getvar 'dwgprefix)
"Lwpolyline Vertex List.csv"
)
)
)
(alert "\nCSV file Currenty running, Close it first.")
)
)
(*error* "Nothing Selected.")
)
(*error* nil)
(princ)
)
Wednesday, 27 March 2013
Posted by Unknown on 21:51 with No comments
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment