layout reactor

layout reactor

Anonymous
Not applicable
922 Views
14 Replies
Message 1 of 15

layout reactor

Anonymous
Not applicable
I have this layout reactor (see below) which I want invoked each time I
click a different layout tab (A2k obviously) but it fires multiple times
when switching layouts sometimes twice, sometimes 6 or 7 times. Anyone have
any ideas why???

;;Load a reactor to inform us of layout changes so we can update the title
block
;;functions to point at the current title block
(if (not *layoutReactor*)
(setq *layoutReactor*
(vlr-miscellaneous-reactor
nil
'((:vlr-layoutswitched . find_different_title_block))
) ;_ end of vlr-miscellaneous-reactor
)
)

Thanks in advance
Perry
0 Likes
923 Views
14 Replies
Replies (14)
Message 2 of 15

Anonymous
Not applicable
This is the case with many reactor notifications.

My advice would be to use the CommandEnded reactor,
and act when the name of the command is "-LAYOUT".

perry wrote:
>
> I have this layout reactor (see below) which I want invoked each time I
> click a different layout tab (A2k obviously) but it fires multiple times
> when switching layouts sometimes twice, sometimes 6 or 7 times. Anyone have
> any ideas why???
>
> ;;Load a reactor to inform us of layout changes so we can update the title
> block
> ;;functions to point at the current title block
> (if (not *layoutReactor*)
> (setq *layoutReactor*
> (vlr-miscellaneous-reactor
> nil
> '((:vlr-layoutswitched . find_different_title_block))
> ) ;_ end of vlr-miscellaneous-reactor
> )
> )
>
> Thanks in advance
> Perry

--
/*********************************************************/
/* Tony Tanzillo Design Automation Consulting */
/* Programming & Customization for AutoCAD & Compatibles */
/* ----------------------------------------------------- */
/* tony.tanzillo@worldnet.att.net */
/* http://ourworld.compuserve.com/homepages/tonyt */
/*********************************************************/
0 Likes
Message 3 of 15

Anonymous
Not applicable
The only time I have had reactors fire multiple times was when the reactor
was created multiple times (when I kept loading the file while debugging).
From the code you posted, I'm not sure why you would be experiencing this,
unless it somehow ends up in a different namespace each time so your global
*layoutReactor* is not seen by subsequent loads.

...

Is this set up to run in a separate namespace? If so, then I think you will
have to export your *layoutReactor*.

Mike Weaver

"perry" wrote in message
news:87lkjm$ef810@adesknews2.autodesk.com...
> I have this layout reactor (see below) which I want invoked each time I
> click a different layout tab (A2k obviously) but it fires multiple times
> when switching layouts sometimes twice, sometimes 6 or 7 times. Anyone
have
> any ideas why???
>
> ;;Load a reactor to inform us of layout changes so we can update the title
> block
> ;;functions to point at the current title block
> (if (not *layoutReactor*)
> (setq *layoutReactor*
> (vlr-miscellaneous-reactor
> nil
> '((:vlr-layoutswitched . find_different_title_block))
> ) ;_ end of vlr-miscellaneous-reactor
> )
> )
>
>
>
> Thanks in advance
> Perry
>
>
>
>
0 Likes
Message 4 of 15

Anonymous
Not applicable
There are several reactors that behave the way Perry describes. Try setting
up a documentBecameCurrent reactor sometime. This behavior even spills over
into the ActiveX side of things. Place a msgbox in the Activate event of
ThisDrawing. You'll get prompted several times whenever you siwtch
documents.

--
Get free software and more at
http://msnhomepages.talkcity.com/protectionfault/foquendo

"Michael Weaver" wrote in message
news:87mtl0$i3r17@adesknews2.autodesk.com...
> The only time I have had reactors fire multiple times was when the reactor
> was created multiple times (when I kept loading the file while debugging).
> From the code you posted, I'm not sure why you would be experiencing this,
> unless it somehow ends up in a different namespace each time so your
global
> *layoutReactor* is not seen by subsequent loads.
>
> ...
>
> Is this set up to run in a separate namespace? If so, then I think you
will
> have to export your *layoutReactor*.
>
>
>
> Mike Weaver
>
>
> "perry" wrote in message
> news:87lkjm$ef810@adesknews2.autodesk.com...
> > I have this layout reactor (see below) which I want invoked each time I
> > click a different layout tab (A2k obviously) but it fires multiple times
> > when switching layouts sometimes twice, sometimes 6 or 7 times. Anyone
> have
> > any ideas why???
> >
> > ;;Load a reactor to inform us of layout changes so we can update the
title
> > block
> > ;;functions to point at the current title block
> > (if (not *layoutReactor*)
> > (setq *layoutReactor*
> > (vlr-miscellaneous-reactor
> > nil
> > '((:vlr-layoutswitched . find_different_title_block))
> > ) ;_ end of vlr-miscellaneous-reactor
> > )
> > )
> >
> >
> >
> > Thanks in advance
> > Perry
> >
> >
> >
> >
>
>
0 Likes
Message 5 of 15

Anonymous
Not applicable
Good to know, Frank. I haven't run into this before.

Thanks for the heads up.

Mike Weaver

"Frank Oquendo" wrote in message
news:87mtua$i3e12@adesknews2.autodesk.com...
> There are several reactors that behave the way Perry describes. Try
setting
> up a documentBecameCurrent reactor sometime. This behavior even spills
over
> into the ActiveX side of things. Place a msgbox in the Activate event of
> ThisDrawing. You'll get prompted several times whenever you siwtch
> documents.
>
> --
0 Likes
Message 6 of 15

Anonymous
Not applicable
Thanks everyone!
I think I will try Tony's approach first, I have used the "commandended"
reactor before to cure other strange behavior but didnt realize I could use
it for the layout command as well.
0 Likes
Message 7 of 15

Anonymous
Not applicable
Sound pretty reasonable to me Tony I'll give it a shot.
Thanks!

"Tony Tanzillo" wrote in message
news:389E6AFD.A70F965C@worldnet.att.net...
> This is the case with many reactor notifications.
>
> My advice would be to use the CommandEnded reactor,
> and act when the name of the command is "-LAYOUT".
>
0 Likes
Message 8 of 15

Anonymous
Not applicable
Hi,

You will get "n" notifications, if you load the same functions for "n"
times.

-Pakutharivu

--

---------------------------------------------
CADD Centre - Corporate Office
#5, Sir PS Sivasami Salai, Mylapore
CHENNAI - 600004, India
Ph: +91 44 4994678
FAX: +91 44 4971098
e-mail: ccche1@vsnl.com
http://www.caddcentreindia.com

Tony Tanzillo wrote in message
news:389E6AFD.A70F965C@worldnet.att.net...
> This is the case with many reactor notifications.
>
> My advice would be to use the CommandEnded reactor,
> and act when the name of the command is "-LAYOUT".
>
> perry wrote:
> >
> > I have this layout reactor (see below) which I want invoked each time I
> > click a different layout tab (A2k obviously) but it fires multiple times
> > when switching layouts sometimes twice, sometimes 6 or 7 times. Anyone
have
> > any ideas why???
> >
> > ;;Load a reactor to inform us of layout changes so we can update the
title
> > block
> > ;;functions to point at the current title block
> > (if (not *layoutReactor*)
> > (setq *layoutReactor*
> > (vlr-miscellaneous-reactor
> > nil
> > '((:vlr-layoutswitched . find_different_title_block))
> > ) ;_ end of vlr-miscellaneous-reactor
> > )
> > )
> >
> > Thanks in advance
> > Perry
>
> --
> /*********************************************************/
> /* Tony Tanzillo Design Automation Consulting */
> /* Programming & Customization for AutoCAD & Compatibles */
> /* ----------------------------------------------------- */
> /* tony.tanzillo@worldnet.att.net */
> /* http://ourworld.compuserve.com/homepages/tonyt */
> /*********************************************************/
0 Likes
Message 9 of 15

Anonymous
Not applicable
Is there a way to have a lisp routine run before autocad switches to a new
layout when the tab is selected with the mouse? I've fiddled with the
vlr-miscellaneous-reactor a little and it seems to run the lisp after it has
switched layouts.

Thanks,

Brian
0 Likes
Message 10 of 15

Anonymous
Not applicable
Brian Hailey,

> Is there a way to have a lisp routine run before autocad switches to a new
> layout when the tab is selected with the mouse?

No, there is not such event available, may ask what are you trying to do,
why has to be before switching?

Luis
0 Likes
Message 11 of 15

Anonymous
Not applicable
You could use the SYSVARWILLCHANGE reactor and watch for CTAB and CVPORT to
change.
--

Regards,
Eric S.
Message 12 of 15

Anonymous
Not applicable
I'm working on a lisp that will change the ltscale when the layout is
changed. If I change the ltscale after the switch to the new layout, the
linework does not look correct and requires a regen. If I can change the
ltscale before the switch, the linework looks correct after the layout is
regenerated.

Brian

"Luis Esquivel" wrote in message
news:E51D78B493160B0A955E3A0352AD1C40@in.WebX.maYIadrTaRb...
> Brian Hailey,
>
> > Is there a way to have a lisp routine run before autocad switches to a
new
> > layout when the tab is selected with the mouse?
>
> No, there is not such event available, may ask what are you trying to do,
> why has to be before switching?
>
> Luis
>
>
0 Likes
Message 13 of 15

Anonymous
Not applicable
Brian,

I guess I had a similar need which I solved by redefining the Layout
command, introducing a line of code that sets Ltscale to 1 and then issues
the original "._layout" command. It's not a reactor, but it solves the
problem. What I wanted to prevent was incorrect printing of non continuous
lines, which do not print as expected from a layout when Lltscale is not 1.

Alfredo Medina
alfmedina@hotmail.com

Brian Hailey wrote:
>
> I'm working on a lisp that will change the ltscale when the layout is
> changed. If I change the ltscale after the switch to the new layout, the
> linework does not look correct and requires a regen. If I can change the
> ltscale before the switch, the linework looks correct after the layout is
> regenerated.
>
> Brian
>
(...)
0 Likes
Message 14 of 15

Anonymous
Not applicable
That's exactly my goal as well. (along with learning lisp)

Brian

"Alfredo Medina" wrote in message
news:3C044E88.6153058E@hotmail.com...
> Brian,
>
> I guess I had a similar need which I solved by redefining the Layout
> command, introducing a line of code that sets Ltscale to 1 and then issues
> the original "._layout" command. It's not a reactor, but it solves the
> problem. What I wanted to prevent was incorrect printing of non continuous
> lines, which do not print as expected from a layout when Lltscale is not
1.
>
> Alfredo Medina
> alfmedina@hotmail.com
>
> Brian Hailey wrote:
> >
> > I'm working on a lisp that will change the ltscale when the layout is
> > changed. If I change the ltscale after the switch to the new layout,
the
> > linework does not look correct and requires a regen. If I can change
the
> > ltscale before the switch, the linework looks correct after the layout
is
> > regenerated.
> >
> > Brian
> >
> (...)
0 Likes
Message 15 of 15

Anonymous
Not applicable
You could use the SYSVARWILLCHANGE reactor and watch for CTAB CVPORT and/or
TILEMODE to
change. This will fire bebore the layout switches.
--

Regards,
Eric S.
0 Likes