- (defun qf_getFolder (msg / WinShell shFolder path catchit)
- (vl-load-com)
- (setq winshell (vlax-create-object "Shell.Application"))
- (setq shFolder (vlax-invoke-method WinShell 'BrowseForFolder 0 msg 1))
- (setq
- catchit (vl-catch-all-apply
- '(lambda ()
- (setq shFolder (vlax-get-property shFolder 'self))
- (setq path (vlax-get-property shFolder 'path))
- )
- )
- )
- (if (vl-catch-all-error-p catchit)
- nil
- path
- )
- )
- ;|函数功能: 获取目录下(包含子目录)里的某类型文件
- ;使用格式: a为路径名或多个路劲名表,b为扩展名
- ;范 例: (n5-get-files "D:" "lsp"),搜索d盘中所有lsp文件|;
- ;(setq c(n5-get-files b "dat"))
- ;(vl-file-directory-p b)返回T
- ;2016-6-11
- ;095
- (defun n5-get-files(a b / lst mulu wj x )
- (setq lst '())
- (cond
- ((= (type a)'STR)
- (if (setq wj (mapcar '(lambda(x)(strcat a "\" x))(vl-directory-files a (strcat"*." b))))
- (setq lst (cons wj lst)))
- (if (setq mulu (mapcar '(lambda(x)(strcat a "\" x))(cddr(vl-directory-files a nil -1))))
- (foreach x mulu(setq lst(cons(n5-get-files x b) lst)))
- )
- )
- ((= (type a) 'list) (foreach x a (setq lst (cons(n5-get-files x b)lst))))
- )
- (reverse(apply 'append lst)))
- ;
- (defun c:tt(/ FILES PATH)
- (setq path(QF_GETFOLDER"选择要打印的文件夹:"))
- (setq files(N5-GET-FILES path"dwg"))
- (foreach file files
- (write-line (strcat"正在打印文件的名为:"file))
- (vla-InsertBlock
- (vla-get-modelspace(vla-get-ActiveDocument(vlax-get-acad-object)))
- (vlax-3d-point '(0 0 0))
- file
- 1
- 1
- 1
- 0
- )
- (command"zoom" "e")
- (COMMAND"_plot"
- "N" ""
- "jiangcan" ""
- "N" "N" "Y")
- (entdel (entlast)))
- (prompt"打印结束")
- (PRINC)
- )
批量打印程序使用说明
[size=10.5000pt]1. [size=10.5000pt]打开[size=10.5000pt]AutoCAD[size=10.5000pt]软件,cass也是一样的。
[size=10.5000pt]2. [size=10.5000pt]确保[size=10.5000pt]CAD[size=10.5000pt]中没有任何图元
[size=10.5000pt]3. [size=10.5000pt]输入命令p[size=10.5000pt]lot[size=10.5000pt],在打印界面设置各项打印属性,
[size=10.5000pt]4. [size=10.5000pt]设置好各属性之后,点击添加[size=10.5000pt],新面设置名为[size=10.5000pt]”jiangcan”[size=10.5000pt],必须。然后点确定。
[size=10.5000pt]5. [size=10.5000pt]出现这个界面,页面设置名称为[size=10.5000pt]”jiangcan”,[size=10.5000pt]各项属性都正确,可以返回主界面了
[size=10.5000pt]6. [size=10.5000pt]Appload[size=10.5000pt]加载此插件,输入命令t[size=10.5000pt]t,[size=10.5000pt]选择要打印的D[size=10.5000pt]WG[size=10.5000pt]文件所在的文件夹,程序自动打印
[size=10.5000pt]
|