本帖最后由 夏生生 于 2022-4-7 22:02 编辑
特慢系列,别怪我没提醒您,单独建立一个文件夹拷贝文件测试
- (defun c:tt (/ f file tmp)
- (setq f (getfiled "选择文件夹并任意选取一个文件,请先剔除无需处理文件"
- "d:\\"
- "dwg"
- 0
- )
- f (vl-filename-directory f)
- f (mapcar '(lambda (x) (strcat f "\\" x))
- (vl-directory-files f "*.dwg" 1)
- )
- )
- (setq tmp (open (setq file (strcat (getenv "TEMP") "\\tmp.scr")) "w"))
- (foreach n f
- (write-line (strcat "_.open \"" n "\"") tmp)
- (write-line
- "(setq ss (ssget \"x\" '((0 . \"CIRCLE\") (40 . 0.1))))
- (repeat (setq n (sslength ss))
- (setq en (ssname ss (setq n (1- n)))
- en (entget en)
- en (subst (cons 40 0.2) (assoc 40 en) en)
- )
- (entmod en)
- )"
- tmp
- )
- (write-line "_.qsave _.close" tmp)
- )
- (close tmp)
- (command ".script" file)
- (vl-file-delete file)
- (princ)
- )
再来个dbx的
- (defun c:tt1 (/ f dbx)
- (setq f (getfiled "选择文件夹并任意选取一个文件,请先剔除无需处理文件"
- "d:\\"
- "dwg"
- 0
- )
- f (vl-filename-directory f)
- f (mapcar '(lambda (x) (strcat f "\\" x))
- (vl-directory-files f "*.dwg" 1)
- )
- dbx (vlax-get-or-create-Object
- (strcat "ObjectDBX.AxDbDocument."
- (itoa (atoi (getvar "acadver")))
- )
- )
- )
- (foreach n f
- (vla-open dbx n)
- (vlax-for m (vla-get-modelspace dbx)
- (if (and (eq "AcDbCircle" (vla-get-objectname m))
- (= 0.1 (vla-get-Radius m))
- )
- (vla-put-Radius m 0.2)
- )
- )
- (vla-saveas dbx n)
- )
- (vlax-release-object dbx)
- (princ)
- )
|