Reactors and Layers?

Discussion in 'AutoCAD' started by Alexander V. Koshman, Jan 28, 2005.

  1. Hello to everyone in this NG!
    --------------------------------

    Do anybody know (I'm sure you DO know!) do we can make reactors
    notifying the changes in Drawing Layers?

    I want to catch the following events:
    1. Creating a new Layer
    2. Deleting of an existing Layer
    3. Renaming of an existing Layer

    The changes of "CLAYER" I think I can catch with VLR-SysVar-reactor.

    So I made 4 ObjectReactors: two :)VLR-Modified & :VLR-Erased) for the entire
    Drawing's Layer Object and two for Drawing's particular Layers (in the
    list).

    And what??? :-(

    I get some result only when I create a new Layer
    (the 'Modified'-event triggers for the entire Layer Object)!
    And when I delete or rename one AutoCAD seems to sleep calmly...

    Do I can use the Object Reactor for Layers? And how have I to do this?

    What do you think about that?

    Thank you all and sorry for my english...
    -------------------------------------------
    Alexander V. Koshman

    My codes:
    ;; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    (defun lrs-modified (owner reactor ed_list)
    (alert "Layer Table: Modified!")
    (princ)
    ) ; - 'defun'

    (defun lrs-erased (owner reactor ed_list)
    (alert "Layer Table: Erased!")
    (princ)
    ) ; - 'defun'

    (defun lr-modified (owner reactor ed_list)
    (alert "Layer Table Entries: Modified!")
    (princ)
    ) ; - 'defun'

    (defun lr-erased (owner reactor ed_list)
    (alert "Layer Table Entries: Erased!")
    (princ)
    ) ; - 'defun'
    ;; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    (vl-load-com)
    (setq acad (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acad))
    (setq axLayers (vla-get-Layers doc))

    (setq lrs-rr-list (list axLayers))
    (vlax-for for-item axLayers
    (setq lr-rr-list (append lr-rr-list (list for-item)))
    ) ; - 'vlax-for'

    (if (not lrs-Modified-rr)
    (progn
    (setq lrs-Modified-rr (VLR-Object-reactor lrs-rr-list nil
    '(:)VLR-Modified . lrs-modified))))
    (setq lrs-Erased-rr (VLR-Object-reactor lrs-rr-list nil
    '(:)VLR-Erased . lrs-erased))))
    (setq lr-Modified-rr (VLR-Object-reactor lr-rr-list nil
    '(:)VLR-Modified . lr-modified))))
    (setq lr-Erased-rr (VLR-Object-reactor lr-rr-list nil
    '(:)VLR-Erased . lr-erased))))
    ) ; - 'progn'
    ) ; - 'if'
    ;; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
     
    Alexander V. Koshman, Jan 28, 2005
    #1
  2. Oh!
    -------
    Forget!
    I'm sorry...
    Excuse me AutoCAD... : (

    I tried to erase and rename Layers which
    were created AFTER reactor was set!

    Thank you anyway for I can formulate my problem
    and have another chance to think about

    WHAT I DO !!! : )

    People! Let's be watchful & attentive!
     
    Alexander V. Koshman, Jan 28, 2005
    #2
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.