Jump to content

Recommended Posts

Posted

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]

  • Replies 25
  • Created
  • Last Reply

Top Posters In This Topic

  • flowerrobot

    8

  • ARGV

    7

  • The Buzzard

    6

  • Lee Mac

    5

Top Posters In This Topic

Posted

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)
)

Posted
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!

Posted

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.

Posted

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

Posted
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.

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...