也许是这个?(虽然写得很快,但未经测试!)
- (defun c:pts (/ *error* vlst ovar chdef ans file ofile pt ss elst)
- (defun *error* (msg)
- (if ovar (mapcar 'setvar vlst ovar))
- (princ (strcat "\n<!> Error: " (strcase msg) " <!>")) (princ))
- (setq vlst '("CMDECHO") ovar (mapcar 'getvar vlst))
- (setvar "CMDECHO" 0)
- (or chdef (setq chdef "File")) (initget "File Text")
- (setq ans (getkword (strcat "\nGet Point from File or Text? <" chdef "> : ")))
- (if ans (setq chdef ans) (setq ans chdef))
- (if (and (eq ans "File")
- (setq file (getfiled "Select a Text File" "" "txt" ))
- (progn
- (setq ofile (open file "R"))
- (while (setq pt (read-line ofile))
- (command "_POINT" pt))
- (close ofile))
- (progn
- (if (setq ss (ssget "X" (list (cons 0 "*TEXT")
- (if (getvar "CTAB")(cons 410 (getvar "CTAB"))
- (cons 67 (- 1 (getvar "TILEMODE")))))))
- (progn
- (setq elst (mapcar '(lambda (x) (cdr (assoc 10 x)))
- (mapcar 'entget (mapcar 'cadr (ssnamex ss)))))
- (foreach pt elst (command "_POINT" pt)))
- (princ "\n<!> No Text Found or no File Selected <!>"))))
- (mapcar 'setvar vlst ovar)
- (princ))
PS,可能需要一个mod来将这部分线程移动到一个新线程中,而不是hi-jacking这个线程。 |