明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1133|回复: 5

高手帮忙

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

LSP程序:

(defun c:first()
  (setvar "cmdecho" 0)
  (setq wei1_list '("白炽灯" "荧光灯(单管)" "荧光灯(双管)" "荧光灯(多管)" "高强气体放电灯" "卤钨灯"))
  (setq wei2_list '("清洁" "一般" "污染"))
 (dcl_first)
 (prin1)
)
(defun dcl_first()
   (setq dcl_id(load_dialog "first"))
   (new_dialog "first" dcl_id)
   (show_list "wei1" wei1_list)
   (show_list "wei2" wei2_list)

   (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"))
      ((and (= wei1 "1") (= wei2 "0")) (set_tile "whxs" "0.75"))
      ((and (= wei1 "1") (= wei2 "1")) (set_tile "whxs" "0.7"))
      ((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"))
    )
)
   (action_tile "wei1" "(sub_wei1 $value)")
  (action_tile "wei2" "(sub_wei2 $value)")
  (action_tile "accept" "(ok_first)(done_dialog)")
  (start_dialog)
)
(defun ok_first()

  setq whxs(get_tile "whxs")

)
(defun show_list(key newlist)
       (start_list key)
       (mapcar 'add_list newlist)
       (end_list)
)
(defun sub_wei1(vvs)
   (set_tile "wei1"(nth(atoi vvs) wei1_list))
)
(defun sub_wei1(vvs)
   (set_tile "wei2"(nth(atoi vvs) wei2_list))

 

DCL程序:

first: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;
                         }
                    }
                 }
               ok_cancel;
}

希望帮忙看看,问题出在哪里,怎么修改才能实现 谢谢了。DCL程序应该没问题

发表于 2009-10-19 11:53:00 | 显示全部楼层
晕,语法错误也太多了吧,括号不匹配,函数名错误......................
发表于 2009-10-19 12:03:00 | 显示全部楼层

(defun c:first()
  (setvar "cmdecho" 0)
  (setq wei1_list '("白炽灯" "荧光灯(单管)" "荧光灯(双管)" "荧光灯(多管)" "高强气体放电灯" "卤钨灯"))
  (setq wei2_list '("清洁" "一般" "污染"))
 (dcl_first)
 (prin1)
)
(defun dcl_first()
   (setq dcl_id(load_dialog "first"))
   (new_dialog "first" dcl_id)
   (show_list "wei1" wei1_list)
   (show_list "wei2" wei2_list)
   (setq wei1 (get_tile "wei1")
         wei2 (get_tile "wei2"))
   (sub_wei1)


  (action_tile "wei1" "(setq wei1 $value)(sub_wei1)")
  (action_tile "wei2" "(setq wei2 $value)(sub_wei1)")
  (action_tile "accept" "(ok_first)(done_dialog)")
  (start_dialog)
)
(defun ok_first()

  (setq whxs(get_tile "whxs"))

)
(defun show_list(key newlist)
       (start_list key)
       (mapcar 'add_list newlist)
       (end_list)
)
(defun sub_wei1()
      (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"))
      ((and (= wei1 "1") (= wei2 "0")) (set_tile "whxs" "0.75"))
      ((and (= wei1 "1") (= wei2 "1")) (set_tile "whxs" "0.7"))
      ((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"))
    )
)


first:dialog{
   label="电气计算软件系列—照度计算";
   spacer_1;   
            :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;
                         }
                    }
                 }  spacer_1;
               ok_cancel;
}

 楼主| 发表于 2009-10-19 15:10:00 | 显示全部楼层

真是太感谢了,我是新手。。。所以可能错误比较多

 楼主| 发表于 2009-10-19 16:22:00 | 显示全部楼层

如果要筛选下拉选单怎么实现 比如选择 白炽灯时 只显示 “清洁”,“污染”;没有“一般”的选项这个怎么实现啊

 楼主| 发表于 2009-10-19 16:30:00 | 显示全部楼层

是改动sub_wei1吗?

为什么我用if去连接实现不了啊

(defun sub_wei1()

  (if(= wei "0")(setq wei2 '("污染" "清洁"))

        (cond

         (and(= wei2 "0")(set_tile "whxs" "0.65"))

         (and(= wei2 "1")(set_tile "whxs" "0.70"))

这样写哪里有问题。请指点一下

您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-10-1 17:32 , Processed in 0.208694 second(s), 25 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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