+ Reply to Thread
Results 1 to 4 of 4
  1. #1
    Full Member
    Using
    AutoCAD 2008
    Join Date
    Aug 2009
    Posts
    47

    Default Toggle drop down boxes "on & off"...

    Registered forum members do not see this ad.

    Hey guys and gals...
    Been a while since I visited.
    I need some direction on how the toggle selections are done in the routine posted HERE.

    The Buzzard and CAB were a big help with the creation of this, so if you two could chime in, it would be quite helpful.
    Glad to be back!


    -SlimP

  2. #2
    Forum Deity
    Using
    AutoCAD 2009
    Join Date
    Oct 2008
    Posts
    2,112

    Default

    Quote Originally Posted by slimpickinz View Post
    Hey guys and gals...
    Been a while since I visited.
    I need some direction on how the toggle selections are done in the routine posted HERE.

    The Buzzard and CAB were a big help with the creation of this, so if you two could chime in, it would be quite helpful.
    Glad to be back!


    -SlimP
    Hey Slimp,

    Been a while.
    Below is a simple lisp with a Toggle defaulted to on.
    Just unclick or click the toggle and click OK to read
    the command prompt responce.

    Enjoy,
    The Buzzard

    Toggle.dcl
    Code:
    MAIN : dialog {
           label = "Toggle";
           : boxed_column {
             label = "Snap Angle";
             : toggle {
               label = "On/Off";
               key = "TOG1";
             }
           }
           : boxed_column {
             label = "Control Buttons";
             : button {
               label = "&Proceed";
               key = "accept";
               width = 18;
               fixed_width = true;
               alignment = right;
               is_default = true;
             }  
             : button {
               label = "&Exit Program";
               key = "cancel";
               width = 18;
               fixed_width = true;
               alignment = right;
               is_cancel = true;
             }
           }
         }
    Toggle.lsp
    Code:
    (defun C:TOGGLE (/ TOG1$)
      (or T:OG1$   (setq T:OG1$ "1"))
      (setq DCL_ID (load_dialog "TOGGLE.dcl"))
      (if (not (new_dialog "MAIN" DCL_ID))
        (cond
          ((<= (setq DCL_ID (load_dialog "TOGGLE.dcl")) 0)(princ "\nDialog File not Found"))
          ((not (new_dialog "MAIN" DCL_ID))(princ "\nDialog Definition not Found"))
          (t))) 
      (set_tile "TOG1" T:OG1$)
      (action_tile "TOG1"   "(setq T:OG1$  $value)")
      (action_tile "accept" "(done_dialog)(setq button T)")
      (action_tile "cancel" "(done_dialog)(setq button nil)")
      (start_dialog)(unload_dialog DCL_ID)
      (setq TOG1$ T:OG1$)
      (if button
        (cond
          ((= TOG1$ "1")(princ "Toggle is on."))
          ((= TOG1$ "0")(princ "Toggle is off."))
        )
      )
      (princ)
    )

    Forgot to mention, The toggle can be used in several ways to mean: On/Off, Yes/No, Do This/Do That, True/False etc etc etc. I used it on this code with a string. Can also be used with integers and reals as well.

  3. #3
    Forum Deity
    Using
    AutoCAD 2009
    Join Date
    Oct 2008
    Posts
    2,112

    Default

    This lisp will operate two functions to give you another idea how to use the toggle.

    TOGGLE2.DCL
    Code:
    MAIN : dialog {
           label = "Toggle2";
           : boxed_column {
             label = "Snap Angle";
             : toggle {
               label = "On/Off";
               key = "TOG2";
             }
           }
           : boxed_column {
             label = "Control Buttons";
             : button {
               label = "&Proceed";
               key = "accept";
               width = 18;
               fixed_width = true;
               alignment = right;
               is_default = true;
             }  
             : button {
               label = "&Exit Program";
               key = "cancel";
               width = 18;
               fixed_width = true;
               alignment = right;
               is_cancel = true;
             }
           }
         }
    TOGGLE2.LSP
    Code:
    (defun C:TOGGLE2 (/ TOG2$)
      (or T:OG2$   (setq T:OG2$ "1"))
      (setq DCL_ID (load_dialog "TOGGLE2.dcl"))
      (if (not (new_dialog "MAIN" DCL_ID))
        (cond
          ((<= (setq DCL_ID (load_dialog "TOGGLE2.dcl")) 0)(princ "\nDialog File not Found"))
          ((not (new_dialog "MAIN" DCL_ID))(princ "\nDialog Definition not Found"))
          (t))) 
      (set_tile "TOG2" T:OG2$)
      (action_tile "TOG2"   "(setq T:OG2$  $value)")
      (action_tile "accept" "(done_dialog)(setq button T)")
      (action_tile "cancel" "(done_dialog)(setq button nil)")
      (start_dialog)(unload_dialog DCL_ID)
      (setq TOG2$ T:OG2$)
      (if button
        (cond
          ((= TOG2$ "1")(TOGON2))
          ((= TOG2$ "0")(TOGOFF2))
        )
      )
      (princ))
    (defun TOGON2 ()
      (alert "Toggle is on!")
      (princ))
    (defun TOGOFF2 ()
      (alert "Toggle is off!")
      (princ))

  4. #4
    Forum Deity
    Using
    AutoCAD 2009
    Join Date
    Oct 2008
    Posts
    2,112

    Default

    Registered forum members do not see this ad.

    slimp,

    I took another look at your question, And I think you might be referring to the operation of mode_tile. If so, I think CAB would be able to explain it better since he wrote those portions of the program for you. I use it also, But a slight bit different than the way he used it in your program. If he does not get back to you, I will try the best I can to explain what he did. Let me know if this is what you are looking to do.

    At first glance from what I can see due to the amount of action_tiles that would have been required he used a global variable list and in turn this reduced the number of action_tiles needed. This is alot of information for me to try to take in at once. Its very amaziing to me how this was done, But at the same time confusing as well. It is probably one of the reasons why I shy away from global lists. At the beginning when you were working on this program, I was going in a more simpler but longer direction.

    I appreciate the idea that you gave me any credit for this, However this was all CAB's idea and a much better way to program although more complex for me to deal with. I think it would be best to contact CAB by PM to see if he can shed some light on this for you. I can only touch base with some of whats going on here and not give you a very detailed explaination. I doubt many others who were not involved in that thread at the time may want to go here although I am not certain. I will try my best at it.
    But that up to you.

    The Buzzard

Similar Threads

  1. saving as "step" and/or "inventor" file
    By jmatus86 in forum AutoCAD 3D Modelling & Rendering
    Replies: 6
    Last Post: 16th May 2011, 01:56 pm
  2. "save" in the file "pull down menu" not working
    By kfarrar in forum Civil 3D & LDD
    Replies: 9
    Last Post: 17th Feb 2010, 06:45 am
  3. Replies: 1
    Last Post: 25th Nov 2009, 06:35 pm
  4. "LINK template" icons "greyed out" -why?
    By Chrisjpritchard in forum AutoCAD Drawing Management & Output
    Replies: 0
    Last Post: 2nd Mar 2007, 10:25 pm
  5. "Union" Meshes or "Slice" 3D Mesh
    By Peter31712 in forum AutoCAD 3D Modelling & Rendering
    Replies: 1
    Last Post: 29th Apr 2004, 11:11 pm

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts