使用时出现Lisp错误
尊敬的大师们:,我的lisp程序出了什么问题。请在使用代码时查找错误消息。请修复错误。
;___________________________________________________________________________________________________________
;
; Function to export a the coordinates of a group of points to excel (using csv file method)
;___________________________________________________________________________________________________________
(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)
非常感谢。
致以最诚挚的问候。
删除:
(while (vl-string-search " " strCSVFullName)(setq strCSVFullName (vl-string-subst "" " " strCSVFullName)))和更改:
(startapp "C:\\Program Files (x86)\\Microsoft Office\\Office12\\EXCEL.EXE" strCSVFullName)至:
(startapp "C:\\Program Files (x86)\\Microsoft Office\\Office12\\EXCEL.EXE" (strcat "\"" strCSVFullName "\""))
尊敬的先生:,
感谢您修复错误。
最美好的祝福。 不客气!
您好,先生,
很长一段时间后,我尝试了你修改过的代码。我在excel输出中遇到了一些技术问题。事实上,我需要镜像点到excel。但在excel上显示出非自然的价值。请查找excel输出图像的样本格式。请修复错误。
最美好的祝福。
需要导出镜像点。图纸
页:
[1]