- 积分
- 1385
- 明经币
- 个
- 注册时间
- 2015-2-6
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
(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")
)
)
|
|