明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1169|回复: 1

[基础] 高手帮助

[复制链接]
发表于 2009-10-21 09:01:00 | 显示全部楼层 |阅读模式

(defun c:two()
  (setvar "cmdecho" 0)
  (setq wei1_list '("白炽灯" "荧光灯(单管)" "荧光灯(双管)" "荧光灯(多管)" "高强气体放电灯" "卤钨灯"))
  (setq wei2_list '("清洁" "一般" "污染"))
  (setq li1_list '("0.5" "0.6" "0.7" "0.8" "0.9" "1.0" "1.1" "1.25" "1.5" "1.75" "2.0" "2.25" "2.5" "3.0" "3.5" "4.0" "5.0"))
  (setq li2_list '("30,10" "30,30" "50,10" "50,30" "50;50" "70,10" "70,30" "70,50" "70,70" "30,10,10" "30,30,10" "50,30,10" "50,30,30" "50,50,10" "50,50,30" "70,30,10" "70,30,30" "70,50,10" "70,50,30"))
  (dcl_1st)
  (prin1)
)
(defun dcl_1st()
   (setq dcl_id(load_dialog "two"))
   (new_dialog "two" dcl_id)
   (show_list "wei1" wei1_list)
   (show_list "wei2" wei2_list)
   (show_list "li1" li1_list)
   (show_list "li2" li2_list)
   (setq wei1 (get_tile "wei1")
         wei2 (get_tile "wei2")
         whxs (get_tile "whxs")
         li1 (get_tile "li1")
         li2 (get_tile "li2"))
   (action_tile "wei1" "(setq wei1 $value)(sub_wei)")
   (action_tile "wei2" "(setq wei2 $value)(sub_wei)")
   (action_tile "whxs" "(setq whxs $value)(sub_wei)")
   (action_tile "li1" "(setq li1 $value)(sub_wei)")
   (action_tile "li2" "(setq li2 $value)(sub_wei)")
   (action_tile "accept" "(ok_1st)(done_dialog)")
   (start_dialog)
)
(defun ok_1st()
  (setq lyxs(get_tile "lyxs"))
)
(defun show_list(key newlist)
       (start_list key)
       (mapcar 'add_list newlist)
       (end_list)
)
(defun sub_wei()
      (cond
      ((and (= wei1 "0") (= wei2 "0")) (set_tile "whxs" "0.75"))
      ((and (= wei1 "0") (= wei2 "1")) (set_tile "whxs" "0.70"))
      ((and (= wei1 "0") (= wei2 "2")) (set_tile "whxs" "0.65"))
      ((if(= wei1 "0") (setq  li1 '("0.6" "0.7" "0.8" "0.9" "1.0" "1.1" "1.25" "1.5" "1.75" "2.0" "2.25" "2.5" "3.0" "3.5" "4.0" "5.0")
                             li2 '("50,30,10" "50,30,30" "50,50,10" "50,50,30" "70,30,10" "70,30,30" "70,50,10" "70,50,30")))
                     ((and(= li1 "0") (= li2 "0")) (set_tile "lyxs" "0.13"))
                     ((and(= li1 "0") (= li2 "1")) (set_tile "lyxs" "0.14"))
                     ((and(= li1 "0") (= li2 "2")) (set_tile "lyxs" "0.16"))
                     ((and(= li1 "0") (= li2 "3")) (set_tile "lyxs" "0.17"))
                     ((and(= li1 "0") (= li2 "4")) (set_tile "lyxs" "0.14"))
                     ((and(= li1 "0") (= li2 "5")) (set_tile "lyxs" "0.15"))
                     ((and(= li1 "0") (= li2 "6")) (set_tile "lyxs" "0.18"))
                     ((and(= li1 "0") (= li2 "7")) (set_tile "lyxs" "0.19"))
                     ((and(= li1 "1") (= li2 "0")) (set_tile "lyxs" "0.16"))
                     ((and(= li1 "1") (= li2 "1")) (set_tile "lyxs" "0.17"))
                     ((and(= li1 "1") (= li2 "2")) (set_tile "lyxs" "0.20"))
                     ((and(= li1 "1") (= li2 "3")) (set_tile "lyxs" "0.20"))
                     ((and(= li1 "1") (= li2 "4")) (set_tile "lyxs" "0.18"))
                     ((and(= li1 "1") (= li2 "5")) (set_tile "lyxs" "0.19"))
                     ((and(= li1 "1") (= li2 "6")) (set_tile "lyxs" "0.22"))
                     ((and(= li1 "1") (= li2 "7")) (set_tile "lyxs" "0.23"))
                     ((and(= li1 "2") (= li2 "0")) (set_tile "lyxs" "0.18"))
                     ((and(= li1 "2") (= li2 "1")) (set_tile "lyxs" "0.19"))
                     ((and(= li1 "2") (= li2 "2")) (set_tile "lyxs" "0.22"))
                     ((and(= li1 "2") (= li2 "3")) (set_tile "lyxs" "0.22"))
                     ((and(= li1 "2") (= li2 "4")) (set_tile "lyxs" "0.21"))
                     ((and(= li1 "2") (= li2 "5")) (set_tile "lyxs" "0.22"))
                     ((and(= li1 "2") (= li2 "6")) (set_tile "lyxs" "0.24"))
                     ((and(= li1 "2") (= li2 "7")) (set_tile "lyxs" "0.25"))
                     ((and(= li1 "3") (= li2 "0")) (set_tile "lyxs" "0.20"))
                     ((and(= li1 "3") (= li2 "1")) (set_tile "lyxs" "0.21"))
                     ((and(= li1 "3") (= li2 "2")) (set_tile "lyxs" "0.24"))
                     ((and(= li1 "3") (= li2 "3")) (set_tile "lyxs" "0.24"))
                     ((and(= li1 "3") (= li2 "4")) (set_tile "lyxs" "0.22"))
                     ((and(= li1 "3") (= li2 "5")) (set_tile "lyxs" "0.23"))
                     ((and(= li1 "3") (= li2 "6")) (set_tile "lyxs" "0.26"))
                     ((and(= li1 "3") (= li2 "7")) (set_tile "lyxs" "0.28"))
               )
                        
      ((and (= wei1 "1") (= wei2 "0")) (set_tile "whxs" "0.75"))
      ((and (= wei1 "1") (= wei2 "1")) (set_tile "whxs" "0.70"))
      ((and (= wei1 "1") (= wei2 "2")) (set_tile "whxs" "0.65"))
      ((and (= wei1 "2") (= wei2 "0")) (set_tile "whxs" "0.75"))
      ((and (= wei1 "2") (= wei2 "1")) (set_tile "whxs" "0.70"))
      ((and (= wei1 "2") (= wei2 "2")) (set_tile "whxs" "0.65"))
      ((and (= wei1 "3") (= wei2 "0")) (set_tile "whxs" "0.75"))
      ((and (= wei1 "3") (= wei2 "1")) (set_tile "whxs" "0.70"))
      ((and (= wei1 "3") (= wei2 "2")) (set_tile "whxs" "0.65"))
      ((and (= wei1 "4") (= wei2 "0")) (set_tile "whxs" "0.75"))
      ((and (= wei1 "4") (= wei2 "1")) (set_tile "whxs" "0.70"))
      ((and (= wei1 "4") (= wei2 "2")) (set_tile "whxs" "0.65"))
      ((and (= wei1 "5") (= wei2 "0")) (set_tile "whxs" "0.85"))
      ((and (= wei1 "5") (= wei2 "1")) (set_tile "whxs" "0.75"))
      ((and (= wei1 "5") (= wei2 "2")) (set_tile "whxs" "0.70"))
    )
)

DCL程序

two:dialog{
            label="电气计算软件系列—照度计算";    
            :boxed_column{
                        label="维护系数:";
                        :row{
                        :popup_list{
                                 label="灯具类型:";
                 key="wei1";                
                                 width=24;
                                 height=10;
                         }
                        :popup_list{
                                 label="污染特性:";
                 key="wei2";
                                 width=24;
                                 height=10;
                         }
                        :edit_box{
                                 label="维护系数:";
                 key="whxs";
                                 width=24;
                         }
                    }
                 }      
                 :boxed_column{
                        label="利用系数:";
                        :row{
                        :popup_list{
                                 label="室内指数:";
                 key="li1";
                                 width=24;
                                 height=10;
                         }
                        :popup_list{
                                 label="反射系数:";
                 key="li2";
                                 width=24;
                                 height=10;
                         }
                        :edit_box{
                                 label="利用系数:";
                 key="lyxs";
                                 width=24;
                         }
                    }
                 }
               ok_cancel;
}

求高手帮忙看看LSP程序,主要是子函数sub_wei中的IF后面那段 怎么都实现不了 ,我想当wei1选择白炽灯时,li1显示除去0.5以外的所有li1_list,怎么去实现啊,貌似我写的那个实现不了。 求帮忙

发表于 2009-10-21 16:42:00 | 显示全部楼层
  1. (defun C:TWO ()
  2.   (setvar "cmdecho" 0)
  3.   (setq WEI1_LIST '("白熾燈"        "熒光燈(單管)"
  4.       "熒光燈(雙管)"     "熒光燈(多管)"
  5.       "高強氣體放電燈"   "鹵鎢燈"
  6.      )
  7.   )
  8.   (setq WEI2_LIST '("清潔" "一般" "污染"))
  9.   (setq LI1_LIST '("0.6"    "0.7"    "0.8"    "0.9"    "1.0"
  10.      "1.1"    "1.25"   "1.5"    "1.75"   "2.0"
  11.      "2.25"   "2.5"    "3.0"    "3.5"    "4.0"
  12.      "5.0"
  13.     )
  14. LI2_LIST '("50,30,10"    "50,30,30"    "50,50,10"
  15.      "50,50,30"    "70,30,10"    "70,30,30"
  16.      "70,50,10"    "70,50,30"
  17.     )
  18.   )
  19.   (setq LI1_LIST1 '("0.5"    "0.6"    "0.7"    "0.8" "0.9"
  20.       "1.0"    "1.1"    "1.25"   "1.5" "1.75"
  21.       "2.0"    "2.25"   "2.5"    "3.0" "3.5"
  22.       "4.0"    "5.0"
  23.      )
  24. LI2_LIST1 '("30,10"   "30,30" "50,10"
  25.       "50,30"   "50;50" "70,10"
  26.       "70,30"   "70,50" "70,70"
  27.       "30,10,10"   "30,30,10" "50,30,10"
  28.       "50,30,30"   "50,50,10" "50,50,30"
  29.       "70,30,10"   "70,30,30" "70,50,10"
  30.       "70,50,30"
  31.      )
  32.   )
  33.   (DCL_1ST)
  34.   (prin1)
  35. )
  36. (defun DCL_1ST ()
  37.   (setq DCL_ID (load_dialog "two.dcl"))
  38.   (new_dialog "two" DCL_ID)
  39.   (SHOW_LIST "wei1" WEI1_LIST)
  40.   (SHOW_LIST "wei2" WEI2_LIST)
  41.   (setq WEI1 "0"
  42. WEI2 "0"
  43. WHXS "0"
  44. LI1  "0"
  45. LI2  "0"
  46.   )
  47.   (SUB_WEI)
  48.   (action_tile "wei1" "(setq wei1 $value)(sub_wei)")
  49.   (action_tile "wei2" "(setq wei2 $value)(sub_wei)")
  50.   (action_tile "whxs" "(setq whxs $value)(sub_wei)")
  51.   (action_tile "li1" "(setq li1 $value)(sub_wei)")
  52.   (action_tile "li2" "(setq li2 $value)(sub_wei)")
  53.   (action_tile "accept" "(ok_1st)(done_dialog)")
  54.   (start_dialog)
  55. )
  56. (defun OK_1ST ()
  57.   (setq LYXS (get_tile "lyxs"))
  58. )
  59. (defun SHOW_LIST (KEY NEWLIST)
  60.   (start_list KEY)
  61.   (mapcar 'add_list NEWLIST)
  62.   (end_list)
  63. )
  64. (defun SUB_WEI ()
  65.   (if (= WEI1 "0")
  66.     (progn
  67.       (SHOW_LIST "li1" LI1_LIST)
  68.       (SHOW_LIST "li2" LI2_LIST)
  69.     )
  70.     (progn
  71.       (SHOW_LIST "li1" LI1_LIST1)
  72.       (SHOW_LIST "li2" LI2_LIST1)
  73.     )
  74.   )
  75.   (cond
  76.     ((and (= LI1 "0") (= LI2 "0")) (set_tile "lyxs" "0.13"))
  77.     ((and (= LI1 "0") (= LI2 "1")) (set_tile "lyxs" "0.14"))
  78.     ((and (= LI1 "0") (= LI2 "2")) (set_tile "lyxs" "0.16"))
  79.     ((and (= LI1 "0") (= LI2 "3")) (set_tile "lyxs" "0.17"))
  80.     ((and (= LI1 "0") (= LI2 "4")) (set_tile "lyxs" "0.14"))
  81.     ((and (= LI1 "0") (= LI2 "5")) (set_tile "lyxs" "0.15"))
  82.     ((and (= LI1 "0") (= LI2 "6")) (set_tile "lyxs" "0.18"))
  83.     ((and (= LI1 "0") (= LI2 "7")) (set_tile "lyxs" "0.19"))
  84.     ((and (= LI1 "1") (= LI2 "0")) (set_tile "lyxs" "0.16"))
  85.     ((and (= LI1 "1") (= LI2 "1")) (set_tile "lyxs" "0.17"))
  86.     ((and (= LI1 "1") (= LI2 "2")) (set_tile "lyxs" "0.20"))
  87.     ((and (= LI1 "1") (= LI2 "3")) (set_tile "lyxs" "0.20"))
  88.     ((and (= LI1 "1") (= LI2 "4")) (set_tile "lyxs" "0.18"))
  89.     ((and (= LI1 "1") (= LI2 "5")) (set_tile "lyxs" "0.19"))
  90.     ((and (= LI1 "1") (= LI2 "6")) (set_tile "lyxs" "0.22"))
  91.     ((and (= LI1 "1") (= LI2 "7")) (set_tile "lyxs" "0.23"))
  92.     ((and (= LI1 "2") (= LI2 "0")) (set_tile "lyxs" "0.18"))
  93.     ((and (= LI1 "2") (= LI2 "1")) (set_tile "lyxs" "0.19"))
  94.     ((and (= LI1 "2") (= LI2 "2")) (set_tile "lyxs" "0.22"))
  95.     ((and (= LI1 "2") (= LI2 "3")) (set_tile "lyxs" "0.22"))
  96.     ((and (= LI1 "2") (= LI2 "4")) (set_tile "lyxs" "0.21"))
  97.     ((and (= LI1 "2") (= LI2 "5")) (set_tile "lyxs" "0.22"))
  98.     ((and (= LI1 "2") (= LI2 "6")) (set_tile "lyxs" "0.24"))
  99.     ((and (= LI1 "2") (= LI2 "7")) (set_tile "lyxs" "0.25"))
  100.     ((and (= LI1 "3") (= LI2 "0")) (set_tile "lyxs" "0.20"))
  101.     ((and (= LI1 "3") (= LI2 "1")) (set_tile "lyxs" "0.21"))
  102.     ((and (= LI1 "3") (= LI2 "2")) (set_tile "lyxs" "0.24"))
  103.     ((and (= LI1 "3") (= LI2 "3")) (set_tile "lyxs" "0.24"))
  104.     ((and (= LI1 "3") (= LI2 "4")) (set_tile "lyxs" "0.22"))
  105.     ((and (= LI1 "3") (= LI2 "5")) (set_tile "lyxs" "0.23"))
  106.     ((and (= LI1 "3") (= LI2 "6")) (set_tile "lyxs" "0.26"))
  107.     ((and (= LI1 "3") (= LI2 "7")) (set_tile "lyxs" "0.28"))
  108.   )
  109.   (cond
  110.     ((and (= WEI1 "0") (= WEI2 "0")) (set_tile "whxs" "0.75"))
  111.     ((and (= WEI1 "0") (= WEI2 "1")) (set_tile "whxs" "0.70"))
  112.     ((and (= WEI1 "0") (= WEI2 "2")) (set_tile "whxs" "0.65"))
  113.     ((and (= WEI1 "1") (= WEI2 "0")) (set_tile "whxs" "0.75"))
  114.     ((and (= WEI1 "1") (= WEI2 "1")) (set_tile "whxs" "0.70"))
  115.     ((and (= WEI1 "1") (= WEI2 "2")) (set_tile "whxs" "0.65"))
  116.     ((and (= WEI1 "2") (= WEI2 "0")) (set_tile "whxs" "0.75"))
  117.     ((and (= WEI1 "2") (= WEI2 "1")) (set_tile "whxs" "0.70"))
  118.     ((and (= WEI1 "2") (= WEI2 "2")) (set_tile "whxs" "0.65"))
  119.     ((and (= WEI1 "3") (= WEI2 "0")) (set_tile "whxs" "0.75"))
  120.     ((and (= WEI1 "3") (= WEI2 "1")) (set_tile "whxs" "0.70"))
  121.     ((and (= WEI1 "3") (= WEI2 "2")) (set_tile "whxs" "0.65"))
  122.     ((and (= WEI1 "4") (= WEI2 "0")) (set_tile "whxs" "0.75"))
  123.     ((and (= WEI1 "4") (= WEI2 "1")) (set_tile "whxs" "0.70"))
  124.     ((and (= WEI1 "4") (= WEI2 "2")) (set_tile "whxs" "0.65"))
  125.     ((and (= WEI1 "5") (= WEI2 "0")) (set_tile "whxs" "0.85"))
  126.     ((and (= WEI1 "5") (= WEI2 "1")) (set_tile "whxs" "0.75"))
  127.     ((and (= WEI1 "5") (= WEI2 "2")) (set_tile "whxs" "0.70"))
  128.   )
  129. )
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-11-6 09:29 , Processed in 0.173770 second(s), 31 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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