Fighting Reactors

Discussion in 'AutoCAD' started by John Georgiev, Jun 11, 2004.

  1. I'm trying to get familiar with reactors. How you can make
    VLR-SYSVAR-REACTOR used with
    :VLR-SYSVARCHANGED event to react only to specific variable change (in my
    case CVPORT)?
    Thanks.
    John
     
    John Georgiev, Jun 11, 2004
    #1
  2. John Georgiev

    Doug Broad Guest

    John,
    IMO, sysvar reactor is too active to be useful. On some commands it
    fires 10-20 times. But to answer your question, here is one way:


    ;;D. C. Broad, Jr - Demo
    ;;Initiate reactor
    (if (null db:svr)
    (setq db:svr (vlr-sysvar-reactor '("CVPORT") '(:)vlr-sysvarchanged . sysvardemo)))))

    ;;vlr-sysvar callback that reports only sysvars that are in
    ;;the reactor's data list
    ;;NOTE: This reactor fires many more times than it reports.
    (defun sysvardemo (r data)
    (if (member (car data) (vlr-data r))
    (princ (strcat (car data) "changed, sysvardemo callback reporting."))))
     
    Doug Broad, Jun 11, 2004
    #2
  3. Thanks Doug, I think this answer my question.

     
    John Georgiev, Jun 11, 2004
    #3
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.