Jump to content

Reactor on File Opened !?


chavlji

Recommended Posts

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]

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 :)

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...