练习三 接头最小接触面积计算 变电一次
 - tou_area:dialog{
- label="接头最小接触面积计算";
- :column{
- :edit_box{
- label="工作电流(A)";
- key="Ieg";
- }
- :row{
- :text{label="无镀层接头材质";}
- :popup_list{key="pop_mat";edit_width=8;
- list="铜-铜\n铝-铝";}
- }
- :concatenation{
- :text_part{label="电流密度【";}
- :text{width=6;key="txt_den";}
- :text_part{label="】(A/mm2)";}
- }
- :concatenation{
- :text_part{label="最小接触面积【";}
- :text{width=6;key="txt_area";}
- :text_part{label="】(mm2)";}
- }
- spacer_1;
- :text{label="注:铜-铝接头按铝-铝接头计算。";}
- }
- spacer_1;
- :row{
- alignment="centered";
- :button{label="计算";key="but_cal";
- width=6;fixed_width=true;
- }
- cancel_button;
- }
- }
 - (defun c:tou_area ()
- (setq k1 1.0 k2 0.12)
- (dcl_tou_area)
- (prin1)
- )
- (defun dcl_tou_area ()
- (setq dcl_id (load_dialog "我的lisp\\tou_area"))
- (new_dialog "tou_area" dcl_id)
- (action_tile "pop_mat" "(sub_pop $value)")
- (action_tile "but_cal" "(area_cal)")
- (action_tile "cancel" "(done_dialog 0)")
- (setq dd (start_dialog))
- )
- (defun area_cal ()
- (ini_1)
- (setq i1 (atof (get_tile "Ieg")))
- (cond ((< i1 200) (setq k2 0.31))
- ((<= i1 2000)
- (setq k2 (- 0.31 (* (- i1 200) 1.05 0.0001))))
- ((> i1 2000) (setq k2 0.12))
- )
- (setq k (* k1 k2))
- (setq area1 (/ i1 k))
- (setq str1 (rtos area1 2 0))
- (set_tile "txt_den" (rtos k 2 2))
- (set_tile "txt_area" str1)
- (princ)
- )
- (defun sub_pop (vvs)
- (ini_1)
- (cond ((= vvs "0") (setq k1 1.0))
- ((= vvs "1") (setq k1 0.78))
- )
- )
- (defun ini_1()
- (set_tile "txt_den" "")
- (set_tile "txt_area" "")
- )
- (princ)
|