You will need to cut and paste this code...
For some reason it will not let me attach the file.
Peter
Code:
(defun C:MirrorPoints (/ lstOfPoints lstSelections ssSelections strCSVFullName)
(if (and (setq ssSelections (ssget "x" (list (cons 0 "POINT"))))
(setq lstSelections (selectionsettolist ssSelections))
(setq lstOfPoints (mapcar '(lambda (X)(vlax-get X "coordinates")) lstSelections))
; (setq lstOfPoints (mapcar (quote (lambda (X)(mapcar '* (list 1 -1 1) X))) lstOfPoints));<- Mirrored about X-X
; (setq lstOfPoints (mapcar (quote (lambda (X)(mapcar '+ (list 0 3000 0) X))) lstOfPoints));<- add 3000 to Y coordinate
(setq lstOfPoints (cons (list "X" "Y" "Z") lstOfPoints))
(setq strCSVFullName (strcat (getvar "dwgprefix") (vl-filename-base (getvar "dwgname")) ".csv"))
)
(progn
(while (vl-string-search " " strCSVFullName)(setq strCSVFullName (vl-string-subst "" " " strCSVFullName)))
;Startapp doesn't like spaces
(ListToCSVFile strCSVFullName lstOfPoints ",")
(startapp "C:\\Program Files (x86)\\Microsoft Office\\Office12\\EXCEL.EXE" strCSVFullName)
)
)
)
;___________________________________________________________________________________________________________
;
; Function to convert a entity based selection set to a list.
;___________________________________________________________________________________________________________
(defun SelectionSetToList (ssSelections / entSelection intCount lstObjects objSelection )
(repeat (setq intCount (sslength ssSelections))
(setq intCount (1- intCount))
(setq entSelection (ssname ssSelections intCount))
(setq objSelection (vlax-ename->vla-object entSelection))
(setq lstObjects (cons objSelection lstObjects))
)
(reverse lstObjects)
)
;___________________________________________________________________________________________________________
;
; Export a list of sublists of to a text file
;___________________________________________________________________________________________________________
(defun ListToCSVFile (strFilename lstOfSublists strChar / strText strText2 filData lstSublist)
(setq filData (open strFileName "w"))
(close filData)
(setq filData (open strFileName "w"))
(foreach lstSubList lstOfSublists
(setq strText (vl-princ-to-string (nth 0 lstSubList)))
(if (and (= (type (cdr lstSublist)) 'LIST)
(> (length lstSublist) 1)
)
(foreach strText2 (cdr lstSubList)
(setq strText (strcat strText strChar (vl-princ-to-string strText2)))
)
(if (cdr lstSublist)
(setq strText (strcat strText strChar (vl-princ-to-string (cdr lstSubList))))
)
)
(write-line strText filData)
)
(close filData)
(prin1)
)
(vl-load-com)