求多个cad图纸合到一个图纸上,并按图框排列
求多个cad图纸合到一个图纸上,并按图框排列 可根据如下程序修改。(defun c:tzhb(/ folder dwglistn )
(command "._undo" "_be")
(setq folder (GetFolder "选择文件夹"))
(setq dwglist (VL-DIRECTORY-FILES folder "*.dwg" 1))
(while (= (length dwglist) 0)
(setq folder (GetFolder "你选中的文件夹里没有DWG文件,重选!"))
(setq dwglist (VL-DIRECTORY-FILES folder "*.dwg" 1))
)
(setq n 0)
(repeat (length dwglist)
(command "insert" (strcat folder "\\" (nth n dwglist)) "0,0" "1" "1" "0")
(setq n (1+ n))
)
(command "._zoom" "e")
(command "._undo" "_e")
(princ "\n搞定!")
(princ "\n共插入")(princ (length dwglist))(princ "个DWG文件。")
(princ)
)
;; 子函数:(GetFolder "选择文件夹:") 返回值:字符串,文件夹路径,如果点了cancel, 返回nil
(defun GetFolder (msg / WinShell shFolder path catchit)
(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
)
)
;;;
(defun C:PT(/ fname path fns)
(gc)(setq fname(getfiled "建立总图文件" "C:" "dwg" 1))
(setq path (strcat (vl-filename-directory fname)))
(setq fns (vl-directory-files path "*.dwg" 1))
(setvar"CMDECHO"0)
(setvar"OSMODE"(+(getvar"OSMODE")16384))
(foreach fn fns
(command "INSERT" (strcat "*" path "\\" fn) (list 0 0 0) "1" "0")(gc))
(command "ZOOM" "E")
(command "-wblock" fname "*")
(setvar"OSMODE"(-(getvar"OSMODE")16384))
) 香田里浪人 发表于 2014-3-14 16:27 static/image/common/back.gif
可根据如下程序修改。
(defun c:tzhb(/ folder dwglistn )
(command "._undo" "_be")
如果能指定基点就好了,如果合并多个图,不指定点,多个不同的CAD图上会有重叠部分。如果能按图框排列就更好了 http://bbs.mjtd.com/thread-109463-1-1.html
合并很多图纸到一个CAD文件,我常用的方法是插入DWG参照的方式
此命令用来排列对齐DWG参照图的,DWG参照的命名就是图号名开头就能对齐
隐藏命令,输入DW之后再输入A,效果自己试
菜卷鱼 发表于 2014-3-15 16:52 static/image/common/back.gif
http://bbs.mjtd.com/thread-109463-1-1.html
合并很多图纸到一个CAD文件,我常用的方法是插入DWG参照的 ...
谢谢了。thx 学到了学到了 {:1_1:}学习
页:
[1]