Author Topic: starting function by radio button equal 1  (Read 4267 times)

0 Members and 1 Guest are viewing this topic.

Denzuki

  • Guest
starting function by radio button equal 1
« on: October 29, 2015, 07:55:47 PM »
A week ago, my program was humming along with no issues. Now, for some reason, I cannot get my functions to start.

I apply a dialog box, and once it is filled out and "OK" is pressed then either one or the other function starts, depending on the radio button selected.

Is there a better way to have the functions be recognized? The initial function to start the dialog box works up until the other functions are supposed to start. The other functions work well on their own.

I have included parts of the routines below.

//DCL CODING STARTS HERE

dial1 : dialog {
   label = "gobbleygook";
   : radio_row {
      key = "dbox1";
   : radio_button {      
             key = "rb1" ;         
             label = "for abc" ;      
            value = "1" ;         
            }         
   : radio_button {      
      key = "rb2" ;         
           label = "for efg" ;      
           }         
           } 
//******************************************
//******************************************
   : row {
   : column {
   : boxed_column {
   label = ................etc.....

;;;LSP started here
(defun C:dial1 ()

(setq oldsnap (getvar "osmode"))
  (setq oldfile (getvar "filedia"))
(setvar "osmode" 0)
  (setvar "filedia" 0)

  (vl-load-com)
   (setq acadDocument (vla-get-activeDocument (vlax-get-Acad-Object)))
    (setq mspace (vla-get-ModelSpace (vla-get-ActiveDocument (vlax-get-Acad-Object))))

......... variable definitions............

  (if (= rb1 "1") (abc)) ; start abc function
  (if (= rb2 "1") (efg)) ; start efg function 

;*************************************************************
  (defun c:abc ()
   (vl-load-com)
(setq mspace (vla-get-ModelSpace (vla-get-ActiveDocument (vlax-get-Acad-Object))))

...............etc.........

;*************************************************************
  (defun c:efg ()
   (vl-load-com)
(setq mspace (vla-get-ModelSpace (vla-get-ActiveDocument (vlax-get-Acad-Object))))

...............etc.........





Tharwat

  • Swamp Rat
  • Posts: 710
  • Hypersensitive
Re: starting function by radio button equal 1
« Reply #1 on: October 30, 2015, 03:32:08 AM »
You need to use the action_tile function to get the value of the radio_button  first then you can play with the return value as you wish.

http://docs.autodesk.com/ACD/2011/ENU/filesALR/WS1a9193826455f5ff1a32d8d10ebc6b7ccc-6ac0.htm

Denzuki

  • Guest
Re: starting function by radio button equal 1
« Reply #2 on: October 30, 2015, 01:11:06 PM »
  I have placed the code below as a function with other variables to save. It occurs before load_dialog for the dial1.dcl.

   (defun saveVars ()

.........other code........

(setq rb1 (get_tile "rb1"))  ;0 = not chosen 1 = chosen
(setq rb2 (get_tile "rb2"))  ;0 = not chosen 1 = chosen
)

.........other code.........

(action_tile "accept" "(saveVars) (done_dialog 2)") ;;this line occurs before
;;; the start_dialog


My apologies for the partial code, no NDA in place. :-)

Tharwat

  • Swamp Rat
  • Posts: 710
  • Hypersensitive
Re: starting function by radio button equal 1
« Reply #3 on: October 30, 2015, 01:26:56 PM »
Post the complete lisp codes to check them out.

Denzuki

  • Guest
Re: starting function by radio button equal 1
« Reply #4 on: November 20, 2015, 06:19:26 PM »
So I added the action_tile functions and I get the rb1 and rb2 values now. I don't know how to get the abc or efg functions to be recognized. I get the following error "; error: no function definition: ABC". The ABC and EFG function work great on their own and if I copy them to the Visual LSP Console.

Code - Auto/Visual Lisp: [Select]
  1.  
  (action_tile "rb1" "(setq rb1 $value)")
  (action_tile "rb2" "(setq rb2 $value)")
  (action_tile "accept" "(saveVars) (done_dialog 2)")
  (action_tile "cancel" "(done_dialog 1)")

ymg

  • Guest
Re: starting function by radio button equal 1
« Reply #5 on: November 20, 2015, 10:58:11 PM »
Denzuki,

Once the dialog completes you have one of the rb that is equal to "1".

If you issue (get_tile "name_of_rb_cluster"), you now know which button
is selected.

Then you need a cond statement to  direct you to the proper function.

Here an example:

Code - Auto/Visual Lisp: [Select]
  1. (defun switchboard ()
  2.    (setq dcl_id (load_dialog (strcat prgpath "DEVELOP.dcl")))
  3.    (if (not mychoice) (setq mychoice "but8"))
  4.    (if (not (new_dialog "DVLP"     dcl_id "3" (if dlgpos dlgpos '(-1 -1)))) (exit))
  5.  
  6.    (set_tile mychoice "1")
  7.    (action_tile "cancel"  "(setq ddiag 1 dlgpos (done_dialog))")
  8.    (action_tile "accept"  "(setq myChoice (get_tile \"mychoice\"))
  9.                           (setq ddiag 2 dlgpos (done_dialog))"
  10.    )
  11.  
  12.    (unload_dialog dcl_id)
  13.  
  14.    (while (= ddiag 2)
  15.       (cond
  16.          ((= myChoice "but1") (cylsb))
  17.          ((= myChoice "but2") (helix))
  18.          ((= myChoice "but3") (conccone))
  19.          ((= myChoice "but4") (ecccone))
  20.          ((= myChoice "but5") (conesb))
  21.          ((= myChoice "but6") (concflcone))
  22.          ((= myChoice "but7") ())
  23.          ((= myChoice "but8") (dishedhead))
  24.          ((= myChoice "but9") ())
  25.          ((= myChoice "but10") ())
  26.          ((= myChoice "but11") (intcylcyl))
  27.          ((= myChoice "but12") ())
  28.          ((= myChoice "but13") ())
  29.          ((= myChoice "but14") (intlegcone))
  30.          ((= myChoice "but15") (intlegfd))
  31.          ((= myChoice "but16") (intlegellipt))
  32.          ((= myChoice "but17") (redrdrctg))
  33.       )
  34.       (switchboard)
  35.    )
  36.    (princ)
  37. )
  38.  

Here a small clipping from the dcl:
Code: [Select]
: boxed_column {
        : radio_column {
          key = "mychoice";
          : radio_button {
            key = "but1";
            label = "Cylinder with Sloped Bases";
          }
          : radio_button {
            key = "but2";
            label = "Screw Conveyor Helice";
          }
          : radio_button {
            key = "but3";
            label = "Concentric Cone";
          }
          ..........
          ..........


But as Tharwat told you post the complete code, if you want further help.

ymg
« Last Edit: November 20, 2015, 11:32:04 PM by ymg »

Denzuki

  • Guest
Re: starting function by radio button equal 1
« Reply #6 on: November 23, 2015, 05:57:39 PM »
I created a mini version of the issue I'm dealing with. I cannot get the abc or efg functions to be "grabbed" or recognized if you will. By themselves, the dialog box and the LSP code works fine. Thanks for your patience. YMG I attempt to incorporate your recommendations.

Code: [Select]
//DCL CODING STARTS HERE

msam : dialog {
label = "test";
: radio_row {
key = "dbox1";
: radio_button {
        key = "rb1" ;
        label = "abc" ;
      value = "1" ;
      }
: radio_button {
key = "rb2" ;
      label = "efg" ;
        }
       

//******************************************
//******************************************

: row {
: column {
: boxed_column {
label = "Top Test";
fixed_width = true;
alignment = centered;
: row {
: text {label = "test1";}
: edit_box {key = "cbspc1"; width = 8;
fixed_width = true; value = "0";}
//
}
: row {
: text {label = "test2";}
: edit_box {key = "cbspc2"; width = 8;
fixed_width = true; value = "0";}
//
}
}

//********************************************

: row {
: boxed_column {
label = "Second test";
fixed_width = true;
alignment = centered;
: row {
: text {label = "B test";}
: edit_box {key = "abab2"; width = 8;
fixed_width = true; value = "0.0";}
//
}
: row {
: text {label = "B test 2";}
: edit_box {key = "abac3"; width = 8;
fixed_width = true; value = "0.00";}
//
}
}
}
}

//********************************************
//********************************************

: boxed_column {
label = "C test";
fixed_width = true;
alignment = centered;
:row {
: text {label = "Ctest1";} //give it a label
        : popup_list { //define popup list
key = "popup0"; //give it a name
width = 10; //fix the width
fixed_width = true;
      value = 0;} //initial value
      }
:row {
: text {label = "Ctest2";} //give it a label
: popup_list { //define popup list
key = "popup1"; //give it a name
width = 10; //fix the width
fixed_width = true;
      value = 0;} //initial value
        } //end list
:row {
: text {label = "Ctest3";} //give it a label
: popup_list { //define popup list
key = "popup2"; //give it a name
width = 10; //fix the width
fixed_width = true;
      value = 0;} //initial value
        } //end list
        :row {
: text {label = "Ctest4";} //give it a label
: popup_list { //define popup list
key = "popup3"; //give it a name
width = 10; //fix the width
fixed_width = true;
      value = 0;} //initial value
        } //end list
        } //end boxed column

//*********************************************
//*********************************************
       
        : boxed_column {
label = "D test";
fixed_width = true; // fix the width
  alignment = centered; // align left       
: row {
: text {label = "Dtest1";}
: edit_box {key = "baba"; width = 5;
fixed_width = true; value = "4.0"; initial_focus = true;}
//
}
: row {
: text {label = "Dtest2";}
: edit_box {key = "babc"; width = 5;
fixed_width = true; value = "2.0";}
//
}
: row {
: text { label = "Dtest3";}
: edit_box {key = "babe"; width = 5;
fixed_width = true; value = "5";}
//
}
: row {
: text { label = "Dtest4";}
: edit_box {key = "babg"; width = 5;
fixed_width = true; value = "4";}
//
}
}
}

: boxed_column {
label = "Etest: ";
: text  {key = "etest1"; width = 66;
fixed_width = true; alignment = centered; value = "?";}
//
}

: row {

      ok_cancel;
        }
      }

Code: [Select]
;;;LSP code starts here
(defun C:msam ()

(setq oldsnap (getvar "osmode"))
  (setq oldfile (getvar "filedia"))
(setvar "osmode" 0)
  (setvar "filedia" 0)

  (vl-load-com)
   (setq acadDocument (vla-get-activeDocument (vlax-get-Acad-Object)))
    (setq mspace (vla-get-ModelSpace (vla-get-ActiveDocument (vlax-get-Acad-Object))))

(defun dtr (x) (* pi (/ x 180.0)) )

  (vl-load-com)
  (setq acadobject (vlax-get-Acad-Object))
  (setq activedocument (vla-get-activedocument acadobject))
  (setq LayerTable (vla-get-layers activedocument))
  (setq NewL1 (vla-add LayerTable "C-test-1"))
  (vla-put-color NewL1 253)
  (setq NewL2 (vla-add LayerTable "C-test-2"))
  (vla-put-color NewL2 6)
  (setq NewL3 (vla-add LayerTable "C-test-3")) 
  (vla-put-color NewL3 4)
  (setq NewL4 (vla-add LayerTable "Defpoints"))
  (vla-put-color NewL4 7) 
  (setq NewL5 (vla-add LayerTable "C-test-4"))
  (vla-put-color NewL5 131)
  (setq NewL6 (vla-add LayerTable "C-test-5"))
  (vla-put-color NewL6 5)
  (setq NewL7 (vla-add LayerTable "C-test-6"))
  (vla-put-color NewL7 3)
  (setq NewL8 (vla-add LayerTable "C-test-7"))
  (vla-put-color NewL8 150) 
 
  ;*************************************************************

(defun savVar ()   
  (setq baba ( atoi (get_tile "baba")))
(setq babc ( atoi (get_tile "babc")))
(setq babe ( atoi (get_tile "babe")))
  (setq babg ( atoi (get_tile "babg"))) 
  (setq cbspc0 0)
(setq cbspc1 ( atoi (get_tile "cbspc1")))
(setq cbspc2 ( atoi (get_tile "cbspc2")))

  (setq cba_list
(list cbspc1
(+ cbspc1 cbspc2)
))

  (setq cba_list (acet-list-remove-duplicates cba_list nil)) 
  (setq cbalist (list cbspc2))
  (setq cbalist (vl-remove-if '(lambda (x)(zerop x)) cbalist))
   
(setq colspc (+ 6 (* baba babe)))
(setq rowspc (+ 6 (* babc babg)))
  (setq popstr0 (get_tile "popup0"))
  (setq popstr1 ( atoi (get_tile "popup1")))
  (setq popstr2 (get_tile "popup2")) 
  (setq popstr3 (get_tile "popup3"))
  (setq selitem0 (nth (atoi popstr0) prmtr0))
(setq selitem1 (nth popstr1 prmtr1))
(setq selitem2 (nth (atoi popstr2) prmtr2))
(setq selitem3 (nth (atoi popstr3) prmtr3))
  (setq rb1 (get_tile "rb1"))
(setq rb2 (get_tile "rb2"))
  )
 
  ;;; lists for popup boxes
  (setq prmtr0 '("T" "F"))
  (setq prmtr1 '("1" "2" "3" "4" "5" "6" "7" "8" "9" "10"))
  (setq prmtr2 '("AB4.0" "BC1.6" "AC2.0" "AD4.0"))
  (setq prmtr3 '("0.6G" "1.0G" "1.5G" "2.0G"))
 
    ;;; start of Dialog box information 
(setq dcl_id (load_dialog "msam.dcl"))
     (if (not (new_dialog "msam" dcl_id))
(exit))
         
(start_list "popup0" 3) (mapcar 'add_list prmtr0) (end_list)
(start_list "popup1" 3) (mapcar 'add_list prmtr1) (end_list)
(start_list "popup2" 3) (mapcar 'add_list prmtr2) (end_list)
(start_list "popup3" 3) (mapcar 'add_list prmtr3) (end_list)

(setq etest2 (list
  (setq cnn0 selitem0)
  (setq cnn1 selitem1)
  (setq cnn2 selitem2)
  (setq cnn3 selitem3)))

(set_tile "dbox1" "1") 
  (action_tile "rb1" "(setq rb1 $value)")
  (action_tile "rb2" "(setq rb2 $value)")
  (action_tile "cancel" "(setq ddiag 1 (done_dialog 1))") 
  (action_tile "accept" "(setq Dbox (get_tile \"dbox1\")) (setq ddiag 2 (done_dialog 2))")
  (action_tile "accept" "(savVar) (done_dialog 2)")


  (start_dialog)
(unload_dialog dcl_id)
   
  (while (= ddiag 2)
     (cond
        ((= Dbox "rb1") (abc))
        ((= Dbox "rb2") (efg))
)
    )
 
;***************************************************************
;*****************************************************************

  (defun abc ()
   (vl-load-com)

        (setq catno2
(alert(STRCAT "CATALOG NUMBER = " cnn0 "-" cnn1 "-" cnn2 "-" cnn3 " ")))
    )
   
;*****************************************************************
;*****************************************************************

  (defun efg ()
   (vl-load-com)

          (setq catno3
(alert(STRCAT "CATALOG NUMBER = " cnn1 "-" cnn0 "-" cnn3 "-" cnn2 " ")))
    )
  )


ymg

  • Guest
Re: starting function by radio button equal 1
« Reply #7 on: November 23, 2015, 07:32:31 PM »
Denzuki,

Many issues,  I removed the action_tile on rb1 and rb2.
The cluster tile takes care of that, all you need to do is
to recuperate the value of the cluster in tile rbox.

You cannot have two action_tile "accept" .

Don't use while ddiag, use if (= ddiag 2)
unless you want to restart the dialog.

I did not check the rest of it, but it execute either
abc or efg depending on which you choose.

The value for cnn are not being set at the moment.

Code: [Select]
;;;LSP code starts here
(defun c:msam ()
   (vl-load-com)

   (or *acdoc*  (setq *acdoc*  (vla-get-ActiveDocument (vlax-get-acad-object))))
   (or *aclay*  (setq *aclay*  (vla-get-Layers *acdoc*)))
   (setq *acspc* (if (= (getvar "CVPORT") 1)
         (vla-get-PaperSpace *acdoc*)
         (vla-get-ModelSpace *acdoc*)
          )
   )
   (setq oldsnap (getvar "osmode"))
   (setq oldfile (getvar "filedia"))
   (setvar "osmode" 0)
   (setvar "filedia" 0)

   
   (defun dtr (x) (* pi (/ x 180.0)))

   
   
   
   (setq newl1 (vla-add *aclay* "C-test-1"))
   (vla-put-color newl1 253)
   (setq newl2 (vla-add *aclay* "C-test-2"))
   (vla-put-color newl2 6)
   (setq newl3 (vla-add *aclay* "C-test-3"))
   (vla-put-color newl3 4)
   (setq newl4 (vla-add *aclay* "Defpoints"))
   (vla-put-color newl4 7)
   (setq newl5 (vla-add *aclay* "C-test-4"))
   (vla-put-color newl5 131)
   (setq newl6 (vla-add *aclay* "C-test-5"))
   (vla-put-color newl6 5)
   (setq newl7 (vla-add *aclay* "C-test-6"))
   (vla-put-color newl7 3)
   (setq newl8 (vla-add *aclay* "C-test-7"))
   (vla-put-color newl8 150)

 ;*************************************************************

   (defun savvar ()
      (setq baba (atoi (get_tile "baba")))
      (setq babc (atoi (get_tile "babc")))
      (setq babe (atoi (get_tile "babe")))
      (setq babg (atoi (get_tile "babg")))
      (setq cbspc0 0)
      (setq cbspc1 (atoi (get_tile "cbspc1")))
      (setq cbspc2 (atoi (get_tile "cbspc2")))

      (setq cba_list
              (list cbspc1
                    (+ cbspc1 cbspc2)
              )
      )

      (setq cba_list (acet-list-remove-duplicates cba_list nil))
      (setq cbalist (list cbspc2))
      (setq cbalist (vl-remove-if '(lambda (x) (zerop x)) cbalist))

      (setq colspc (+ 6 (* baba babe)))
      (setq rowspc (+ 6 (* babc babg)))
      (setq popstr0 (get_tile "popup0"))
      (setq popstr1 (atoi (get_tile "popup1")))
      (setq popstr2 (get_tile "popup2"))
      (setq popstr3 (get_tile "popup3"))
      (setq selitem0 (nth (atoi popstr0) prmtr0))
      (setq selitem1 (nth popstr1 prmtr1))
      (setq selitem2 (nth (atoi popstr2) prmtr2))
      (setq selitem3 (nth (atoi popstr3) prmtr3))
      (setq rb1 (get_tile "rb1"))
      (setq rb2 (get_tile "rb2"))
   )

;;; lists for popup boxes
   (setq prmtr0 '("T" "F"))
   (setq prmtr1 '("1" "2" "3" "4" "5" "6" "7" "8" "9" "10"))
   (setq prmtr2 '("AB4.0" "BC1.6" "AC2.0" "AD4.0"))
   (setq prmtr3 '("0.6G" "1.0G" "1.5G" "2.0G"))

;;; start of Dialog box information 
   (setq dcl_id (load_dialog "msam.dcl"))
   (if (not (new_dialog "msam" dcl_id))
      (exit)
   )

   (start_list "popup0" 3)
   (mapcar 'add_list prmtr0)
   (end_list)
   (start_list "popup1" 3)
   (mapcar 'add_list prmtr1)
   (end_list)
   (start_list "popup2" 3)
   (mapcar 'add_list prmtr2)
   (end_list)
   (start_list "popup3" 3)
   (mapcar 'add_list prmtr3)
   (end_list)

   (setq etest2 (list
                   (setq cnn0 selitem0)
                   (setq cnn1 selitem1)
                   (setq cnn2 selitem2)
                   (setq cnn3 selitem3)
                )
   )

   (set_tile "rb1" "1")

   (action_tile "cancel" "(setq ddiag 1) (done_dialog)")
   
   (action_tile "accept" "(setq Dbox (get_tile \"dbox1\"))
                          (savVar)
                          (setq ddiag 2)
                          (done_dialog)"
   )

   (start_dialog)
   (unload_dialog dcl_id)

   
   (if (= ddiag 2)
      (cond
         ((= dbox "rb1") (abc))
         ((= dbox "rb2") (efg))
      )
   )

 ;*****************************************************************
 ;*****************************************************************

   (defun abc ()
      (alert "abc running !")
      (setq catno2 (strcat "CATALOG NUMBER = " cnn0 "-" cnn1 "-" cnn2 "-" cnn3 " "))
     
   )

 ;*****************************************************************
 ;*****************************************************************

   (defun efg ()     
      (alert "efg running")
      (setq catno3 (strcat "CATALOG NUMBER = " cnn1 "-" cnn0 "-" cnn3  "-" cnn2 " "))
   )
)
« Last Edit: November 23, 2015, 07:50:41 PM by ymg »

Denzuki

  • Guest
Re: starting function by radio button equal 1
« Reply #8 on: November 24, 2015, 11:18:29 AM »
Yeah, that's what happens when I try to sample too many examples.
OK, I incorporated your changed manually into my msam routine. it loads correctly. I do see the dialog box and can enter values into the dialog boxes and select the radio buttons.

I received this once I selected "OK":

<Source #2>
;;;Copied to window at 9:03 AM 11/24/15

(lambda ($KEY $VALUE $DATA $REASON $X $Y)
  (setq Dbox (get_tile "dbox1"))
                                     (savVar)
                                     (setq ddiag 2)
                                     (done_dialog)
    )

;;; End of text

And the command line gave this: ; error: malformed list on input

So then I thought I would try it from a new drawing and from the code you had assembled. it did not get the <source> error; however, I did get this in the command line:

; error: no function definition: EFG

Upon stepping through, it gets stuck at the "OK".

By the way, is there a way to clear out a queue of any kind? I keep noticing that when I want to run a routine, it doesn't take on the first run, but will on a subsequent run.
« Last Edit: November 24, 2015, 11:55:55 AM by Denzuki »

ymg

  • Guest
Re: starting function by radio button equal 1
« Reply #9 on: November 24, 2015, 01:09:42 PM »
Denzuki,

If you copy/paste the code of my previous post,
and use your DCL file:

Does it run ?    On my side it does!

Your question about the queue I do not understand what you mean.

Check that you've entered this correctly, you seem to have either a wrong
parentheses or you did not escape the "

Code - Auto/Visual Lisp: [Select]
  1. (action_tile "accept" "(setq Dbox (get_tile \"dbox1\"))
  2.                          (savVar)
  3.                          (setq ddiag 2)
  4.                          (done_dialog)"
  5.    )
  6.  

Notes that the setq dbox could be put in your (savVar) function instead of there.

ymg
« Last Edit: November 24, 2015, 01:17:28 PM by ymg »

Denzuki

  • Guest
Re: starting function by radio button equal 1
« Reply #10 on: November 24, 2015, 02:17:50 PM »
Hi ymg,

To answer your question, yes I did copy and paste your code and yes it does run up until I press "OK" in the dialog box. If I copied your code verbatim, them it should work, but sadly it is not working. I will try putting the dbox in my savVar function.

ymg

  • Guest
Re: starting function by radio button equal 1
« Reply #11 on: November 24, 2015, 05:45:39 PM »
Denzuki,

I've added all the action_tile required to update the etest1 tile in your dialog.

So here goes:

Code - Auto/Visual Lisp: [Select]
  1. ;;;LSP code starts here
  2. (defun c:msam ()
  3.  
  4.    (or *acdoc*  (setq *acdoc*  (vla-get-ActiveDocument (vlax-get-acad-object))))
  5.    (or *aclay*  (setq *aclay*  (vla-get-Layers *acdoc*)))
  6.    (setq *acspc* (if (= (getvar "CVPORT") 1)
  7.                          (vla-get-PaperSpace *acdoc*)
  8.                          (vla-get-ModelSpace *acdoc*)
  9.                   )
  10.    )
  11.    (setq oldsnap (getvar "osmode"))
  12.    (setq oldfile (getvar "filedia"))
  13.    (setvar "osmode" 0)
  14.    (setvar "filedia" 0)
  15.  
  16.    
  17.    (defun dtr (x) (* pi (/ x 180.0)))
  18.  
  19.    
  20.    
  21.    
  22.    (setq newl1 (vla-add *aclay* "C-test-1"))
  23.    (vla-put-color newl1 253)
  24.    (setq newl2 (vla-add *aclay* "C-test-2"))
  25.    (vla-put-color newl2 6)
  26.    (setq newl3 (vla-add *aclay* "C-test-3"))
  27.    (vla-put-color newl3 4)
  28.    (setq newl4 (vla-add *aclay* "Defpoints"))
  29.    (vla-put-color newl4 7)
  30.    (setq newl5 (vla-add *aclay* "C-test-4"))
  31.    (vla-put-color newl5 131)
  32.    (setq newl6 (vla-add *aclay* "C-test-5"))
  33.    (vla-put-color newl6 5)
  34.    (setq newl7 (vla-add *aclay* "C-test-6"))
  35.    (vla-put-color newl7 3)
  36.    (setq newl8 (vla-add *aclay* "C-test-7"))
  37.    (vla-put-color newl8 150)
  38.  
  39.  ;*************************************************************
  40.  
  41.    (defun savvar ()
  42.       (setq baba (atoi (get_tile "baba")))
  43.       (setq babc (atoi (get_tile "babc")))
  44.       (setq babe (atoi (get_tile "babe")))
  45.       (setq babg (atoi (get_tile "babg")))
  46.       (setq cbspc0 0)
  47.       (setq cbspc1 (atoi (get_tile "cbspc1")))
  48.       (setq cbspc2 (atoi (get_tile "cbspc2")))
  49.  
  50.       (setq cba_list
  51.               (list cbspc1
  52.                     (+ cbspc1 cbspc2)
  53.               )
  54.       )
  55.  
  56.       (setq cba_list (acet-list-remove-duplicates cba_list nil))
  57.       (setq cbalist (list cbspc2))
  58.       (setq cbalist (vl-remove-if '(lambda (x) (zerop x)) cbalist))
  59.  
  60.       (setq colspc (+ 6 (* baba babe)))
  61.       (setq rowspc (+ 6 (* babc babg)))
  62.      
  63.       (setq selitem0 (nth (atoi (get_tile "popup0")) prmtr0))
  64.       (setq selitem1 (nth (atoi (get_tile "popup1")) prmtr1))
  65.       (setq selitem2 (nth (atoi (get_tile "popup2")) prmtr2))
  66.       (setq selitem3 (nth (atoi (get_tile "popup3")) prmtr3))
  67.    )
  68.  
  69. ;;; lists for popup boxes
  70.    (setq prmtr0 '("T" "F"))
  71.    (setq prmtr1 '("1" "2" "3" "4" "5" "6" "7" "8" "9" "10"))
  72.    (setq prmtr2 '("AB4.0" "BC1.6" "AC2.0" "AD4.0"))
  73.    (setq prmtr3 '("0.6G" "1.0G" "1.5G" "2.0G"))
  74.  
  75. ;;; start of Dialog box information  
  76.    (setq dcl_id (load_dialog "msam.dcl"))
  77.    (if (not (new_dialog "msam" dcl_id))
  78.       (exit)
  79.    )
  80.  
  81.    (start_list "popup0" 3)
  82.    (mapcar 'add_list prmtr0)
  83.    (end_list)
  84.    (start_list "popup1" 3)
  85.    (mapcar 'add_list prmtr1)
  86.    (end_list)
  87.    (start_list "popup2" 3)
  88.    (mapcar 'add_list prmtr2)
  89.    (end_list)
  90.    (start_list "popup3" 3)
  91.    (mapcar 'add_list prmtr3)
  92.    (end_list)
  93.    (setq selitem0 (car prmtr0)
  94.          selitem1 (car prmtr1)
  95.          selitem2 (car prmtr2)
  96.          selitem3 (car prmtr3)
  97.          etest1   (strcat "CATALOG NUMBER = " selitem0 "-" selitem1 "-" selitem2 "-" selitem3 " ")
  98.    )
  99.    
  100.    (set_tile "rb1" "1")
  101.    (set_tile "etest1" etest1)
  102.  
  103.    (action_tile "popup0" "(setq tmp selitem0)
  104.                          (setq selitem0 (nth (atoi (get_tile \"popup0\")) prmtr0))
  105.                          (set_tile \"etest1\" (vl-string-subst selitem0 tmp etest1 17))
  106.                          (setq etest1 (get_tile \"etest1\"))")
  107.                              
  108.    (action_tile "popup1" "(setq tmp selitem1)
  109.                          (setq selitem1 (nth (atoi (get_tile \"popup1\")) prmtr1))
  110.                          (set_tile \"etest1\" (vl-string-subst selitem1 tmp  etest1 17))
  111.                          (setq etest1 (get_tile \"etest1\"))")
  112.  
  113.    (action_tile "popup2" "(setq tmp selitem2)
  114.                          (setq selitem2 (nth (atoi (get_tile \"popup2\")) prmtr2))
  115.                          (set_tile \"etest1\" (vl-string-subst selitem2 tmp  etest1 17))
  116.                          (setq etest1 (get_tile \"etest1\"))")
  117.  
  118.    (action_tile "popup3" "(setq tmp selitem3)
  119.                          (setq selitem3 (nth (atoi (get_tile \"popup3\")) prmtr3))
  120.                          (set_tile \"etest1\" (vl-string-subst selitem3 tmp  etest1 17))
  121.                          (setq etest1 (get_tile \"etest1\"))")
  122.    
  123.    (action_tile "dbox1" "(cond
  124.                            ((= $value \"rb1\")
  125.                                 (setq etest1 (strcat \"CATALOG NUMBER = \" selitem0 \"-\" selitem1 \"-\" selitem2 \"-\" selitem3 \" \")))
  126.                            ((= $value \"rb2\")
  127.                                 (setq etest1 (strcat \"CATALOG NUMBER = \" selitem1 \"-\" selitem0 \"-\" selitem3 \"-\" selitem2 \" \")))
  128.                         )
  129.                         (set_tile \"etest1\" etest1)")
  130.  
  131.    (action_tile "cancel" "(setq ddiag 1) (done_dialog)")
  132.    
  133.    (action_tile "accept" "(setq Dbox (get_tile \"dbox1\"))
  134.                          (savVar)
  135.                          (setq ddiag 2)
  136.                          (done_dialog)"
  137.    )
  138.  
  139.    (unload_dialog dcl_id)
  140.  
  141.    
  142.    (if (= ddiag 2)
  143.       (cond
  144.          ((= dbox "rb1") (abc))
  145.          ((= dbox "rb2") (efg))
  146.       )
  147.    )
  148.  
  149.  ;*****************************************************************
  150.  ;*****************************************************************
  151.  
  152.    (defun abc ()
  153.       (alert "abc running !")
  154.       (princ (setq catno2 (strcat "CATALOG NUMBER = " selitem0 "-" selitem1 "-" selitem2 "-" selitem3 " ")))
  155.      
  156.    )
  157.  
  158.  ;*****************************************************************
  159.  ;*****************************************************************
  160.  
  161.    (defun efg ()      
  162.       (alert "efg running")
  163.       (princ (setq catno3 (strcat "CATALOG NUMBER = " selitem1 "-" selitem0 "-" selitem3  "-" selitem2 " ")))
  164.    )
  165.    (princ)
  166. )
  167.  

« Last Edit: November 24, 2015, 06:26:59 PM by ymg »

Denzuki

  • Guest
Re: starting function by radio button equal 1
« Reply #12 on: November 25, 2015, 05:17:33 PM »
I copied your last code over and tried it as well. I am still not getting the alert messages for either abc or efg. I have even gone as far as to fix the Visual lisp error c:ai_molc. ymg, thank you for all your support.
I may have to look at this from another angle.

ymg

  • Guest
Re: starting function by radio button equal 1
« Reply #13 on: November 25, 2015, 05:50:07 PM »
Denzuki,

Open  a fresh autocad and load the attached file.

Then run it with msam and let me know if it runs.


Denzuki

  • Guest
Re: starting function by radio button equal 1
« Reply #14 on: November 30, 2015, 02:12:00 PM »
Ok, I loaded it and typed msam to run it. When I press OK I do not get an alert. See the image I attached.