(defun c:Pl_export(/ *error* file sset ename lst)
(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 . "POLYLINE"))))
(progn
(if (setq file (open (strcat (getvar 'dwgprefix) "Polyline Vertex List.csv") "w"))
(progn
(write-line (strcat "X" "," "Y" "," "Z") 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) 3)
(write-line (strcat (rtos (car lst)) "," (rtos (cadr lst)) "," (rtos (caddr lst))) file)
(setq lst (cdddr lst))
)
)
(close file)
(alert "\nVertex Points exported to csv file.")
(alert (strcat "File saved in - "(getvar 'dwgprefix) "Polyline 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:54 with 1 comment
Subscribe to:
Post Comments (Atom)
Requires 3DPoly or 'heavy' polyline as input. So I use _CONVERTPOLY first.
ReplyDelete