Author Topic: a reactor to do stuff AFTER dwg is opened...  (Read 4170 times)

0 Members and 1 Guest are viewing this topic.

andrew_nao

  • Guest
a reactor to do stuff AFTER dwg is opened...
« 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

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: a reactor to do stuff AFTER dwg is opened...
« Reply #1 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.

andrew_nao

  • Guest
Re: a reactor to do stuff AFTER dwg is opened...
« Reply #2 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)

)

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: a reactor to do stuff AFTER dwg is opened...
« Reply #3 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.

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: a reactor to do stuff AFTER dwg is opened...
« Reply #4 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?
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

andrew_nao

  • Guest
Re: a reactor to do stuff AFTER dwg is opened...
« Reply #5 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 :)

andrew_nao

  • Guest
Re: a reactor to do stuff AFTER dwg is opened...
« Reply #6 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?

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: a reactor to do stuff AFTER dwg is opened...
« Reply #7 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.
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.

BlackBox

  • King Gator
  • Posts: 3770
Re: a reactor to do stuff AFTER dwg is opened...
« Reply #8 on: March 03, 2012, 02:12:31 PM »
"How we think determines what we do, and what we do determines what we get."

andrew_nao

  • Guest
Re: a reactor to do stuff AFTER dwg is opened...
« Reply #9 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)