分享一个dwg图纸合并程序
(defun c:hb();插图到一起(setvar "CMDECHO" 0)
(setq pf (getfiled "指定原文件路径中的一个图形文件:>" "*" "dwg" 8))
(setq path (vl-filename-directory pf))
(setq path (strcat path "\\"))
(setq aa (vl-directory-files path "*.dwg" 1))
(setq n (length aa))
(setq i 0)
(setq nn 0)
(setq pp (nth i aa))
(initget "1 2")
(prompt "请输入图幅大小,1为A3,2为A4...\n")
(setq opt (getkword"\n 1:A3图幅 /2:A4图幅 "))
(cond
((= opt "1") (sub1))
((= opt "2") (sub2))
)
(prompt "程序执行完毕!!!\n")
(princ)
)
(defun sub1()
(prompt "\n")
(prompt "程序正在按块插入图幅,请等待...\n")
(while (/= pp nil)
(setq i (+ i 1))
(setq pp (strcat path pp))
(setq nn (+ nn 1))
(cond
((=(rem nn 2)1) (command "insert" pp "@500,297" "1" "1" "")) ;x,y均为相对坐标;比例1:1,不旋转;除于2余数为1,是第奇数张
(t (command "insert" pp "@0,-297" "1" "1" "")) ;x,y均为相对坐标 余数不为1,是第偶数张
)
(princ (strcat "第" (itoa nn) "幅" "图号为" pp " \r"))
(setq pp (nth i aa))
(command "zoom" "e" "zoom" "0.8x")
)
)
(defun sub2()
(prompt "\n")
(prompt "程序正在按块插入图幅,请等待...\n")
(while (/= pp nil)
(setq i (+ i 1))
(setq pp (strcat path pp))
(setq nn (+ nn 1))
(cond
((=(rem nn 2)1) (command "insert" pp "@297,210" "1" "1" "")) ;x,y均为相对坐标;比例1:1,不旋转;除于4余数为1,是第1张
(t (command "insert" pp "@0,-210" "1" "1" ""))
)
(princ (strcat "第" (itoa nn) "幅" "图号为" pp " \r"))
(setq pp (nth i aa))
(command "zoom" "e" "zoom" "0.8x")
)
)
合并成块的 还是不错的,如果能加上左右距离设置项更加好了 都重叠在一起了啊,能否改善为合并后依次排开的啊 请教,图框不是标准的该怎样修改代码? 不错 这是我自己改的,感觉用的不错,偶尔有点错位 万分感谢,我自己改了一下,很好用。谢谢分享。 楼上能否把改后的上传一下 好像不错,电脑下载试试 拿来试用一下 学习下 记号
页:
[1]
2