chavlji Posted March 14, 2009 Share Posted March 14, 2009 The following code should fire alerts at file Open, Save, Close. Save and Close works ok, but beginOpen EndOpen doesn't do anything. Is there any Reactor that works at file open? I have Autocad 2008. [font=Arial][size=2][font=Arial][size=2][font=Courier New][size=2](defun add-reactors( / ) (vlr-dwg-reactor nil '( (:vlr-beginClose . beginCloseCallback) (:vlr-beginDwgOpen . beginOpenCallback) (:vlr-endDwgOpen . endOpenCallback) (:vlr-beginSave . beginSaveCallback) (:vlr-saveComplete . saveCompleteCallback) ) ) )[/size][/font][/size][/font][font=Arial][size=2][font=Courier New][size=2](defun beginCloseCallback(ro args / ) (princ"\n=====>Aktuelle Zeichnung wird geschlossen") (princ "\nTaste drücken\n") (read-char) (princ) )[/size][/font][/size][/font] [font=Arial][size=2][font=Courier New][size=2] (defun beginOpenCallback(ro args / ) (princ(strcat "\n=====>Zeichnung " (car args) " soll geöffnet werden")) (princ) )[/size][/font][/size][/font] [font=Arial][size=2][font=Courier New][size=2](defun endOpenCallback(ro args / ) (princ(strcat "\n=====>Zeichnung " (car args) " wurde geöffnet")) (princ) )[/size][/font][/size][/font] [font=Arial][size=2][font=Courier New][size=2](defun beginSaveCallback(ro args / ) ;(princ(strcat "\n=====>Aktuelle Zeichnung soll als " (car args) " gespeichert werden")) (princ(type(car args))) (terpri) (princ) )[/size][/font][/size][/font] [font=Arial][size=2][font=Courier New][size=2](defun saveCompleteCallback(ro args / ) ;(princ(strcat "\n=====>Aktuelle Zeichnung wurde als " (car args) " gespeichert")) (princ(type(car args))) (terpri)[/size][/font][/size][/font] [font=Arial][size=2][font=Courier New][size=2] (princ "\nTaste drücken\n") (read-char) (princ) )[/size][/font][/size][/font] [font=Arial][size=2][font=Courier New][size=2]; one shot by load (add-reactors[/size][/font][/size][/font] [/size][/font] Quote Link to comment Share on other sites More sharing options...
wizman Posted March 14, 2009 Share Posted March 14, 2009 make it persistent reactor and make sure callback function is loaded at startapp but when transferring to other pc you'll have to load the callback function first for it to work. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted March 15, 2009 Share Posted March 15, 2009 make it persistent reactor and make sure callback function is loaded at startapp but when transferring to other pc you'll have to load the callback function first for it to work. Wizman, just a quick one - what is the difference between a persistent and transient reactor? Quote Link to comment Share on other sites More sharing options...
wizman Posted March 15, 2009 Share Posted March 15, 2009 Wizman, just a quick one - what is the difference between a persistent and transient reactor? persistent reactors remain in the drawing. a reactor object can be persistent by function (vlr-pers reactor-object). Once persistent the reactor automatically loads itself as it is embedded in the reactor persistent dictionary. so no need for loading it again. transient reactors are the normal default type of reactor which are not anymore functional once drawiing is closed. but the callback functions (the lisp to run on an event) are not loading automatically unless loaded in the startup suite or acaddoc.lsp. I havent seen one callback function that is functional already without the use of starting in starup or (load) function. But may be through xdata, ldata, xrecord or registry to embed the callback. but still a reading function is still missing. but maybe call back function can also be saved and loaded the same way as how the reactor itself was saved in the dict. Maybe someone can give the missing link. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted March 15, 2009 Share Posted March 15, 2009 persistent reactors remain in the drawing. a reactor object can be persistent by function (vlr-pers reactor-object). Once persistent the reactor automatically loads itself as it is embedded in the reactor persistent dictionary. so no need for loading it again. transient reactors are the normal default type of reactor which are not anymore functional once drawiing is closed. but the callback functions (the lisp to run on an event) are not loading automatically unless loaded in the startup suite or acaddoc.lsp. I havent seen one callback function that is functional already without the use of starting in starup or (load) function. But may be through xdata, ldata, xrecord or registry to embed the callback. but still a reading function is still missing. but maybe call back function can also be saved and loaded the same way as how the reactor itself was saved in the dict. Maybe someone can give the missing link. Thanks Wizman for the clarification - intriguing stuff Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.