明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1282|回复: 3

CAD利用.scr文件,批量插入.dwg文件

[复制链接]
发表于 2015-11-3 16:55:17 | 显示全部楼层 |阅读模式
求教,在目前一个文件夹内有很多不同图幅的dwg文件,现在要将这些dwg拼合起来,怎么编写scr文件,请大神指导噻!

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

x
发表于 2015-11-4 09:11:36 | 显示全部楼层
open "D:\PROGRAM FILES\KONGLONGTOOLS\DZFH\1000.dwg" -purge a * no qsave close
open "D:\PROGRAM FILES\KONGLONGTOOLS\DZFH\1001岩层产状.dwg" -purge a * no qsave close
open "D:\PROGRAM FILES\KONGLONGTOOLS\DZFH\1002岩层水平产状.dwg" -purge a * no qsave close
open "D:\PROGRAM FILES\KONGLONGTOOLS\DZFH\1003岩层垂直产状.dwg" -purge a * no qsave close
open "D:\PROGRAM FILES\KONGLONGTOOLS\DZFH\1004倒转岩层产状.dwg" -purge a * no qsave close
open "D:\PROGRAM FILES\KONGLONGTOOLS\DZFH\1005片理产状.dwg" -purge a * no qsave close
这是批量打开指定路径下DWG文件,执行purge命令,并输入A参数 * 参数 NO 参数 最后快速保存并关闭的例子,你根据你的需要来改写.
发表于 2015-11-4 10:33:51 | 显示全部楼层
(defun C:SCR_J_LYseirir (/ FILE_LIST FOLD SF SFF RunNow QF_GETFOLDER GETFILELIST PATH-ADDBACKSLASH)
(vl-load-com)
;_Thanks caoyin
(defun GetFileList (dirName / files lst)
(defun path-addBackSlash (path)
(if (not (member (substr path (strlen path)) '("\\" "/")))
(strcat path "\\")
path
)
)
(setq dirName (path-addBackSlash dirName)
files (mapcar '(lambda (x) (strcat dirName x))
(vl-directory-files dirName "*.dwg" 1)
)
)
(mapcar '(lambda (x)
(setq lst (append lst (GetFileList (strcat dirName x))))
)
(vl-remove-if
'(lambda (x) (member x '("." "..")))
(vl-directory-files dirName nil -1)
)
)
(append files lst)
)

(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
)
)
(setq fold (qf_getFolder "选择文件夹"))
(if fold
(progn
(setq file_list (GetFileList fold))
(if file_list
(progn
(setq sf (strcat (getvar "TEMPPREFIX") "☆执行.SCR"))
(setq sff (open sf "w"))
(mapcar '(lambda (x)


;;;;下面这一段改成自己需要的
(princ (strcat
"open \"" x "\"\n"
; "(load \"" "You_Jupiter.lsp" "\")\n"
"(load \"" "You_Jupiter" "\")\n"
"(C:J_Lyseirir)\n"
"qsave\n"
"close\n"
)
sff
)
;;;;上面这一段改成自己需要的


)
file_list
)

(close sff)
(princ (strcat "\n◎文件夹中 " fold "\n dwgの个数:" (itoa (length file_list))))
(initget "Y N")
(setq RunNow (getkword "\n〓是否马上执行?[Yes(Y) / No(N)]:<No>"))
(if (= RunNow "Y")
(progn
(command "._script" sf)
(princ "\n**** 处理完成 *****")
)
(princ "\n***** 执行中了 *****")
)
)
(princ "\n***** 文件夹中不存在DWG文件 *****")
)
)
(princ "\n◎选择文件夹")
)
(princ)
)
发表于 2015-11-4 10:34:30 | 显示全部楼层
上面这段也是拿过来自己改的,你可以参考一下
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-11-24 03:18 , Processed in 0.167149 second(s), 25 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表