会尽量找时间做点什么。 最好在多个图形中。我真的很感谢你的帮助,目前我对这类事情的大部分了解不足 好的,这是让读取文件工作的第一步,接下来将编写一个脚本并对多个文件重复。只需在末尾更改文件名即可。也要感谢李。
; tunnel takes a txt file ignores lines that are not xy description
(vl-load-com)
;;-------------------=={ Parse Numbers }==--------------------;;
;; ;;
;;Parses a list of numerical values from a supplied string. ;;
;;------------------------------------------------------------;;
;;Author: Lee Mac, Copyright © 2011 - www.lee-mac.com ;;
;;------------------------------------------------------------;;
;;Arguments: ;;
;;s - String to process ;;
;;------------------------------------------------------------;;
;;Returns:List of numerical values found in string. ;;
;;------------------------------------------------------------;;
(defun LM:ParseNumbers ( s )
(
(lambda ( l )
(read
(strcat "("
(vl-list->string
(mapcar
(function
(lambda ( a b c )
(if
(or
(< 47 b 58)
(and (= 45 b) (< 47 c 58) (not (< 47 a 58)))
(and (= 46 b) (< 47 a 58) (< 47 c 58))
)
b 32
)
)
)
(cons nil l) l (append (cdr l) (list nil))
)
)
")"
)
)
)
(vl-string->list s)
)
)
(defun tunnel (fname / x xyzlist xyz)
(setq fo (open fname "R"))
(command "_pline")
(while (= (getvar "cmdactive") 1 )
(while (setq newline (read-line fo))
(if (or (= (substr newline 1 1 ) "+")(= (substr newline 1 1 ) "-"))
(progn
(setq xyzlist (LM:ParseNumbers newline))
;(setq xyz (strcat (rtos (nth 0 xyzlist)2 4) "," (rtos (nth 1 xyzlist)2 4)))
;(command xyz) ; co-ords of line
(command (list (nth 0 xyzlist) (nth 1 xyzlist) 0.0))
);progn
(princ "skip")
);if
); while read file
(command "") ; end line
) ; end pline while
);defun
; run code
(tunnel "C:\\acadtemp\\175475BK.txt")
;(command "saveas" "c:\\cadtemp\\175475BK" "close")
运行时。lsp返回错误:
有什么想法吗?
页:
1
[2]