Thanks Ben, I will play around with this for a while.
Found out also that setting modemacro to read clayer with lisp does it for a
one time only. When you change layers status line does not. Diesel changes
everytime clayer changes.
--
Ken Alexander
Acad2000
Win2000prof.
------------------------------------------
"Ben Maki" wrote in message
news:BBEBE3D84120EBC38BAFDBE5428F471C@in.WebX.maYIadrTaRb...
> I understand. It took me forever to figure reactors out because they are
> not well documented. You can find some info on them in the AlispRef.pdf
> guide that comes with AutoCAD (look in the Help folder). Go to the
section
> on VLR-*. The following is a function to setup the reactor using a nice
> routine by Eric Scheider that helps make sure you don't have multiple
> reactors loaded doing the same thing. Replace myFunction with the name of
> your function. I haven't played too much with this particular reactor,
but
> I would think it would work for what your doing.
>
> (setq *myReactor* (REAC:STATE '(vlr-miscellaneous-reactor
> nil
> '((:vlr-pickfirstmodified . myFunction)))
> 3))
>
> ;;;Reactor loader function
> ;;;Written by: Eric Schneider, Reno, NV
> ;;;cadking@aol.com
> ;;;tests for constructed "reactor"
> ;;;syntax: (REAC:STATE 'reactor mode)
> ;;;arguments: reactor - quoted typical reactor construction syntax, mode -
> intiger 0-7
> ;;;usage: (REAC:STATE '(VLR-Command-Reactor nil '((:VLR-commandWillStart .
> TEST))) 1)
> ;;;"mode" 0 constructs "reactor" once even if already constructed
> ;;;"mode" 1 constructs "reactor" once if "reactor" has not already been
> constructed
> ;;;"mode" 2 removes first constructed "reactor" with matching "event" and
> "call", then constructs once
> ;;;"mode" 3 removes *all* constructed "reactor"s with matching "event" and
> "call", then constructs once
> ;;;"mode" 4 removes first constructed "reactor" with matching "event" and
> "call"
> ;;;"mode" 5 removes *all* constructed "reactor"s with matching "event" and
> "call"
> ;;;"mode" 6 removes *all* constructed "reactor"s with matching "event"
> regardless of "call"
> ;;;"mode" 7 removes *all* constructed "reactor"s regardless of "call" or
> "event"
> ;;;returns last VLR object acted upon, else nil
> (defun REAC:STATE (reactor mode / call reaction rname vlrobj)
> (setq call (eval (caddr reactor))
> event (caar call)
> rname (read (strcat ":" (vl-symbol-name (car reactor))))
> ) ;_ end of setq
> (if (> mode 0)
> (foreach itm (cdar (vlr-reactors rname))
> (setq reaction (vlr-reactions itm))
> (cond
> ((and (= mode 1) (equal call reaction))
> (setq reactor nil)
> )
> ((or
> (and (= mode 2) (not vlrobj) (equal call reaction))
> (and (= mode 3) (equal call reaction))
> (and (= mode 4) (not vlrobj) (equal call reaction))
> (and (= mode 5) (equal call reaction))
> (and (= mode 6) (equal event (caar reaction)))
> (= mode 7)
> ) ;_ end of or
> (setq vlrobj (vlr-remove itm))
> )
> ) ;_ end of cond
> ) ;_ end of foreach
> ) ;_ end of if
> (if (and (< mode 4) reactor)
> (setq vlrobj (eval reactor))
> ) ;_ end of if
> vlrobj
> )
> --
> Ben Maki
> NDC Inc.
>
>
> "Ken Alexander" wrote in message
> news:602E04E494A786B786C4C1E0F4D41B86@in.WebX.maYIadrTaRb...
> > I have searched this N.G. and thru the help files on setting up a
reactor
> > for any object. I can't find anything to get me going on the code for
> this.
> > Also I can't find PickFirstModified anywhere.
> >
> > --
> > Ken Alexander
> > Acad2000
> > Win2000prof.
> >
> > ------------------------------------------
> > "Ben Maki" wrote in message
> > news:E624EBF51182E4FC1D36FC00494F5344@in.WebX.maYIadrTaRb...
> > > I suppose your right--You can set MODEMACRO to the current (or
selected)
> > > layer without using diesel at all. But, in order to do this, your
going
> > to
> > > need to set up reactor that attaches your LISP routine to a certain
> event
> > > (for instance, the PickFirstModified event). Then, everytime this
event
> > > occurs, the LISP will run that will set MODEMACRO to the correct
layer.
> > >
> > > --
> > > Ben Maki
> > > NDC Inc.
> > >
> > >
> > > "Ken Alexander" wrote in message
> > > news:29DE0C74243E3DFC4BEF0AB164C1B5B3@in.WebX.maYIadrTaRb...
> > > > This can be done with out diesel expression.
> > > > (setvar "modemacro" (getvar "clayer")).
> > > > help on this:
> > > > (setvar "modemacro"
> > > > (strcat
> > > > (if (not ??pickfirst??) ;; help on this
> > > > (getvar "clayer")
> > > > ;;what goes here?
> > > > )
> > > > )
> > > > )
> > > > What will make this work? Thanks.
> > > >
> > > > --
> > > > Ken Alexander
> > > > Acad2000
> > > > Win2000prof.
> > > >
> > > > ------------------------------------------
> > > > "Ben Maki" wrote in message
> > > > news:AC54CABB4302BC231A9C582B24A03883@in.WebX.maYIadrTaRb...
> > > > > You might want to look into the PickFirstModified reactor and have
> it
> > > > update
> > > > > one of the USERS* system variables with the layer(s) of the
current
> > > > > selection set. Then the MODEMACRO diesel expression can output
the
> > > USERS*
> > > > > variable.
> > > > >
> > > > > --
> > > > > Ben Maki
> > > > > NDC Inc.
> > > > >
> > > > >
> > > > > "Ben Maki" wrote in message
> > > > > news:F45DD21114052DEC873144AC2427143D@in.WebX.maYIadrTaRb...
> > > > > > You can't evaluate LISP routines in a diesel expression, nor can
> you
> > > > > access
> > > > > > LISP variables. only system and enviroment variables.
> > > > > >
> > > > > > --
> > > > > > Ben Maki
> > > > > > NDC Inc.
> > > > > >
> > > > > >
> > > > > > "Ken Alexander" wrote in message
> > > > > > news:418B0C25A7B98C66A78DAD1D785A2E41@in.WebX.maYIadrTaRb...
> > > > > > > Trying to set modemacro var. to show current layer until an
> entity
> > > is
> > > > > > > selected, then show the layer of that entity. Here is what I
> have
> > > so
> > > > > far:
> > > > > > > (setvar "modemacro"
> > > > > > > (strcat
> > > > > > > (setq en (car (last)))
> > > > > > > (setq ln (cdr (assoc 8 (entget en))))
> > > > > > > (if (not ln)
> > > > > > > "Current Layer= $(substr,$(getvar,clayer),1)"
> > > > > > > ""Objects Layer=" ln")
> > > > > > > )
> > > > > > > )
> > > > > > > )
> > > > > > >
> > > > > > > Thank you,
> > > > > > > --
> > > > > > > Ken Alexander
> > > > > > > Acad2000
> > > > > > > Win2000prof.
> > > > > > >
> > > > > > > ------------------------------------------
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>