PDA

View Full Version : Error in routine that uses DCL with radio buttons for choices


dfuehrer
2005-10-18, 06:40 PM
Hello all,

Being a newbie to writing lisps, I am hoping that someone here could help me out. I can't seem to get a lisp I am writing to function. It is supposed to use a DCL with radio buttons for choices, then run a command loaded from a previously loaded lisp. When I attempt to run it, all I get is this:

Unknown command "A1". Press F1 for help.

Now if I type A1 at the command prompt, the routine runs, sooooo.....

What am I doing wrong?

Also, the image file won't load in the dialog box -- no matter what path I give it (or none at all)!

I'll include the code in a zip file.

Thanks in advance!

Don

miff
2005-10-18, 07:28 PM
What am I doing wrong?
DonFirst of all, this needs another item to compare:
(= choice1).....what are you checking choice1 to be equal to? This is the case for the next 9 lines, too. Should be something like (= choice1 1), or if you just want to check if the variable has been set, it should look like this:
(choice1 (command "A1")), this way if choice1 is NOT nil then the conditional statement will execute, but if it's nil it will skip to the next check.

Second, this line:
(command "A1").....if it is calling a defined lisp function, needs to be called thusly:
(c:A1)

Hope this helps,
Jeff

dfuehrer
2005-10-18, 08:13 PM
Hi Jeff,

Thanks for the quick reply! Yes it does help some... Now it will only run the A1 command, no matter which button choice is made. What else am I missing??

Don

Opie
2005-10-18, 08:18 PM
What are you setting choice1 to? (setq choice1)This does not do anything, therefore your conditional statement will always do the first choice the way you currently have it written.

dfuehrer
2005-10-18, 08:18 PM
BTW Jeff,

I was trying to make (= choice1) be the button choice from the DCL file.

Don

Opie
2005-10-18, 08:21 PM
Then set choice1 to a value and then test for that value
(setq choice1 1)

(= choice1 1)

You should probably reuse the choice1 variable for all of your buttons and test for the value of that variable.

dfuehrer
2005-10-18, 08:21 PM
What are you setting choice1 to? (setq choice1)This does not do anything, therefore your conditional statement will always do the first choice the way you currently have it written.

Richard,

How should it be written?

Don

Opie
2005-10-18, 08:25 PM
Disclaimer: I am not a DCL programmer.
For your action tiles go with these.
(action_tile "but1" "(setq choice 1)(done_dialog)")
(action_tile "but2" "(setq choice 2)(done_dialog)")
(action_tile "but3" "(setq choice 3)(done_dialog)")
(action_tile "but4" "(setq choice 4)(done_dialog)")
(action_tile "but5" "(setq choice 5)(done_dialog)")
(action_tile "but6" "(setq choice 6)(done_dialog)")
(action_tile "but7" "(setq choice 7)(done_dialog)")
(action_tile "but8" "(setq choice 8)(done_dialog)")
(action_tile "but9" "(setq choice 9)(done_dialog)")
(action_tile "but10" "(setq choice 10)(done_dialog)")

For your conditional
(cond
((= choice 1)(command "A1"))
((= choice 2)(command "A2"))
((= choice 3)(command "F1"))
((= choice 4)(command "E1"))
((= choice 5)(command "E2"))
((= choice 6)(command "E3"))
((= choice 7)(command "M1"))
((= choice 8)(command "P1"))
((= choice 9)(command "P2"))
((= choice 10)(command "P3"))
)

dfuehrer
2005-10-18, 10:31 PM
You guys rock!

Thank you for the direction here! Everything works, except for the slide image displaying in the dialog box. Just the empty space where the slide should be...

Thank you all again for the assistance!

Don

Opie
2005-10-18, 10:55 PM
You guys rock!

Thank you for the direction here! Everything works, except for the slide image displaying in the dialog box. Just the empty space where the slide should be...

Thank you all again for the assistance!

Don
Are your slide files located in the ACAD Support Paths?

dfuehrer
2005-10-18, 11:07 PM
Hi Richard,

Yes, I have tried putting it in AutoCAD's search path. Also by defining where to locate it on my system.

Lisp code:

(setq mySlideName "c:/acad/Mayo.sld")
(setq myKey "sld")
(defun upDateImage (sldName key)
(upDateImage mySlideName myKey)
(setq width (dimx_tile key))
(setq height (dimy_tile key))
(start_image key)
(fill_image 0 0 width height 0)
(slide_image 0 0 width height sldName)
(end_image)
)

DCL code:

: image {
key = "sld";
height = 4;
width = 20;
color = -15;
is_enabled = false;
is_tab_stop = false;
}

All to no avail...

Don

Opie
2005-10-18, 11:16 PM
(setq mySlideName "c:/acad/Mayo.sld")
(setq myKey "sld")
(defun upDateImage (sldName key)
(upDateImage mySlideName myKey);; recursive
(setq width (dimx_tile key))
(setq height (dimy_tile key))
(start_image key)
(fill_image 0 0 width height 0)
(slide_image 0 0 width height sldName)
(end_image)
)

You are defining your updateimage routine and then calling that same name within the definition. Move that out of there and put it after the definition and see if that helps.

Like I said: I'm not a DCL Programmer.

dfuehrer
2005-10-18, 11:46 PM
If I put the line (upDateImage mySlideName myKey) above the line (defun upDateImage (sldName key) I get an error telling me that the command UPDATEIMAGE is not defined. Anywhere else and no image, but the dialog box runs with an empty space for the image.

My brain is full for today. I will pick this up again in the morning...

Thank you for the assistance! I REALLY appreciate it!

Don

Opie
2005-10-18, 11:54 PM
If I put the line (upDateImage mySlideName myKey) above the line (defun upDateImage (sldName key) I get an error telling me that the command UPDATEIMAGE is not defined. Anywhere else and no image, but the dialog box runs with an empty space for the image.

My brain is full for today. I will pick this up again in the morning...

Thank you for the assistance! I REALLY appreciate it!

Don
You do have to put it after the definition for it to work not before.

I'll see what I can come up with on the slide in the dialog boxes.

dfuehrer
2005-10-19, 04:02 AM
You do have to put it after the definition for it to work not before.

I'll see what I can come up with on the slide in the dialog boxes.

Thanks again Richard!

Don