j_spawn_h Posted November 10, 2011 Share Posted November 10, 2011 Ok i think i am over my head on this one. I have a dialog box that i created. There are two columns to pick from. I need to have one of each picked to do option, but i do not know how to get them to come together. here is what I thought would work but did not. (defun C:bd(/ bd) (or c:bm$ (setq c:bm$ "3.5")) (setq dcl_id (load_dialog "beam.dcl")) (if (not (new_dialog "beam" dcl_id)) (exit)) (set_tile c:bm$ "1") (action_tile "3.5" "(setq c:bm$ \"3.5\")") (action_tile "5.25" "(setq c:bm$ \"5.25\")") (action_tile "7" "(setq c:bm$ \"7\")") (action_tile "7.25" "(setq c:bm$ \"7.25\")") (action_tile "9.25" "(setq c:bm$ \"9.25\")") (action_tile "accept" "(done_dialog)(setq userclick T)") (action_tile "cancel" "(done_dialog)(setq userclick nil)") (start_dialog)(unload_dialog dcl_id) (setq cmd c:bm$) (if userclick (cond (= cmd "3.5" ) (setqq aa (= aa 2)) (= cmd "5.25" ) (= cmd "7" ) (= cmd "7.25" ) (setq bb (= bb 7)) (= cmd "9.25" ))) (if (cond (= (+ aa bb) 9) (command "-linetype" "s" "2x10" "")(command "-layer" "s" "s-frm-beam" "")(command "line" pause pause ""))) (princ)) Quote Link to comment Share on other sites More sharing options...
ketxu Posted November 11, 2011 Share Posted November 11, 2011 You must use action_tile with key tile in DCL, similar (action_tile "keyA" "(set_tile \"keyB\" \"sth\")"). And, if you post DCL here, we can fix it easier Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted November 11, 2011 Share Posted November 11, 2011 What do you mean by: There are two columns to pick from. I need to have one of each picked to do option Is this what you are trying to achieve? Quote Link to comment Share on other sites More sharing options...
j_spawn_h Posted November 11, 2011 Author Share Posted November 11, 2011 ketxu, beam : dialog { label = "Pick size of Beam"; : column { : boxed_radio_column { label = "Width"; : radio_button { label = "3.5"; key = "3.5"; } : radio_button { label = "5.25"; key = "5.25"; } : radio_button { label = "7"; key = "7"; } } } : column { : boxed_radio_column { label = "Depth"; : radio_button { label = "7.25"; key = "7.25"; } : radio_button { label = "9.25"; key = "9.25"; } : radio_button { label = "11.25"; key = "11.25"; } : radio_button { label = "11.875"; key = "11.875"; } : radio_button { label = "14"; key = "14"; } : radio_button { label = "16"; key = "16"; } : radio_button { label = "18"; key = "18"; } } } : row { : button { label = "&OK"; key = "accept"; fixed_width = true; is_default = true; } : button { label = "&Cancel"; key = "cancel"; fixed_width = true; is_cancel = true; } } } I thought about it after I posted to give an wxample but I could not get back to the computer. In one column I pick 3.5,5.25, or 7.... Then in the other column i could pick 14,16,18. So depending on which two I hit they will do something different. Like draw a line and put it on a lietype called 3.5x14, or 7x16. Does that make since. So I would have 9 options with this example that can be done. Quote Link to comment Share on other sites More sharing options...
j_spawn_h Posted November 11, 2011 Author Share Posted November 11, 2011 I think you are looking for this file (defun c:bm () (if (= -1 (setq dcl_id (load_dialog "beam.dcl"))) (progn (alert "Could not find the 'beam.dcl' file") (exit)) ) (if (not (new_dialog "unlayers" dcl_id)) (progn (alert "Could not find the 'unlayers' dialog box in the dcl file") (exit)) ) (set_tile "k_5.25" "1") (set_tile "k_7" "1") (action_tile "hb" "(do_something $value)") (action_tile "k_3.5" "(do_something $value)") (defun do_something (wert) (cond ((= wert "k_3.5") (C:3.5)) ((= wert "k_5.25") (C:5.25)))) (action_tile "accept" "(done_dialog)(unload_dialog dcl_id)(setq pressed-ok 1)") (action_tile "cancel" "(done_dialog)(unload_dialog dcl_id)(setq pressed-ok nil)") (start_dialog ) (princ) Quote Link to comment Share on other sites More sharing options...
j_spawn_h Posted November 14, 2011 Author Share Posted November 14, 2011 ketxu, I am not sure where to add what you wrote. I thought it was suppose to go in the lsp. Quote Link to comment Share on other sites More sharing options...
ketxu Posted November 15, 2011 Share Posted November 15, 2011 Sorry for late ^^ I'm working at site all time ^^ Since my poor English, i still not clear about your idea, but i think so : - You shoulden't assign a var with "c:" - Your function to do sth based on choices of width, depth should apply when you exit dialog So you can : beam : dialog { label = "Pick size of Beam"; : column { : boxed_radio_column {[color=red]key = "kWidth";[/color] label = "Width"; : radio_button { label = "3.5"; key = "3.5"; } : radio_button { label = "5.25"; key = "5.25"; } : radio_button { label = "7"; key = "7"; } } } : column { : boxed_radio_column {[color=red]key = "kDepth";[/color] label = "Depth"; : radio_button { label = "7.25"; key = "7.25"; } : radio_button { label = "9.25"; key = "9.25"; } : radio_button { label = "11.25"; key = "11.25"; } : radio_button { label = "11.875"; key = "11.875"; } : radio_button { label = "14"; key = "14"; } : radio_button { label = "16"; key = "16"; } : radio_button { label = "18"; key = "18"; } } } : row { : button { label = "&OK"; key = "accept"; fixed_width = true; is_default = true; } : button { label = "&Cancel"; key = "cancel"; fixed_width = true; is_cancel = true; } } } (defun C:bd() ;list your key here, it is not necessary but it will useful with a huge list of key, or you can do a function lisp to write your dcl (setq lstWidth '( "3.5" "5.25" "7") lstDepth '("7.25" "9.25" "11.25" "11.875" "14" "16" "18") ) ;Set default width, depth (or width (setq width (car lstWidth))) (or depth (setq depth (car lstDepth))) (setq dcl_id (load_dialog "beam.dcl")) (if (not (new_dialog "beam" dcl_id)) (exit) (progn ;Set Option with last width, depth or default : (set_tile width "1") (set_tile depth "1") ;Setq width, depth with radio choice : (action_tile "kWidth" "(setq width $value)") (action_tile "kDepth" "(setq depth $value)") (start_dialog) (unload_dialog dcl_id) ) ) ;Now, when you unloaded dialog, you have width and depth, so you could do sth out here : (alert (strcat "Now you have width = " width " & depth = " depth)) ;Do job with cond here : ;... ) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.