Hi all,
I have been avoiding this for a looong time. It is finally here. I need to begin working with reactors. Currently we are using none and I need to address some issues that reactors are likely the only solution.
Just now, I'm asking for advice on Reactors, Dos and Don'ts.
The two reactors that I'll have to tackle first:
Most of all I have fingers crossed that someone can shed some light in this darkness.
Thank you for any information, but usefull examples are greatly appreciated.
Solved! Go to Solution.
Solved by Lee_Mac. Go to Solution.
Solved by dbroad. Go to Solution.
@acwtzwegers wrote:Thank you Lee! It now also makes quite a bit more sense to me 🙂
Excellent - you're most welcome!
@acwtzwegers wrote:The reactor method seems more effective... If only if I could find the right spot to start it from:
- When I put it through the startup suite, the drafter needs to press Ok 4 times besides the one time AutoCAD already asks for (the regular read-only warning).
- This is because upon opening I have a Standards script that makes sure some settings are correct, which apparently activates the reactor 4 times.
Instead of modifying your Standards Script, try removing the previous program from your Startup Suite and instead try adding the following to your acaddoc.lsp (NOT acad20##doc.lsp!😞
(defun c:roreactoron nil (if (= 'vlr-command-reactor (type readonly:reactor)) (if (not (vlr-added-p readonly:reactor)) (vlr-add readonly:reactor) ) (setq readonly:reactor (vlr-command-reactor nil '((:vlr-commandwillstart . readonly:callback)) ) ) ) (princ "\nRead Only Reactor enabled.") (princ) ) (defun c:roreactoroff nil (if (= 'vlr-command-reactor (type readonly:reactor)) (vlr-remove readonly:reactor) ) (setq readonly:reactor nil) (princ "\nRead Only Reactor disabled.") (princ) ) (defun readonly:callback ( obj arg ) (if (zerop (getvar 'writestat)) (alert "WARNING: Drawing is read-only.") ) (princ) ) (vl-load-com) (if (= 'list (type s::startup)) (setq s::startup (append s::startup '((c:roreactoron)))) (defun-q s::startup nil (c:roreactoron)) ) (princ)
The above uses the s::startup post-initialisation function so that the reactor is not enabled until the drawing is fully loaded (and hence after your Standards Script has completed).
I hope this helps!
Lee
Big thanks once again! It now works as it should.
I do not call it from acaddoc.lsp though, but from our own, shared, Startup_Suite.lsp we use to load all our custom functionality:
- first a load of the RO_reactor.lsp together with the others
- then, after everything has been loaded, the last IF statement from you to activate it.
Works fine, and even ignores the check out command (which I guess is coincidental, but not a bad thing).
@acwtzwegers wrote:Big thanks once again! It now works as it should.
I do not call it from acaddoc.lsp though, but from our own, shared, Startup_Suite.lsp we use to load all our custom functionality:
- first a load of the RO_reactor.lsp together with the others
- then, after everything has been loaded, the last IF statement from you to activate it.
Works fine, and even ignores the check out command (which I guess is coincidental, but not a bad thing).
You're welcome! - I'm glad the utility is functioning correctly now.
For completeness, it should not matter at which point the if statement is evaluated in the loading sequence, since this statement simply defines the post-initialisation s::startup function which will only be evaluated after everything else is loaded.
Happy to help!
Lee