OK, I'm fairly new to the world of reactors and have run into a problem which I'm hoping somebody can help me with.
I have created a very basic reactor as a test. As you can see, it doesn't actually do anything other than set a variable so I know the error isn't caused by something I'm doing with the reactor.
(defun np:test (reactor callbackdata / ) (setq abc 123) ) (if (not np:reactor1) (setq np:reactor1 (vlr-command-reactor nil '((:vlr-commandwillstart . np:test))) ) )
OK, so the problem I have found is that if I load this reactor into a drawing and then use the MVSETUP command but escape out without completing the command, AutoCAD throws an error and becomes unusable. When I then close AutoCAD down I am met with multiple unhandled exception errors before the app finally closes.
I then altered the reactor from a vlr-command-reactor to a vlr-editor-reactor and found that with this, I am no longer met with the same error while escaping out of MVSETUP. However, when I close CAD down I am eventually left with an 'AutoCAD Application has stopped working' error dialog on screen which reports that acad.exe as crashed.
I am working on AutoCAD Architecture 2012 (although I have tried it on 2013 to with the same results) on Windows 7 64bit. I have also tried this on ACA2012 x32 and found the same error exists.
Is there anybody out there who can confirm whether they get the same errors as me or whether I am doing something fundamentally wrong in the way I am handling reactors?
Hi,
(defun np:test (reactor callbackdata / )
(setq abc 123)
)
(if (not np:reactor1)
(setq np:reactor1
(vlr-command-reactor nil '((:vlr-commandwillstart . np:test)))
)
)
the only thing i found that might be a problem is the extra slash (in red)
otherwise it is working good
Moshe
Still crashes without - and that slash would normally be needed to clear out any localised variables in your reactor code. It's just that my example doesn't have any local variables in it for simplicity.
I certainly have none of my own reactors. I have even tried a clean out-of-the-box install and tried this directly after install and still get the crash.
MVSETUP is the only command I have found that causes the error. A bit of testing has shown some odd behaviour with it. If I make a CommandCancelled reactor, this flags when I cancel any command EXCEPT when I cancel MVSETUP and this just seems to close quietly without triggering the reactor.
I can confirm that mvsetup triggers a fatal error if a command reactor with a :vlr-commandwillstart event is active.
Sounds like a bug. Have you reported it at autodesk.com/submitbug ?
I hadn't reported it yet as I wanted to make sure other people could replicate it and also that it wasn't down to me doing something wrong. I'll report the bug now and see if anything comes of it. In the meantime I need to find a way around this because while there are any CommandWillStart reactors loaded, it means that MVSETUP will always trigger this error.
Seems that the EDGE command also triggers the same fatal error. Interestingly, both of these routines are old legacy lisp routines so at least I may be able to pinpoint the trigger point within the files.
Found it.
It seems that the error is triggered by the use of command-s within the routines error handlers.
A search tells me that command-s appears in these files so presumably they will all be affected.
MVSETUP.lsp
EDGE.lsp
AI_UTILS.lsp
VL.arx
Hi,
You mean they use (command) function?
i do not thing they made so essential changes to these command from previous releases
moshe
It seems that command-s was introduced in AutoCAD 2012. The MVSETUP and EDGE lisp routines which shipped with 2011 and earlier use 'command' and these versions do not trigger the fatal error. However, the use of command-s on 2012 and 2103 when a CommandWillStart reactor is loaded will trigger a fatal error.
Partial error routine from Edge.lsp (2011)
(defun edge-er (n) (if (/= s "Function cancelled") (princ (strcat "\nError: " n)) ) (command) (command "_.UCS" "_P")
Same section from Edge.lsp (2013)
(defun edge-er (n) (setq *error* lisp-er) (if (/= s "Function cancelled") (princ (strcat "\nError: " n)) ) (edge_setCmdEcho 0) (command-s "_.UCS" "_P")
If you are running 2012/2013 then load the reactor from my original post and then use this command and you will get a fatal error:
(command-s "_.line" "0,0,0" "10,10,0" "")