Lee Mac Posted August 2, 2009 Posted August 2, 2009 Sorry, I was slightly incorrect in my original post, in saying that you do not have to define the (done_dialog) for the accept and cancel tiles, as it appears that you do. See the changes: (defun C:EXAMPLE (/[b][color=Red] dctag flag ent[/color][/b]) [b][color=Red] (vl-load-com)[/color][/b] (setq dcTag (load_dialog "Example.dcl")) ;; Begin DCL Loop (while (not (vl-position flag '([b][color=Red]0 1[/color][/b]))) ;; Load Dialog (or (new_dialog "EXAMPLE" dcTag) (alert "Error Loading Dialog.") (exit)) (action_tile "pick_blk" "(done_dialog 2)") ; Set ending value (action_tile "accept" "[color=Red][b](done_dialog 1)[/b][/color]") (action_tile "cancel" "[b][color=Red](done_dialog 0)[/color][/b]") ;; Collect Flag (setq flag (start_dialog)) (if (eq flag 2) [b][color=Red](setq ent (blk_pick))[/color][/b])) ; Run program to pick block ;; End DCL Loop (unload_dialog dcTag) ;; Unload after loop finished [b][color=Red] (if (and ent (not (zerop flag))) (entmod (subst (cons 40 50.0) (assoc 40 (entget ent)) (entget ent)))) [/color][/b] (princ)) (defun blk_pick () [b][color=Red] (car (entsel "\nSelect Circle: ")))[/color][/b] Quote
The Buzzard Posted August 2, 2009 Posted August 2, 2009 I am sure the method above would have some purpose other than the way it is used here. Can there be a better way? The method below is the typical method I would use. It is not the only method, But It gives the OK button some purpose. DCL EXAMPLE2 : dialog { label = "DCL-Example"; ok_cancel; } LSP (defun C:EXAMPLE2 () (EXAMP) ) (defun EXAMP () (setq dcTag (load_dialog "Example2.dcl")) (if (not (new_dialog "EXAMPLE2" dcTag)) (exit)) (action_tile "accept" "(done_dialog)(setq button T)") (action_tile "cancel" "(done_dialog)(setq button nil)") (start_dialog) (unload_dialog dcTag) (if button (blk_pick) ) ) (defun blk_pick () (setq e (entget (car (nentsel)))) (setq d (assoc 40 e)) (setq e1 (subst '(40 . 50.0) d e)) (entmod e1) (command "REGEN") (EXAMP) ) Quote
The Buzzard Posted August 2, 2009 Posted August 2, 2009 Sorry, I was slightly incorrect in my original post, in saying that you do not have to define the (done_dialog) for the accept and cancel tiles, as it appears that you do. See the changes: (defun C:EXAMPLE (/[b][color=red] dctag flag ent[/color][/b]) [b][color=red] (vl-load-com)[/color][/b] (setq dcTag (load_dialog "Example.dcl")) ;; Begin DCL Loop (while (not (vl-position flag '([b][color=red]0 1[/color][/b]))) ;; Load Dialog (or (new_dialog "EXAMPLE" dcTag) (alert "Error Loading Dialog.") (exit)) (action_tile "pick_blk" "(done_dialog 2)") ; Set ending value (action_tile "accept" "[color=red][b](done_dialog 1)[/b][/color]") (action_tile "cancel" "[b][color=red](done_dialog 0)[/color][/b]") ;; Collect Flag (setq flag (start_dialog)) (if (eq flag 2) [b][color=red](setq ent (blk_pick))[/color][/b])) ; Run program to pick block ;; End DCL Loop (unload_dialog dcTag) ;; Unload after loop finished [b][color=red] (if (and ent (not (zerop flag)))[/color][/b] [b][color=red] (entmod[/color][/b] [b][color=red] (subst[/color][/b] [b][color=red] (cons 40 50.0)[/color][/b] [b][color=red] (assoc 40 (entget ent))[/color][/b] [b][color=red] (entget ent))))[/color][/b] (princ)) (defun blk_pick () [b][color=red] (car (entsel "\nSelect Circle: ")))[/color][/b] Thanks Lee, That clears it up! Quote
The Buzzard Posted August 2, 2009 Posted August 2, 2009 It is a very novel and different idea, However in the process you had to select two buttons instead of one to accomplish the same task. Sort of self-defeating, But I am sure it has a better purpose. The example provided was sort of based on what ARGV was looking to do I think, Not sure, Select an object and return to the DCL , But I do not think this is a good example for its use. The example you have shown me in the past such as to use a button to change the color of the layers before the OK button is selected was great and informative idea. I guess to each is his own. Quote
Lee Mac Posted August 2, 2009 Posted August 2, 2009 I personally think there is a lot of purposes to the dialog hiding method. You could, for instance, get the user to select a block and the dialog would display certain information about that block before you continue. Or possibly for picking a location, perhaps the user would need to pick a block or other object to specify the location for an operation to occur. Just a few thoughts. Lee Quote
The Buzzard Posted August 2, 2009 Posted August 2, 2009 I personally think there is a lot of purposes to the dialog hiding method. You could, for instance, get the user to select a block and the dialog would display certain information about that block before you continue. Or possibly for picking a location, perhaps the user would need to pick a block or other object to specify the location for an operation to occur. Just a few thoughts. Lee There you go, Good point and a great example. I knew it could have a better purpose, Just could not think of any off-hand. Thanks for the explanations and I am sure this helps ARGV a great deal. Quote
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.