明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1524|回复: 0

[LISP]幻灯片及DWG文件批处理脚本生成器----请大虾指教

[复制链接]
发表于 2005-6-30 17:56:00 | 显示全部楼层 |阅读模式
我用LISP写的幻灯片及DWG文件批处理脚本生成器,总觉不对请指教!!! (defun C:SSCR ()
(setq filename "C:\\jc\\sscr.dcl")
(if (not (findfile filename))
(progn
(alert (strcat "Cann't find file:\n" filename))
(exit 0)
)
)
(setq fIndex (load_dialog filename))
(setq filename "jdh.scr")
(setq cxm "ss")
(setq hdcl_flags "0")
(if (new_dialog "scr" fIndex)
(progn
(mode_tile "btn_run" 1)
(set_tile "ed_sla" filename)
;(mode_tile "ed_sla" 2)
;(mode_tile "ed_sla" 3)
(set_tile "ed_jla" cxm) (action_tile "btn_f" "(getfilename)")
(action_tile "btn_w" "(getfilw)")
(action_tile "ed_sla" "(setfilename)")
(action_tile "rdi_txcl" "(txcll)")
(action_tile "rdi_hdcl" "(hdcl)")
(action_tile "btn_run" "(get_ctl)(done_dialog 1)")
(action_tile "btn_exit" "(done_dialog)")
(setq dowhat (start_dialog))
(if (eq dowhat 1)
(progn
;(princ "1234567")
(jtxcl)
)
)
)
)
)
;;
(defun jtxcl ()
(setq qq (vl-filename-directory dfil))
(setq bbb (vl-directory-files qq))
(setq bbb (cdr (cdr bbb)))
(setq ml (open scr "w"))
(setq sm (length bbb))
(princ ";;目录共有文件 " ml)
(prin1 sm ml)
(princ "\n" ml)
(setq i 0)
(repeat sm
(setq mb (nth i bbb))
(setq dwg (strcat "*" "DWG"))
(setq dxg (strcat "*" "dwg"))
(if (or (wcmatch mb dwg) (wcmatch mb dxg))
(progn
(setq mb1 (strcat qq "\\" mb))
(princ "open " ml)
(princ mb1 ml)
(princ "\n" ml)
(if (eq txcl "1")
(progn
(princ cxm ml)
(princ "\n" ml)
(princ "qsave" ml)
)
)
(if (eq hdcl "1")
(progn
(princ "mslide" ml)
(princ "\n" ml)
(princ " " ml)
)
)
(princ "\n" ml)
(princ "close" ml)
(princ "\n" ml)
)
)
(setq i (1+ i))
)
(close ml)
(startapp "notepad.exe" scr)
)
;;;;;;;
(defun getfilename ()
(setq filename (getfiled "jdh:<选择脚本>" "c:\\" "scr" 1))
(if filename
(progn
(set_tile "ed_sla" filename)
;(setq txcl (get_tile "rdi_txcl"))
;(setq hdcl (get_tile "rdi_hdcl"))
(setq cxm (get_tile "ed_jla"))
(setq scr (get_tile "ed_sla"))
(mode_tile "btn_run" 0)
)
)
)
;;end def
(defun getfilw ()
(setq dfil (getfiled "选择所要处理文件夹任一文件" "D:/" "*" 4))
(if filename
(progn
(set_tile "ed_swz" dfil)
(setq dfil (get_tile "ed_swz"))
)
)
)
(defun setfilename()
;;(mode_tile "ed_jla" 3)
(setq filename (get_tile "ed_sla"))
)
(defun txcll ()
(setq hdcl_flags "1")
(mode_tile "rdi_txcl" 0)
(mode_tile "ed_jla" 3)
)
(defun hdcl ()
(setq hdcl_flags "0")
(mode_tile "rdi_txcl" 1)
(mode_tile "ed_jla" 1)
);;end def
(defun get_ctl ()
(setq txcl (get_tile "rdi_txcl"))
(setq hdcl (get_tile "rdi_hdcl"))
) ------------------------------------------ scr:dialog{
label="JDH:<脚本生成器>";
:row{
:boxed_column
{
label="参数设置:";
:row{
:edit_box {
label="处理DWG文件位置:";
key="ed_swz";
}
:button{
label="定位";
key="btn_w";
width=8;
fixed_width=true;
}
}
:edit_box {
label="加载程序名称:";
key="ed_jla";
}
:row{
:edit_box {
label="脚本名称及位置:";
key="ed_sla";
}
:button{
label="---";
key="btn_f";
width=8;
fixed_width=true;
}
}
:radio_row{
:radio_button{
label="生成原图形处理脚本!";
key="rdi_txcl";
value=1;
}
:radio_button{
label="单个幻灯片生成脚本!";
key="rdi_hdcl";
}
}
:text{
label=" 河南省测绘工程院";
}
}//end column//

:column{
:column{
:button{
label="处理";
key="btn_run";
width=12;
is_default=true;
fixed_width=true;
}
:button{
label="退出";
key="btn_exit";
width=12;
fixed_width=true;
}
spacer_1;
}
:text{
}
:text{
}
:text{
}
}
}//end row
}//end dialog
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-12-23 13:29 , Processed in 0.183760 second(s), 27 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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