View Full Version : Information popup
Alltimes
02-10-2008, 04:29 AM
G'day all,
I need help writing a lisp, what want is for information to popup in CAD during a command,
example: if i type plot or hit the print button, i want a message to popup asking if the revision text has been filled out. then you can select ok and the plot command continues.
some way of getting reminders up in fromt of people during commands, thats what i need.
any help would be great.
Cheers
Alan Cullen
02-10-2008, 05:22 AM
You need to use the lisp command ALERT.......e.g.
(progn
(alert (strcat "Pipe Outlet............"
"\n"
"\nMaximum Invert Level to maintain pipe cover = IL "(rtos il2)
"\nOutlet Invert Level at selected pipe location = IL "(rtos il1)
"\n"
"\n INSUFFICIENT COVER AT PIPE OUTLET")
)
Alltimes
02-10-2008, 05:59 AM
I'm still having trouble, i cant get it to work with the plot command....?
I can't actually get any alerts to popup.
Are you able to get alerts to work with existing autocad commands or just new lisp / commands that you write....?
Alan Cullen
02-10-2008, 06:12 AM
Generally only within lisp routines. You can create a toolbar button and include a macro there that calls a lisp routine.
Alltimes
02-10-2008, 06:19 AM
I'm trying to get it to work within lisp routines but nothing i write brings up an alert with the plot command.
(DEFUN C:PLOT ( )
(ALERT " HAVE YOU FILLED OUT THE REVISION TEXT!")
(COMMAND ".PLOT")
)
???????
Alan Cullen
02-10-2008, 06:24 AM
Hang on a bit while I test it......
Alan Cullen
02-10-2008, 06:35 AM
Okay...easy fixed....."plot" is an acad command...so you need to change the list start command from PLOT to APLOT, then the alert box will appear. But you'll have to do some more work on the (COMMAND ".PLOT") part, because something is causing it to hang up there.
Alan Cullen
02-10-2008, 06:41 AM
if you use this.....(COMMAND ".PLOT" "")....you'll get the prompts on the command line....I think you need to play with it to get the plot dialogue box up.
Alltimes
02-10-2008, 06:47 AM
Thanks again, i doo appreciate the help.
but i still can't even get the alert to popup,
I've got the lisp saved in a file that loads automatically into CAD.
should i add it to the autocad2009doc.lsp.....?
i type in plot and it goes straight to the dialog box.....?????
Cheers
Alan Cullen
02-10-2008, 07:51 AM
change ypour lisp from this.....
(DEFUN C:PLOT ( )
(ALERT " HAVE YOU FILLED OUT THE REVISION TEXT!")
(COMMAND ".PLOT")
)
to this.......
(DEFUN C:APLOT ( )
(ALERT " HAVE YOU FILLED OUT THE REVISION TEXT!")
(COMMAND ".PLOT")
)
Then load it and type APLOT to start it...you should get the alert box up.
There are a few ways to auto load lisp routines.....placing them in a acaddoc.lsp file is one way...but use the following format.....
(load "aplot")
Alltimes
03-10-2008, 12:08 AM
G'day,
i can finally ge the alert to come up, thats good, thanks again.
but like you were saying i then get the plot info at the command line, not the dialog box, even thought the filedia is set to 1 and doesn't change.....????
In the lisp i tried canceling the command after the alert and then adding the plot command again, on the next line but it doesn't work.....
I'm strugling...
Alan Cullen
03-10-2008, 12:43 AM
Give me a bit of time...I'll have a play with it and do some research....
Alan Cullen
03-10-2008, 01:04 AM
Okay, got it......try the following code.....
(DEFUN C:APLOT ( )
(ALERT " HAVE YOU FILLED OUT THE REVISION TEXT!")
(initdia 1)
(COMMAND "PLOT")
)
Alltimes
03-10-2008, 05:14 AM
Mate, your good.....
Next time i'm in Cairns i'm buying you a beer...
thanks for all you help.
Cheers
Alan Cullen
03-10-2008, 05:34 AM
And I'll take you up on that beer too. :drinks:
Glad to have been of help.
Cheers, mate.
Alltimes
03-10-2008, 05:59 AM
Mate,
Is there a way to change the plot command so the aplot lisp runs.....?
I am able to get it to work if i select the plot icon
and if i type aplot at the command line
but not if i type plot at the command line.....?
Alan Cullen
03-10-2008, 06:25 AM
you could try redefining the plot command...but first you have to undefine it.....(command "undefine" "plot")....stick that code in your acaddoc.lisp file
Try undefining it, then rename the lisp routine to "plot".... (DEFUN C:PLOT ( )
.....and see what happens......I'm still at work here and don't have time to play with it till I get home.
But I can have a play for you once I get home.
vBulletin® v3.7.3, Copyright ©2000-2009, Jelsoft Enterprises Ltd.