TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: andrew_nao on March 01, 2012, 09:08:50 AM

Title: a reactor to do stuff AFTER dwg is opened...
Post by: andrew_nao on March 01, 2012, 09:08:50 AM
i want to bypass the acaddoc and the mnl files
which is why im posting this strange request.

thanks
Title: Re: a reactor to do stuff AFTER dwg is opened...
Post by: Lee Mac on March 01, 2012, 10:08:30 AM
Look into a vlr-editor-reactor used with either the :vlr-begindwgopen, :vlr-enddwgopen, or :vlr-dwgfileopened events.
Title: Re: a reactor to do stuff AFTER dwg is opened...
Post by: andrew_nao on March 01, 2012, 11:08:43 AM
Look into a vlr-editor-reactor used with either the :vlr-begindwgopen, :vlr-enddwgopen, or :vlr-dwgfileopened events.

you are like the yoda of lisp code...
when i grow up i want to be just like you!  :laugh:

thanks man
here is what i came up with, how does it loook? it works too
Code: [Select]
(vlr-editor-reactor nil '((:vlr-dwgfileopened . startscreenstock)))
(defun startscreenstock ()
(ostkbk)

)
Title: Re: a reactor to do stuff AFTER dwg is opened...
Post by: Lee Mac on March 01, 2012, 01:33:18 PM
you are like the yoda of lisp code...
when i grow up i want to be just like you!  :laugh:

lol errm.. thanks  :lol:

here is what i came up with, how does it loook? it works too
Code: [Select]
(vlr-editor-reactor nil '((:vlr-dwgfileopened . startscreenstock)))
(defun startscreenstock ()
(ostkbk)

)

Assuming that your function 'ostkbk' is compatible for use in a reactor callback (i.e. no use of 'command' calls), then I would make the following minor adjustments to ensure you don't create multiple reactors, also the reactor callback requires a number of arguments equal to the number of Event parameters, plus the calling reactor itself:

Code - Auto/Visual Lisp: [Select]
  1. (if (null *editor-reactor*)
  2.     (setq *editor-reactor* (vlr-editor-reactor nil '((:vlr-dwgfileopened . startscreenstock))))
  3. )
  4. (defun startscreenstock ( reactor params )
  5.     (ostkbk)
  6.     (princ)
  7. )

Untested code however.
Title: Re: a reactor to do stuff AFTER dwg is opened...
Post by: alanjt on March 01, 2012, 04:24:44 PM
You want to bypass startup routines and use a reactor. I'm curious, how are you going to load the reactor?
Title: Re: a reactor to do stuff AFTER dwg is opened...
Post by: andrew_nao on March 02, 2012, 08:43:24 AM
You want to bypass startup routines and use a reactor. I'm curious, how are you going to load the reactor?

through my startup routine...  im having problems with my openddcl code thats supposed to load with my acaddoc and its causing my autocad to crash to desktop so loading it this way, while it really shouldnt be like this, makes it work and not crash me :)
Title: Re: a reactor to do stuff AFTER dwg is opened...
Post by: andrew_nao on March 02, 2012, 08:49:43 AM
Assuming that your function 'ostkbk' is compatible for use in a reactor callback (i.e. no use of 'command' calls), then I would make the following minor adjustments to ensure you don't create multiple reactors, also the reactor callback requires a number of arguments equal to the number of Event parameters, plus the calling reactor itself:

Code - Auto/Visual Lisp: [Select]
  1. (if (null *editor-reactor*)
  2.     (setq *editor-reactor* (vlr-editor-reactor nil '((:vlr-dwgfileopened . startscreenstock))))
  3. )
  4. (defun startscreenstock ( reactor params )
  5.     (ostkbk)
  6.     (princ)
  7. )

Untested code however.

too few arguments... it has something to do with the ( reactor params ) part, if thats removed it works.

what am i missing?
Title: Re: a reactor to do stuff AFTER dwg is opened...
Post by: irneb on March 03, 2012, 06:35:51 AM
through my startup routine...  im having problems with my openddcl code thats supposed to load with my acaddoc and its causing my autocad to crash to desktop so loading it this way, while it really shouldnt be like this, makes it work and not crash me :)
Have you tried figuring out why OpenDCL is crashing your acad? Have you tried asking on their forums? I know that the AutoLoading only happens close to the time when the command-prompt becomes available, so perhaps just move your code into S::Startup. Or try to force load the "correct" OpenDCL ARX in your code and disregard the autoloader.

I think you might have better luck by trying to fix the issue rather than jumping through reactive hoops in order to side-step it. And even if you get your DWG opened reactor working, that would still not guarantee that the ODCL problem has somehow evaporated.
Title: Re: a reactor to do stuff AFTER dwg is opened...
Post by: BlackBox on March 03, 2012, 02:12:31 PM
FWIW - more on Startup Sequence here:

http://www.theswamp.org/index.php?topic=39112.msg443213#msg443213
Title: Re: a reactor to do stuff AFTER dwg is opened...
Post by: andrew_nao on March 05, 2012, 07:50:09 AM
through my startup routine...  im having problems with my openddcl code thats supposed to load with my acaddoc and its causing my autocad to crash to desktop so loading it this way, while it really shouldnt be like this, makes it work and not crash me :)
Have you tried figuring out why OpenDCL is crashing your acad? Have you tried asking on their forums? I know that the AutoLoading only happens close to the time when the command-prompt becomes available, so perhaps just move your code into S::Startup. Or try to force load the "correct" OpenDCL ARX in your code and disregard the autoloader.

I think you might have better luck by trying to fix the issue rather than jumping through reactive hoops in order to side-step it. And even if you get your DWG opened reactor working, that would still not guarantee that the ODCL problem has somehow evaporated.

the problem still remains with my odcl issue, but untill im certain its something on the odcl side with the active document option or my coding im just trying to find ways to debug it without having to rewrite the code. (its alot of code)