PDA

View Full Version : Help With Reactor...!


vferrara
2008-07-10, 01:17 PM
Hello AUGI Members,

I made an attempt to create a "Document Reactor" that would automatically run when the user switches between drawing files that have been already opened. However, it appears that as the user switches from one drawing to another several times the reactor will fire multiple times when you switch to a drawing, not just once.

It would be greatly appreciated if anyone can look at the sample code below and identify what I have done incorrectly......!



(vl-load-com)
(setq mac_documentbecamecurrent_reactor nil
mac_reactors_list nil
mac_item nil
mac_reactor nil
)

(if (setq mac_reactors_list (vlr-reactors :vlr-docmanager-reactor))
(progn (foreach mac_item mac_reactors_list
(if (= (vlr-data (cadr mac_item)) "MAC-DOCUMENTBECAMECURRENT-REACTOR")
(setq mac_documentbecamecurrent_reactor (cadr mac_item))
)
)

(if mac_documentbecamecurrent_reactor
(if (= (vlr-added-p mac_documentbecamecurrent_reactor) nil)
(vlr-add mac_documentbecamecurrent_reactor)
)
(setq mac_reactor (vlr-docmanager-reactor
"MAC-DOCUMENTBECAMECURRENT-REACTOR"
'((:vlr-documentbecamecurrent .
mac-reactor-documentbecamecurrent))
)
)
)
)

(setq mac_reactor (vlr-docmanager-reactor
"MAC-DOCUMENTBECAMECURRENT-REACTOR"
'((:vlr-documentbecamecurrent . mac-reactor-documentbecamecurrent))
)
)
)

(setq mac_documentbecamecurrent_reactor nil
mac_reactors_list nil
mac_item nil
mac_reactor nil
)

(defun mac-reactor-documentbecamecurrent (mac_reactor mac_info /)

(alert "Reactor has run")
(Princ)
)



Thank you in advance for any assistance.

Regards,
Vince

ccowgill
2008-07-10, 02:05 PM
Hello AUGI Members,

I made an attempt to create a "Document Reactor" that would automatically run when the user switches between drawing files that have been already opened. However, it appears that as the user switches from one drawing to another several times the reactor will fire multiple times when you switch to a drawing, not just once.

It would be greatly appreciated if anyone can look at the sample code below and identify what I have done incorrectly......!



(vl-load-com)
(setq mac_documentbecamecurrent_reactor nil
mac_reactors_list nil
mac_item nil
mac_reactor nil
)

(if (setq mac_reactors_list (vlr-reactors :vlr-docmanager-reactor))
(progn (foreach mac_item mac_reactors_list
(if (= (vlr-data (cadr mac_item)) "MAC-DOCUMENTBECAMECURRENT-REACTOR")
(setq mac_documentbecamecurrent_reactor (cadr mac_item))
)
)

(if mac_documentbecamecurrent_reactor
(if (= (vlr-added-p mac_documentbecamecurrent_reactor) nil)
(vlr-add mac_documentbecamecurrent_reactor)
)
(setq mac_reactor (vlr-docmanager-reactor
"MAC-DOCUMENTBECAMECURRENT-REACTOR"
'((:vlr-documentbecamecurrent .
mac-reactor-documentbecamecurrent))
)
)
)
)

(setq mac_reactor (vlr-docmanager-reactor
"MAC-DOCUMENTBECAMECURRENT-REACTOR"
'((:vlr-documentbecamecurrent . mac-reactor-documentbecamecurrent))
)
)
)

(setq mac_documentbecamecurrent_reactor nil
mac_reactors_list nil
mac_item nil
mac_reactor nil
)

(defun mac-reactor-documentbecamecurrent (mac_reactor mac_info /)

(alert "Reactor has run")
(Princ)
)

Thank you in advance for any assistance.

Regards,
Vince
VLIDE help states the following: :vlr-documentBecameCurrent
The current document has been changed.
This does not necessarily imply that the document has been activated, because changing the current document is necessary for some operations. To obtain user input, the document must be activated as well.

I would try a different type of reactor if you can.

vferrara
2008-07-11, 06:56 PM
ccowgill,

Thank you for you input......since reactors are somewhat new to me, do you have any suggestions or recommendations on what type of reactor to use when switching between already opened drawing files.....??

Thanks again for your help.

Regards,
Vince

ccowgill
2008-07-11, 07:36 PM
ccowgill,

Thank you for you input......since reactors are somewhat new to me, do you have any suggestions or recommendations on what type of reactor to use when switching between already opened drawing files.....??

Thanks again for your help.

Regards,
VinceI will have to do some research, I only have experience with command reactors. perhaps someone else has experience with this and can assist.