328302216 发表于 2013-2-27 17:29:07

2013求助第一帖

(defun c:mjtkxrwb();;;(if(null dcl_pt);;;    (setq dcl_pt '(-1 -1));;;    );;;(setq mjtkdcl(open "F:\\“终极软件”\\mjtk.dcl" 2));打开指定路径下的对话框文件(setq mjtkdcl1(load_dialog "F:\\“终极软件”\\mjtk.dcl"));加载DCL文件(new_dialog "mjtk" mjtkdcl1);启动对话框(set_tile "mjtkcd" "420")      ;给指定的编辑框设定默认值(set_tile "mjtkkd" "297")(set_tile "mjtkzd" "25")(set_tile "mjtkbj" "5")(set_tile "mjtkjj" "10")(set_tile "mjtkxk" "1")(set_tile "mjtkbk" "1")(set_tile "mjtkbg" "30")(action_tile "accept" "(mjtkqz) (done_dialog)");点击确定按钮后执行子程序(mjtkqz)(start_dialog)(unload_dialog mjtkdcl1)(setq mjtkyn1(load_dialog "F:\\“终极软件”\\mjtk.dcl"));加载DCL文件(new_dialog "mjtk" mjtkyn1)(setq mjtkdcl2-1(atof mjtkdcl2))(if (/= mjtkdcl2-1 (or 297420 841 1189))    (set_tile "mjtkcd" "输入的图纸长度不符合标准")    )(setq mjtkdcl3-1(atof mjtkdcl3))(if (/= mjtkdcl3-1 ( or 210 297 594 841))    (set_tile "mjtkkd" "输入的图纸宽度不符合标准")    )(setq mjtkdcl4-1(atof mjtkdcl4))(if (or (< mjtkdcl4-1 25 ) (> mjtkdcl4-1 80))    (set_tile "mjtkzd" "您输入的装订边宽度要在25~80之间")    )(setq mjtkdcl5-1(atof mjtkdcl5))(if (or (< mjtkdcl5-1 5) (> mjtkdcl5-1 50))    (set_tile "mjtkbj" "请您输入5~50之间的图纸边距")    )(setq mjtkdcl6-1(atof mjtkdcl6))(if (or (< mjtkdcl6-1 2) (> mjtkdcl6-1 80))    (set_tile "mjtkjj" "绘图区与标题栏的间距在2~80之间")    )(setq mjtkdcl7-1(atof mjtkdcl7))(if (or (< mjtkdcl7-1 0) (> mjtkdcl7-1 20))    (set_tile "mjtkxk" "绘图区线宽为0~20之间")    )(setq mjtkdcl8-1(atof mjtkdcl8))(if (or (< mjtkdcl8-1 0) (> mjtkdcl8-1 20))    (set_tile "mjtkbk" "标题栏线宽为0~20之间")    )(setq mjtkdcl9-1(atof mjtkdcl9))(if (or (< mjtkdcl9-1 10) (> mjtkdcl9-1 100))    (set_tile "mjtkbg" "标题栏高度为10~100之间")    )(start_dialog)(unload_dialog mjtkdcl1)(prin1))(defun mjtkqz()(setq mjtkdcl2(get_tile "mjtkcd"));取得编辑框里面的数据(setq mjtkdcl3(get_tile "mjtkkd"))(setq mjtkdcl4(get_tile "mjtkzd"))(setq mjtkdcl5(get_tile "mjtkbj"))(setq mjtkdcl6(get_tile "mjtkjj"))(setq mjtkdcl7(get_tile "mjtkxk"))(setq mjtkdcl8(get_tile "mjtkbk"))(setq mjtkdcl9(get_tile "mjtkbg")))mjtk:dialog{      label="图框设定";      :row{                :edit_box{label="图纸长度";key="mjtkcd";}                :edit_box{label="图纸宽度";key="mjtkkd";}      }      :row{                :edit_box{label="装订宽度";key="mjtkzd";}                :edit_box{label="图纸边距";key="mjtkbj";}      }:row{                :edit_box{label="绘标间距";key="mjtkjj";}                :edit_box{label="图区线宽";key="mjtkxk";}      }:row{                :edit_box{label="标题栏线宽";key="mjtkbk";}                :edit_box{label="标题栏高度";key="mjtkbg";}      }      spacer_1;      ok_cancel;}


http://bbs.mjtd.com/xwb/images/bgimg/icon_logo.png 该贴已经同步到 328302216的微博

328302216 发表于 2013-2-27 17:32:09

以上代码怎么实现如图片所类似的功能?求大神指点想了半天没都没解决!!!

328302216 发表于 2013-2-27 17:34:11

不好意思那代码!!!我重新发一下!!


(defun c:mjtkxrwb()
;;;(if(null dcl_pt)
;;;    (setq dcl_pt '(-1 -1))
;;;    )
;;;(setq mjtkdcl(open "F:\\“终极软件”\\mjtk.dcl" 2));打开指定路径下的对话框文件
(setq mjtkdcl1(load_dialog "F:\\“终极软件”\\mjtk.dcl"));加载DCL文件
(new_dialog "mjtk" mjtkdcl1);启动对话框
(set_tile "mjtkcd" "420")        ;给指定的编辑框设定默认值
(set_tile "mjtkkd" "297")
(set_tile "mjtkzd" "25")
(set_tile "mjtkbj" "5")
(set_tile "mjtkjj" "10")
(set_tile "mjtkxk" "1")
(set_tile "mjtkbk" "1")
(set_tile "mjtkbg" "30")
(action_tile "accept" "(mjtkqz) (done_dialog)");点击确定按钮后执行子程序(mjtkqz)
(start_dialog)
(unload_dialog mjtkdcl1)

(setq mjtkyn1(load_dialog "F:\\“终极软件”\\mjtk.dcl"));加载DCL文件
(new_dialog "mjtk" mjtkyn1)
(setq mjtkdcl2-1(atof mjtkdcl2))
(if (/= mjtkdcl2-1 (or 297420 841 1189))
    (set_tile "mjtkcd" "输入的图纸长度不符合标准")
    )
(setq mjtkdcl3-1(atof mjtkdcl3))
(if (/= mjtkdcl3-1 ( or 210 297 594 841))
    (set_tile "mjtkkd" "输入的图纸宽度不符合标准")
    )
(setq mjtkdcl4-1(atof mjtkdcl4))
(if (or (< mjtkdcl4-1 25 ) (> mjtkdcl4-1 80))
    (set_tile "mjtkzd" "您输入的装订边宽度要在25~80之间")
    )
(setq mjtkdcl5-1(atof mjtkdcl5))
(if (or (< mjtkdcl5-1 5) (> mjtkdcl5-1 50))
    (set_tile "mjtkbj" "请您输入5~50之间的图纸边距")
    )
(setq mjtkdcl6-1(atof mjtkdcl6))
(if (or (< mjtkdcl6-1 2) (> mjtkdcl6-1 80))
    (set_tile "mjtkjj" "绘图区与标题栏的间距在2~80之间")
    )
(setq mjtkdcl7-1(atof mjtkdcl7))
(if (or (< mjtkdcl7-1 0) (> mjtkdcl7-1 20))
    (set_tile "mjtkxk" "绘图区线宽为0~20之间")
    )
(setq mjtkdcl8-1(atof mjtkdcl8))
(if (or (< mjtkdcl8-1 0) (> mjtkdcl8-1 20))
    (set_tile "mjtkbk" "标题栏线宽为0~20之间")
    )
(setq mjtkdcl9-1(atof mjtkdcl9))
(if (or (< mjtkdcl9-1 10) (> mjtkdcl9-1 100))
    (set_tile "mjtkbg" "标题栏高度为10~100之间")
    )
(start_dialog)
(unload_dialog mjtkdcl1)

(prin1)
)

(defun mjtkqz()
(setq mjtkdcl2(get_tile "mjtkcd"));取得编辑框里面的数据
(setq mjtkdcl3(get_tile "mjtkkd"))
(setq mjtkdcl4(get_tile "mjtkzd"))
(setq mjtkdcl5(get_tile "mjtkbj"))
(setq mjtkdcl6(get_tile "mjtkjj"))
(setq mjtkdcl7(get_tile "mjtkxk"))
(setq mjtkdcl8(get_tile "mjtkbk"))
(setq mjtkdcl9(get_tile "mjtkbg"))
)

mjtk:dialog{
        label="图框设定";
        :row{
                :edit_box{label="图纸长度";key="mjtkcd";}
                :edit_box{label="图纸宽度";key="mjtkkd";}
        }
        :row{
                :edit_box{label="装订宽度";key="mjtkzd";}
                :edit_box{label="图纸边距";key="mjtkbj";}
        }:row{
                :edit_box{label="绘标间距";key="mjtkjj";}
                :edit_box{label="图区线宽";key="mjtkxk";}
        }:row{
                :edit_box{label="标题栏线宽";key="mjtkbk";}
                :edit_box{label="标题栏高度";key="mjtkbg";}
        }
        spacer_1;
        ok_cancel;
}

【KAIXIN】 发表于 2013-2-27 18:32:23

不应该发在这里,你这个直接用IF判断...

328302216 发表于 2013-2-28 09:32:55

【KAIXIN】 发表于 2013-2-27 18:32 static/image/common/back.gif
不应该发在这里,你这个直接用IF判断...

开心老大那要怎么整呢?用while判断?我这个直接用IF判断怎么第二次出来的对话框里面都没值呢??

【KAIXIN】 发表于 2013-2-28 09:50:20

328302216 发表于 2013-2-28 09:32 static/image/common/back.gif
开心老大那要怎么整呢?用while判断?我这个直接用IF判断怎么第二次出来的对话框里面都没值呢??

没值,再重新赋值

328302216 发表于 2013-2-28 14:39:42

【KAIXIN】 发表于 2013-2-28 09:50 static/image/common/back.gif
没值,再重新赋值

(setq mjtkdcl2-1(atof mjtkdcl2));把取得的mjtkdcl2转换成实数
(if (/= mjtkdcl2-1 (or 297420 841 1189));判断转换后得到的实数是否符合条件
   (set_tile "mjtkcd" "输入的图纸长度不符合标准");如果不符合就给mjtkcd赋值为"输入的图纸长度不符合标准"
    )
(setq mjtkdcl3-1(atof mjtkdcl3))
(if (/= mjtkdcl3-1 ( or 210 297 594 841))
    (set_tile "mjtkkd" "输入的图纸宽度不符合标准")
    )

如这两句判断后并给MJTKDCL2 赋予一个字符串不对吗?能否帮忙改一下?
页: [1]
查看完整版本: 2013求助第一帖