简单下拉菜单。。。帮助
我试图创建一个对话框,如果你在下拉列表中选择一个选项,其他列表中的其他选项将被禁用。我到处寻找这个的简化版本,但都没有用。
有什么建议吗?
为了更清晰,我会直接发布我的基本文件。
-瘦身 嗨,斯利姆,
我建议在问题列表的action_tile stations中包含更改其他列表的功能
如有必要,我将提供一个例子
李 嘿,李。
是的,请说。
这是我到目前为止得到的。。。(见附件。)
;///////////// 05-01-2010 \\\\\\\\\\\\\\\\\
;//////////// Drawing Generator\\\\\\\\\\\\\\\\\
;;AUTOLISP CODING STARTS HERE *** ASSOCIATED DCL FILE <DG.DCL****
(defun c:dg (/ Dcl_Id% NAMES$ NAMESQ$
)
(setq DGVersion "DG v1.0") ; this is the DCL title string
(vl-cmdf "-layer" "ON" "*" "") ; turn on all layers to begin
;;This is the Master List for DCL variables
;; VarName TileName DefValue TileType listAssoc
(setq MasterList
'( (Q1 "Q1" 0 0 NAMESQ)
(Q2 "Q2" 0 0 NAMESQ)
(Q3 "Q3" 0 0 NAMESQ)
))
;;TileType 0 = PopUp_List
;; 1 = Toggle
;;
;; ********************* Start of get_data function ***********************
;;
;; Compressor Count, Subcooling & Liquid Injection Options
;;
(defun get_data ()
(foreach itm MasterList
(set (car itm) (get_tile (eval (cadr itm))))
)
) ; defun get_data
(defun Q(cnt)
(setq cnt (atoi cnt))
(mode_tile "Q1" (if (> cnt 0) 0 1))
(mode_tile "Q2" (if (> cnt 0) 0 1))
(mode_tile "Q3" (if (> cnt 0) 0 1))
)
;; ///////////////////// Endof get_data function \\\\\\\\\\\\\\\\\\\\\\\\\
;; ********************* Start of Pull Down List DefineSection ***********************
(setq NAMESQ
'("None" "One" "Two"
"Three" "Four" "Five"))
;;
;; ///////////////////// Endof Pull Down List DefineSection \\\\\\\\\\\\\\\\\\\\\\\\\
;;
;;Locate DCL file & prepare to start it
(setq dcl_id (load_dialog "DG.dcl")) ;load dialog
(if (not (new_dialog "DG" dcl_id)) ;test for dialog
(exit) ;exit if no dialog
) ;End if
;;
;; ********************* Start of List Box Build Section ***********************
;;
(defun AddList (tile lst)
(start_list tile)
(mapcar 'add_list lst)
(end_list)
)
(foreach itm MasterList
(if (zerop (cadddr itm))
(AddList (eval (cadr itm)) (eval (last itm))) ; debug CAB
)
)
;;===============================================================
(cond
(*DGGlobal*;recover last used settings
(foreach itm MasterList
(if (setq value (cdr (assoc (car itm) *DGGlobal*)))
(set (car itm) value)
)
)
)
(t;set to default values
(foreach itm MasterList
(set (car itm) (itoa(caddr itm)))
)
)
)
(Q Q1)
;;;(CompQtyS compqty2)
;; ///////////////////// Endof List Box BuildSection \\\\\\\\\\\\\\\\\\\\\\\\\
;;Set all tiles
(foreach itm MasterList
(set_tile (cadr itm) (eval (car itm)))
)
(set_tile "title" DGVersion) ; add title to DCL
;; ///////////////////// Begin Button Actions Definitions \\\\\\\\\\\\\\\\\\\\\\\\\
(action_tile "Q1" "(Q $value)")
;;;(action_tile "Q2" "(CompQtyS $value)")
(action_tile "help" "(help \"acet-help\")")
(action_tile "accept" "(get_data) (done_dialog) (setq userclick T)") ;action tile
(action_tile "cancel" "(done_dialog) (setq userclick nil)") ;close dialog
(start_dialog)
(unload_dialog dcl_id)
;; ///////////////////// End of Button Actions Definitions \\\\\\\\\\\\\\\\\\\\\\\\\
;; **************************************************************************************
;; This Starts the Program to start processing the Data Selected from the Dialog Screen
(if userclick
(progn
(setq Qcnt1 (atoi Q1))
;;; compcnt2 (atoi Q2))
;;set Global var& set local vars to strings from list
(setq *DGGlobal* nil)
(foreach itm MasterList
(setq *DGGlobal* (cons (cons (car itm) (eval(car itm)))*DGGlobal*))
(set (car itm) (nth (atoi (eval(car itm))) (eval (last itm))))
)
;; ///////////////////// End Read & Set of List VariblesSection \\\\\\\\\\\\\\\\\\\\\\\\\
;; ///////////////////// Start command print of VaribleSection \\\\\\\\\\\\\\\\\\\\\\\\\
;;see other file named "princ.lsp"
;; ///////////////////// End of command print of VaribleSection \\\\\\\\\\\\\\\\\\\\\\\\\
;; This Ends theProgram to start processing the Data Selected from the Dialog Screen
;; ///////////////////////////////////////////\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
;;
(setvar "CMDECHO" 0) ; Set Autocad setvar " CMDECHO" to 0 to stop process of info scrolling in Autocad, Makes it run faster
(command "_.undo" "_begin")
;;Set layers & catch any errors
(defun SetLayer (status layname / err )
(setq err (vl-catch-all-apply 'vl-cmdf (list "-layer"status layname "")))
(if (vl-catch-all-error-p err) ; yes, error
(princ (strcat "\n" (vl-catch-all-error-message err) "\n" layname))
)
)
;; ///////////////// Begin Layer Controls /////////////////
(cond
((= Q1 "None")
(SetLayer "off" "test*") ; All off
;;; (SetLayer "OFF" "test-") ;[...] Matches any one of the characters enclosed
)
((= Q1 "One")
(SetLayer "ON" "test")
)
((= Q1 "Two")
(SetLayer "on" "test2")
)
((= Q1 "Three")
(SetLayer "on" "test3")
)
((= Q1 "Four")
(SetLayer "on" "test4")
)
((= Q1 "Five")
(SetLayer "ON" "test5")
)
)
(command "_.undo" "_end")
)
) ; endif userclick
;;
;;This is where you need to Re-Set the " setvar " or Autocad will continue to run under those settings.
;;
;; Here the ' setvar "CMDECHO" ' is set back to a Value of" 1 " so the AutoCad command prompt will display commands.
;; This must be done before the program ends and clears itself.
;;
(setq Layers nil
MasterList nil)
(setvar "CMDECHO" 1)
(princ "\nType \"DG\" to start ")
)
(princ)
;;
;;AUTOLISP CODING ENDS HERE
;; >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> AUTOLISP CODING ENDS HERE <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 好啊今天早上它成功了。
我发誓我做了你建议的。。。
谢谢您的关注。 我知道这种感觉,我一直在经历。
有时候你需要休息一下。
无论如何,很高兴听到。
祝你好运 无法理解从列表框添加选项。。。
还不太懂。
你能帮我一下吗?
我想你可以看到我在努力做什么。
-瘦身
示例-system2。lsp
实例dcl
我有一辆1988年的保时捷928 S4:-)。。。。
我从来没有想过这样做,我有几个想法,这将是有益的 呵呵——当时我想不出比这更好的例子了。。。
请记住,我链接到了更新的代码
仍然在寻求帮助伙计们。。。 我愿意补偿某人帮助完成这件事。。。。
页:
[1]
2