Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Reactor on quit/close/open etc.

2 views
Skip to first unread message

Tom

unread,
Jan 27, 2002, 4:33:13 AM1/27/02
to
I want to make a reactor that will react when leaving the drawing. For
example, when clicking the "X" at the upper right hand corner, typing in
"QUIT", opening a new drawing (which in my version if AutoCAD 200i closes
the current drawing because we can only have one drawing open at a time (I
think it's because its networked and stuff)), etc. Does any one know the
commands to react off of to cover all my bases?
Thanks,
Tom


bumagka

unread,
Jan 27, 2002, 5:04:52 AM1/27/02
to
the same problem like my .QUIT

you can try ":vlr-documentToBeDestroyed" from (VLR-DocManager-reactor) on
VisualLisp or BeginQuit inVB , but it not helped

John Uhden

unread,
Jan 27, 2002, 3:29:56 PM1/27/02
to
I can give you what you need, but it won't help if you're trying to stop the
QUIT.

What are you trying to accomplish?

--
John Uhden, Cadlantic/formerly CADvantage
--> mailto:juh...@cadlantic.com
--> http://www.cadlantic.com
2 Village Road
Sea Girt, NJ 08750
Tel. 732-974-1711
FAX 732-528-1332


"Tom" <sddf...@dsasdaasdf.com> wrote in message
news:AF18DCDCE36BE09A...@in.WebX.maYIadrTaRb...

Tom

unread,
Jan 27, 2002, 7:36:59 PM1/27/02
to
What I want to do is get a routine to run whenever a drawing is closed. I've
been trying to figure out how to do this by reading the past posts but have
been unsuccessful. I think this may help. Our computers are set up so we can
only have one drawing open in AutoCAD at a time (we are running 2000i). So
if we want to have two drawings open we need to open two copies of AutoCAD.
When we want to open a new drawing in a copy of AutoCAD that is already
running it closes the current drawing to make room for the new drawing (I
hope that makes sense). In any case I would like to have a lisp routine to
run when a drawing is closed.

Thanks in advance,

Tom


"John Uhden" <juh...@cadlantic.com> wrote in message
news:13821EEBA031F852...@in.WebX.maYIadrTaRb...

Dave Pitzer

unread,
Jan 27, 2002, 9:23:53 PM1/27/02
to
Hi, Tom!!!

Dave P.


"Tom" <sddf...@dsasdaasdf.com> wrote in message
news:AF18DCDCE36BE09A...@in.WebX.maYIadrTaRb...

Tom

unread,
Jan 27, 2002, 9:37:37 PM1/27/02
to
Hey Dave!
Tom


John Uhden

unread,
Jan 27, 2002, 9:53:47 PM1/27/02
to
Now that you and Dave have politely greeted one another <G> ...

;;--------------------------------------
;; Define Tom's Drawing Reactor Function
;;
(defun @Tom_Dwg_Close (Reactor Info / cmdnames)
(setq cmdnames (strcase (getvar "cmdnames")))
;; Following is just for your testing
;; since you might build a separate-namespace VLX
(if (= (vl-doc-ref '$Tom_test_mode) 1)
(progn
(princ "\n\nPerforming @Tom_Dwg_Close")
(princ "\nCalling Reactor: ")(prin1 Reactor)
(princ "\nCalling Reactor Type: ")(prin1 (type Reactor))
(princ "\nCommand Info: ")(prin1 Info)
(princ "\nCommand Info Type: ")(prin1 (type Info))
(princ (strcat "\nCMDNAMES: " cmdnames))
)
)
;; This is what I've found to work, thought there is
;; an occasional LDD2i command that eludes me.
(if (not (wcmatch cmdnames "*COPY*,*CLIP*,*PASTE*,*INSERT*"))
;; Do what you want here.
;; I use dialog interfaces with no problem.
;; Just don't try to use (command) or (vl-cmdf).
)
;; since the drawing is closing, it's wise to remove your reactor.
(vlr-remove Tom_Dwg_Reactor)
(princ)
)
;;-------------------------------------
;; Set up Tom's Drawing Reactor
;;
(if (= (type Tom_Dwg_Reactor) 'VLR-DWG-Reactor)
(if (not (vlr-added-p Tom_Dwg_Reactor))
(vlr-add Tom_Dwg_Reactor)
)
(setq Tom_Dwg_Reactor
(vlr-dwg-reactor "Tom's Drawing Reactor"
'((:vlr-BeginClose . @Tom_Dwg_Close))
)
)
)

I haven't tested this adaptation for you, but it should work just fine.

--
John Uhden, Cadlantic/formerly CADvantage
--> mailto:juh...@cadlantic.com
--> http://www.cadlantic.com
2 Village Road
Sea Girt, NJ 08750
Tel. 732-974-1711
FAX 732-528-1332

"Tom" <sddf...@dsasdaasdf.com> wrote in message

news:E8B635BEBD94B535...@in.WebX.maYIadrTaRb...

Tom

unread,
Jan 28, 2002, 3:32:29 PM1/28/02
to
Thank you so much for all your help! The lisp works great except for one
thing that I should but can't figure out. We are running Land Development
Desktop 2i and on some machines we also have CAD Overlay. I think it has
something to do with (as you called it) LDD2i. As far as I can tell when we
open or make new drawings the reactor doesn't run (I type in "NEW" or "OPEN"
and it runs "AECNEW" or "AECOPEN") but otherwize it works great. Do you
know what's going on?
Thanks so much for your help,
Tom

"John Uhden" <juh...@cadlantic.com> wrote in message

news:322F06B22C85D496...@in.WebX.maYIadrTaRb...

John Uhden

unread,
Jan 28, 2002, 3:52:20 PM1/28/02
to
What I sent you was built only for a :vlr-beginclose reaction.

Here are the others you might include in your list of reaction events:
(:vlr-dwgFileOpened . @cv_end_open) ; neither of these
(:vlr-endDwgOpen . @cv_end_open) ; works (11-29-00)
(:vlr-BeginClose . @cv_drawing_close)
; (:vlr-databaseToBeDestroyed . @cv_drawing_destroy) ; removed
(03-24-01)
(:vlr-BeginSave . @cv_begin_save)
(:vlr-SaveComplete . @cv_end_save)
(:vlr-beginDwgOpen . @cv_begin_open)

Please edit the above with your own reactor function. Or, if you want to
use the same function, then insert conditional statements...
(setq Reaction (vlr-current-reaction-name))
(cond
((= Reaction :vle-beginDwgOpen)
;; do_this
)
((= Reaction :vlr-endDwgOpen)
;; do_that
)
;; etc.
)

To find out what fires the reactor, turn on the test_mode I suggested and
see what cmdname is to blame. With add-ons like LDD, it's sorta like
Forrest Gump's box o' choc'lates.

--
John Uhden, Cadlantic/formerly CADvantage
--> mailto:juh...@cadlantic.com
--> http://www.cadlantic.com
2 Village Road
Sea Girt, NJ 08750
Tel. 732-974-1711
FAX 732-528-1332

"Tom" <no-...@sonic.net> wrote in message
news:C81C3D4A8183D418...@in.WebX.maYIadrTaRb...

Tony Tanzillo

unread,
Jan 28, 2002, 4:34:01 PM1/28/02
to
"Tom" <no-...@sonic.net> wrote in message
news:C81C3D4A8183D418...@in.WebX.maYIadrTaRb...
> Thank you so much for all your help! The lisp works great except for one
> thing that I should but can't figure out. We are running Land Development
> Desktop 2i and on some machines we also have CAD Overlay. I think it has
> something to do with (as you called it) LDD2i. As far as I can tell when
we
> open or make new drawings the reactor doesn't run (I type in "NEW" or
"OPEN"
> and it runs "AECNEW" or "AECOPEN") but otherwize it works great. Do you
> know what's going on?
> Thanks so much for your help,
> Tom

You're using the wrong reactor class.

To do this reliably, you should use the vlr-docmanager-reactor.

You can use the vlr-documentCreated notification to handle
NEW and OPEN, and the vlr-documentToBeDestroyed notification
to handle closing.


John Uhden

unread,
Jan 28, 2002, 5:53:34 PM1/28/02
to
Just curious. What kind of unreliable experiences have you had with
Vlr-Dwg-Reactors?

--
John Uhden, Cadlantic/formerly CADvantage
--> mailto:juh...@cadlantic.com
--> http://www.cadlantic.com
2 Village Road
Sea Girt, NJ 08750
Tel. 732-974-1711
FAX 732-528-1332


"Tony Tanzillo" <tony.t...@remove.this.caddzone.com> wrote in message
news:26996CA3437BC30C...@in.WebX.maYIadrTaRb...

Tom

unread,
Jan 28, 2002, 10:39:00 PM1/28/02
to
I'm confused... How do I add reaction events? I would like it to do the
same thing for all of them.
Thanks,
Tom


John Uhden

unread,
Jan 29, 2002, 9:34:10 AM1/29/02
to
;;-------------------------------------
;; Set up Tom's Drawing Reactor
;;
(if (= (type Tom_Dwg_Reactor) 'VLR-DWG-Reactor)
(if (not (vlr-added-p Tom_Dwg_Reactor))
(vlr-add Tom_Dwg_Reactor)
)
(setq Tom_Dwg_Reactor
(vlr-dwg-reactor "Tom's Drawing Reactor"
'(
;; THESE ARE THE REACTOR EVENTS.
;; Unless you want to have conditional statements
;; in one call-back function, I suggest you use
;; a separate call-back function for each event
;; as is demostrated here...
(:vlr-BeginClose . @Tom_Dwg_Close)
(:vlr-BeginSave . @Tom_Dwg_BeginSave)
(:vlr-SaveComplete . @Tom_Dwg_EndSave)
(:vlr-beginDwgOpen . @Tom_Dwg_BeginOpen)
)
)
)
)

Wouldn't hurt to study the help file "acad_dev.chm" either.

--
John Uhden, Cadlantic/formerly CADvantage
--> mailto:juh...@cadlantic.com
--> http://www.cadlantic.com
2 Village Road
Sea Girt, NJ 08750
Tel. 732-974-1711
FAX 732-528-1332

"Tom" <sddf...@dsasdaasdf.com> wrote in message

news:CEF6C3B13583002F...@in.WebX.maYIadrTaRb...

Tom

unread,
Feb 4, 2002, 5:22:34 PM2/4/02
to
Thanks!


0 new messages