HELP pls LSP

Discussion in 'AutoCAD' started by C Witt, Jul 17, 2003.

  1. C Witt

    C Witt Guest

    I have put together these files.. but can't get them to work..

    Any/all help is greatly apreciated.

    (defun c:test ( / dcl_file msg )
    (setq dcl_file (load_dialog "test"))
    (while (< 1 what_now_back)
    (new_dialog "test" dcl_file)
    (action_tile "accept" "(setq x (get_tile \"brc1\"))")
    (start_dialog)
    (if (= x "US24x36")
    (alert (strcat "You chose the tile with KEY = " US 24x36))
    (if (= x "US11x17")
    (alert (strcat "You chose the tile with KEY = " US 11x17))
    (if (= x "US8-1/2x11")
    (alert (strcat "You chose the tile with KEY = " US 8-1/2x11))
    (if (= x "CAN24x36MET")
    (alert (strcat "You chose the tile with KEY = " CAN 24x36 MET))
    (if (= x "CAN11x17IMP")
    (alert (strcat "You chose the tile with KEY = " CAN 24x36 IMP))
    (if (= x "CAN11x17MET")
    (alert (strcat "You chose the tile with KEY = " CAN 24x36 MET))
    ())
    )
    )
    )
    )
    )
    )
    )
    (princ)
    (princ "\nType <TEST> to run dimension style program")
    test : dialog {
    label = "Dimension Settings";
    :row {
    :column {
    :boxed_radio_column {
    label= "Select Dimension Type";
    :radio_button {
    key = "US24x36";
    label = "US 24x36";
    }
    :radio_button {
    key = "US11x17";
    label = "US 11x17";
    }
    :radio_button {
    key = "US8-1/2x11";
    label = "US 8-1/2x11";
    }
    :radio_button {
    key = "Can24x36MET";
    label = "Can 24x36 MET";
    }
    :radio_button {
    key = "Can11x17IMP";
    label = "Can 11x17 IMP";
    }
    :radio_button {
    key = "Can11x17MET";
    label = "Can 11x17 MET";
    }
    }
    }
    }
    }
    ok_cancel;
    }
     
    C Witt, Jul 17, 2003
    #1
  2. C Witt

    Michel Guest

    in your lisp file, what is the "what_now_back" variable ?...That is one
    reason why your program dont work...you never enter the while loop....

    second of all, your dcl file has one extra right bracket just before the ok_cancel

    C Witt a écrit :
     
    Michel, Jul 17, 2003
    #2
  3. C Witt

    Michel Guest

    ....then in your action_tile......you dont even have the "brc1" tile !!!!
    .....when you use STRCAT...you must have strings....(strcat string1 string2....)
    .....

    C Witt a écrit :
     
    Michel, Jul 17, 2003
    #3
  4. C Witt

    Michel Guest

    Try this

    (defun c:test ( / dcl_file msg )
    (setq dcl_file (load_dialog "test"))
    (new_dialog "test" dcl_file)
    (action_tile "accept" "(press)")
    (start_dialog)
    )

    (defun press ()
    (cond
    ((= (get_tile "US24x36") "1") (alert "You chose the tile with KEY = US 24x36"))
    ((= (get_tile "US11x17") "1") (alert "You chose the tile with KEY = US 11x17"))
    ((= (get_tile "US8-1/2x11") "1") (alert "You chose the tile with KEY = US 8-1/2x11"))
    ((= (get_tile "Can11x17MET") "1") (alert "You chose the tile with KEY = CAN 11x17 MET"))
    ((= (get_tile "Can24x36MET") "1") (alert "You chose the tile with KEY = CAN 24x36 MET"))
    ((= (get_tile "Can11x17IMP") "1") (alert "You chose the tile with KEY = CAN 11x17 IMP"))
    )
    )

    (princ)
    (princ "\nType <TEST> to run dimension style program")

    -------------------------------

    test : dialog {
    label = "Dimension Settings";
    :row {
    :column {
    :boxed_radio_column {
    label= "Select Dimension Type";
    :radio_button {
    key = "US24x36";
    label = "US 24x36";
    }
    :radio_button {
    key = "US11x17";
    label = "US 11x17";
    }
    :radio_button {
    key = "US8-1/2x11";
    label = "US 8-1/2x11";
    }
    :radio_button {
    key = "Can24x36MET";
    label = "Can 24x36 MET";
    }
    :radio_button {
    key = "Can11x17IMP";
    label = "Can 11x17 IMP";
    }
    :radio_button {
    key = "Can11x17MET";
    label = "Can 11x17 MET";
    }
    }
    }
    }
    ok_cancel;
    }



    C Witt a écrit :
     
    Michel, Jul 17, 2003
    #4
  5. C Witt

    C Witt Guest

    sweet. thank you.

    now I can kill the "alerts" and enter the commands I need.
     
    C Witt, Jul 17, 2003
    #5
  6. You should use the done_dialog (and maybe the unload_dialog) command to close the window, and then you can start your "press"
    subroutine".

    Pierre
     
    Pierre de la Verre, Jul 18, 2003
    #6
  7. C Witt

    Michel Guest

    As Pierre said, just use (done_dialog) to close the dialog box...like this:

    (action_tile "accept" "(done_dialog)(press)")

    C Witt a écrit :
     
    Michel, Jul 18, 2003
    #7
  8. C Witt

    C Witt Guest

    I think this will work better..

    (defun press ()
    (if (= (get_tile "US24x36") "1")(setq drwng 1))
    (if (= (get_tile "US11x17") "1")(setq drwng 2))
    (if (= (get_tile "US8-1/2x11") "1")(setq drwng 3))
    (if (= (get_tile "Can11x17MET") "1")(setq drwng 4))
    (if (= (get_tile "Can24x36MET") "1")(setq drwng 5))
    (if (= (get_tile "Can11x17IMP") "1")(setq drwng 6))
    )

    (defun check ()
    (if (= drwng 1)(princ "\nIt's US24x36"))
    (if (= drwng 2)(princ "\nIt's US11x17"))
    (if (= drwng 3)(princ "\nIt's US8-1/2x11"))
    (if (= drwng 4)(princ "\nIt's Can11x17MET"))
    (if (= drwng 5)(princ "\nIt's Can24x36MET"))
    (if (= drwng 6)(princ "\nIt's Can11x17IMP"))
    )

    (defun finish ()
    (princ "\nIt's FINISHED")
    (princ)
    )

    (defun c:test ( / dcl_file msg )
    (setq dcl_file (load_dialog "test"))
    (new_dialog "test" dcl_file)
    (action_tile "accept" "(press)(done_dialog 1)(check)")
    (setq what_now (start_dialog))
    (cond
    ((= what_now 1)(finish))
    )
    )
     
    C Witt, Jul 18, 2003
    #8
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.