所以这应该行得通?
- (defun C:OPB (/ *good-files* acapp adoc file_obj full-names-list osd)
- (alert
- "\nPlease wait a minute
- \nto ending of batch file operation"
- )
- (vl-load-com)
- (setq acapp (vlax-get-acad-object)
- adoc (vla-get-activedocument acapp)
- )
- (vla-startundomark adoc)
- (setq osd (vla-getvariable adoc "SDI"))
- (vla-setvariable adoc "SDI" 0)
- (setq olsp (vla-getvariable adoc "LISPINIT"))
- (vla-setvariable adoc "LISPINIT" 0)
- (if (setq full-names-list
- (list-dwg (browse-folder "SELECT FOLDER" "C:\"))
- )
- ; change on your start path folder
- (progn
- (mapcar
- (function
- (lambda (i)
- (progn
- (setq file_obj (vla-open (vla-get-documents acapp) i))
- (setq *good-files* (cons file_obj *good-files*))
- ;;here will your batch function:
- (REPSTRING "TEXT1" "TEXT2")
- (vla-setvariable file_obj "mirrtext" 0)
- ; (vla-setvariable file_obj "insunits" 0)
- ; (vla-setvariable file_obj "annotativedwg" 0)
- (vla-close file_obj :vlax-true)
- (vlax-release-object file_obj)
- (setq file_obj nil)
- )
- )
- )
- full-names-list
- )
- (cond ((zerop (length *good-files*))
- (princ "\nThere isn't opened files\n")
- )
- ((not (eq (length full-names-list) (length *good-files*)))
- (princ "\nSome files is not opened\n")
- )
- (T nil)
- )
- )
- (princ "\nThere isn't .DWG files in selected directory\n")
- )
- (vla-setvariable adoc "SDI" osd)
- (vla-setvariable adoc "LISPINIT" olsp)
- (vla-endundomark adoc)
- (princ)
- )
|