明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1763|回复: 2

关于radio_button的问题(Gu_xl,请进)

[复制链接]
发表于 2011-9-9 14:25:42 | 显示全部楼层 |阅读模式
本帖最后由 qcw911 于 2011-9-10 08:21 编辑

大家好
我利用网上找到的资源
做了一个插入块的东东

现在有个问题向版主们请教
程序里面能够记忆上一次选过的项目
例如 radio_button的 1F、2F
默认 radio_button是在 1F上的
如果选择2F 第一次程序将块转换到2F层上
但第二次输入命令时候弹出对话框,radio_button显示在2F上
但是 却没有转换到2F层上,而是1F层
必须点击2F radio_button时候才好用

这种情况怎么处理呢?Bug 啊

lbox : list_box { width = 25; fixed_width = true; alignment = centered; }
listboxexample : dialog { label ="配管器具編輯器 "; spacer;
                        : boxed_radio_row {label ="図層選擇 ";spacer;
                                            :radio_button{label ="1F図層";key="1f_key";}
                                            :radio_button{label ="2F図層";key="2f_key";}
                                          }
                        : row {
                                : lbox { key = "lst1"; label = "Model" ; }
                                : lbox { key = "lst2"; label = "Make"; }
                               }
  ok_only;
}


(defun c:listboxexample        (/ *error* UpdateList data dclfile dclhandle)
  (setq dclFile "listboxexample.dcl")
  (defun *error* (msg)
    (if        dclHandle
      (unload_dialog dclHandle)
    ) ;_ end of if
    (or        (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*")
        (princ (strcat "\n** Error: " msg " **"))
    ) ;_ end of or
    (princ)
  ) ;_ end of defun
  (defun UpdateList (key lst)
    (start_list key)
    (mapcar 'add_list lst)
    (end_list)
  ) ;_ end of defun
  (setq        Data
         '(
           ("大便器" ("大便器単水床" "②" "③" "④"))
           ("キッチン"
            ("キッチン混合床"        "TT RS"                   "S3 Quattro"
             "S4 Quattro"        "S5 Quattro"           "RS5 Quattro"
             "RS6 Quattro"
            )
           )
           ("BMW"
            ("M3" "M5" "M6" "X5" "Z3" "Z4")
           )
           ("Porsche"
            ("911" "924" "928" "930" "944" "Boxster" "Cayenne" "Cayman")
           )
           ("Jaguar"
            ("XF" "XJ6" "XJR" "XKR" "X-Type" "S-Type")
           )
          )
  ) ;_ end of setq
  (cond
    ((<= (setq dclHandle (load_dialog dclFile)) 0)
     (princ "\n--> DCL File not Found.")
    )
    ((not (new_dialog "listboxexample" dclHandle))
     (setq dclHandle (unload_dialog dclHandle))
     (princ "\n--> Dialog Definition not Found.")
    )
    (t

     (setvar "clayer" "0")

     
     (or *Make* (setq *Make* "0"))
     (or *Model* (setq *Model* "0"))
     
     (or *1F* (setq *1F* "1"))
     (or *2F* (setq *2F* "0"))
     
     (UpdateList "lst1" (mapcar 'car Data))
     (set_tile "lst1" *Make*)
     (UpdateList "lst2" (cadr (nth (atoi *Make*) Data)))
     (set_tile "lst2" *Model*)
     
     (set_tile "1f_key" *1F*)
     (set_tile "2f_key" *2F*)
     
     (action_tile
       "lst1"
       (strcat
         "(UpdateList \"lst2\" (setq lst2 (cadr (nth (atoi (setq *Make* $value)) Data))))"
         "(setq *Model*"
         "  (set_tile \"lst2\""
         "    (if (< (atoi *Model*) (length lst2)) *Model* \"0\")"
         "  )"
         ")"
        ) ;_ end of strcat
;_ end of strcat
     ) ;_ end of action_tile

     (action_tile
       "lst2"
       "(if (= $reason 4) (done_dialog 1)) (setq *Model* $value)"
     ) ;_ end of action_tile
     (action_tile
       "1f_key"
       "(setq *1F* $value)(setq *2F* nil)"
     )
     (action_tile
       "2f_key"
       "(setq *2F* $value)(setq *1F* nil)"
     )

     
;;;     (action_tile "accept" "(setq *1F* (atof(get_tile "1f_key")))(setq *2F* (atof(get_tile "2f_key")))");加了这句处错误 郁闷

     
         (setq what_next (start_dialog))
         (setq dclHandle (unload_dialog dclHandle))

     
     
     (cond
       ((and (= *Make* "0") (= *Model* "0"));大便器__大便器単水床
        (choose)
        (command "INSERT"           "C:\\qiuw\\大便器単水床.dwg" pt1 "" ""  ang ) ;_ end of command
        (command "INSERT" "C:\\qiuw\\大便器.dwg" pt1 "" "" ang)
        (setq en (entlast))
        (cond
          ((= *1F* "1")
            (command "_chprop" en "" "la" "1F平面図" "" )
           )
          ((= *2F* "1")
            (command "_chprop" en "" "la" "2F平面図" "" )           
           )
          )        
        )

       ((and (= *Make* "1") (= *Model* "0"));キッチン__キッチン混合床
        (setq pta(getpoint"選擇插入點:"))
        (setq ptb(getpoint pta "\n方向:"))
        (setq s_ang (angle pta ptb))
        (setq pt1 (polar pta (+ s_ang (dtr 15.9)) 2019.5))
        (command "INSERT" "C:\\qiuw\\キッチン混合床.dwg" pt1        "" "" (re_dtr s_ang))
        (command "INSERT" "C:\\qiuw\\キッチン.dwg" pt1 "" "" (re_dtr s_ang))         ;_ end of command        
        (setq en (entlast))
        (cond
          ((= *1F* "1")
            (command "_chprop" en "" "la" "1F平面図" "" )
           )
          ((= *2F* "1")
            (command "_chprop" en "" "la" "2F平面図" "" )           
           )
          )        
        )
      
      
       ((and (= *Make* "1") (= *Model* "1"))
        (choose)
        (command "INSERT"             "C:\\qiuw\\キッチン混合床.dwg" pt1         "" "" ang) ;_ end of command
        (command "INSERT" "C:\\qiuw\\大便器.dwg" pt1 "" "" ang)
        (setq en (entlast))
        (cond
          ((= *1F* "1")
            (command "_chprop" en "" "la" "1F平面図" "" )
           )
          ((= *2F* "1")
            (command "_chprop" en "" "la" "2F平面図" "" )           
           )
          )        
        )





      

     ) ;_ end of cond
    )
  ) ;_ end of cond

  (princ)
) ;_ end of defun

(defun choose()
        (setq pt1 (getpoint "\n選擇插入點:"))
        (initget "A S W D");;
        (setq facetype(getkword"\n S↓、D→、W↑、A←:<D>"))
        (if (null facetype) (setq facetype "D"))
        (cond
          ((= facetype "S")(setq ang 0))
          ((= facetype "D")(setq ang 90))
          ((= facetype "W")(setq ang 180))
          ((= facetype "A")(setq ang 270))
          )
  )
(defun dtr (ang)
  (* pi (/ ang 180.0))
)
(defun re_dtr (ang)
   (/ (* ang 180.0) pi)
  )


"觉得好,就打赏"
还没有人打赏,支持一下
 楼主| 发表于 2011-9-10 08:23:07 | 显示全部楼层
自己顶,大家关注一下,急
发表于 2011-9-10 10:54:15 | 显示全部楼层
看不懂你要表达的意思.
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2025-9-24 09:09 , Processed in 0.175352 second(s), 26 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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