Author Topic: Reactor Question?  (Read 5503 times)

0 Members and 1 Guest are viewing this topic.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Reactor Question?
« on: December 07, 2006, 05:37:51 PM »
I put this in the acaddoc.lsp expecting it to fire & run the (axl2qt-sub) when the DWG loading
process is finished but it doesn't fire. What did  I miss?


Code: [Select]
;; Set up the Reactor
(if (= (type Quan_Table_Reactor) 'VLR-DWG-Reactor)
  (if (not (vlr-added-p Quan_Table_Reactor))
    (vlr-add Quan_Table_Reactor)
  )
  (setq Quan_Table_Reactor (vlr-dwg-reactor nil '((:vlr-endDwgOpen . axl2qt-rea))))
)

;; call back function
(defun axl2qt-rea (reactor callbackData)
(print "***  Reactor Fired  ***")
  ;;  disable the reactor, only used firt time in DWG
  ;(vlr-remove Quan_Table_Reactor)
  (or axl2qt-sub (load "Excel Read test0010.LSP"))
  (axl2qt-sub) ; call the routine to buid the table.
  (princ)
)
« Last Edit: December 07, 2006, 05:38:53 PM by CAB »
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Reactor Question?
« Reply #1 on: December 07, 2006, 06:20:06 PM »
OK, I got this one to fire when switching between open drawings,
but i want it to fire when the drawing opens for the first time.

Code: [Select]
;; Set up the Reactor
(if (= (type Quan_Table_Reactor) 'VLR-DWG-Reactor)
  (if (not (vlr-added-p Quan_Table_Reactor))
    (vlr-add Quan_Table_Reactor)
  )
  (setq Quan_Table_Reactor (vlr-docmanager-reactor nil '((:vlr-documentBecameCurrent . axl2qt-rea))))
)

;; call back function
(defun axl2qt-rea (reactor callbackData)
  (print "***  Reactor Fired  ***")
  ;;  disable the reactor, only used firt time in DWG
  ;(vlr-remove Quan_Table_Reactor)
  ;(or axl2qt-sub (load "Excel Read test0010.LSP"))
 (test_rea)
  (princ)
)

(defun test_rea ()
  (print " Oh Happy Days.")
  (princ)
)
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Reactor Question?
« Reply #2 on: December 07, 2006, 06:22:52 PM »
I don't think you can Alan, at least not in lisp.  You might have to make a VBA routine.  My logic is, once you open the drawing, it will be active already, before the lisp loads, so it will never fire again until you lose the active'ness of it.  Does that make any sense?
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Reactor Question?
« Reply #3 on: December 07, 2006, 06:31:40 PM »
Yes, but I don't like it.  :oops:
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Reactor Question?
« Reply #4 on: December 07, 2006, 06:32:23 PM »
Yes, but I don't like it.  :oops:
I will do some testing when I can, and see if I can get one to load upon opening.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Reactor Question?
« Reply #5 on: December 07, 2006, 06:37:34 PM »
OK, I found it in one of Luis's codes.

 
Code: [Select]
(setq Quan_Table_Reactor (vlr-docmanager-reactor nil '((:vlr-documentLockModeWillChange . axl2qt-rea))))
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Reactor Question?
« Reply #6 on: December 07, 2006, 06:39:24 PM »
I don't think you will be able to do what you want Alan.  I think you would need to open the drawing once and make the reactor, and then open it again, and then it will fire.  Maybe you can make a 'command will start' reactor for the very first command, and then in the reactor call back, have it remove it, so that it will only fire once per drawing.

Just thinking out loud.

Edit:  I see you found something while I was typing.  Hope it works the way you want it to.
« Last Edit: December 07, 2006, 06:40:58 PM by T.Willey »
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Reactor Question?
« Reply #7 on: December 07, 2006, 07:33:30 PM »
Yes, this works when you put this in the acaddoc.lsp
As soon as the DWG is finished opening it fires.

Code: [Select]
;; Set up the Reactor
(if (= (type Quan_Table_Reactor) 'VLR-DWG-Reactor)
  (if (not (vlr-added-p Quan_Table_Reactor))
    (vlr-add Quan_Table_Reactor)
  )
  (setq Quan_Table_Reactor (vlr-docmanager-reactor nil '((:vlr-documentLockModeWillChange . axl2qt-rea))))
)


;; call back function
(defun axl2qt-rea (reactor callbackData)
(print "***  Reactor Fired  ***")
  ;;  disable the reactor, only used firt time in DWG
  ;(vlr-remove Quan_Table_Reactor)
  ;(or axl2qt-sub (load "Excel Read test0010.LSP"))
 ; (axl2qt-sub) ; call the routine to buid the table.
 (test_rea)
  (princ)
)

(defun test_rea ()
  (print " Oh Happy Days.\n")
  (princ)
)

PS: Hold on, still has problem. Will advise.
« Last Edit: December 07, 2006, 07:54:00 PM by CAB »
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Reactor Question?
« Reply #8 on: December 07, 2006, 08:09:19 PM »
Well with this version it fires 3 times during the open process.

Code: [Select]
;; Set up the Reactor
(if (= (type Quan_Table_Reactor) 'vlr-dwg-reactor)
  (if (not (vlr-added-p Quan_Table_Reactor))
    (vlr-add Quan_Table_Reactor)
  )
  (setq Quan_Table_Reactor
         (vlr-docmanager-reactor
           nil
           '((:vlr-documentlockmodewillchange . axl2qt-rea))
         )
  )
)


;; call back function
(defun axl2qt-rea (reactor callbackData)
  (print "***  Reactor Fired  ***")
  ;;  disable the reactor, only used firt time in DWG
  ;; (vlr-remove Quan_Table_Reactor)
  ;(or axl2qt-sub (load "Excel Read test0010.LSP"))
  ;(axl2qt-sub) ; call the routine to buid the table.
  (princ)
)


Quote
CDG Change Case loaded - type "CDGCASE" to run
Command:
CDG Purge 3.0 loaded
"CDGPURGE" - dialog interface
"-CDGPURGE" - command line interface
Command:
AutoCAD Express Tools Copyright © 2000 Autodesk, Inc.

Offset Loaded. Enter OFS to run.
SlideDisplay.LSP for AutoCAD is loaded.
To view a slide one of the following commands:
WCS=Window Call Sizes VSF=Fraction/Decimal Chart
   <<Ignored AutoCAD 2005 Variable List>>
   <<Ignored AutoCAD 2004 Variable List>>
   <<Ignored AutoCAD 2002 Variable List>>
   <<Ignored AutoCAD 2000i Variable List>>
ACADSet_Variables has set system variables to your preset values.
AutoCAD menu utilities loaded.
AutoCAD menu utilities loaded.  DDMODIFY loaded.
CDG Change Case loaded - type "CDGCASE" to run
CDG Purge 3.0 loaded
"CDGPURGE" - dialog interface
"-CDGPURGE" - command line interface
"***  Reactor Fired  ***"
Command:
"***  Reactor Fired  ***"
DOSLib Version 6.1.4 (Feb 12 2004)
Copyright © 1992-2004, Robert McNeel & Associates

Plot2000 - www.plot2000.com
Plot2000 loaded. Commands are: PLOT2000CONFIG, BATCHPLOT, OKTEST!

Command:
"***  Reactor Fired  ***" *Cancel*
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Chris

  • Swamp Rat
  • Posts: 548
Re: Reactor Question?
« Reply #9 on: December 08, 2006, 07:17:30 AM »
Alan,
I have no Idea what the command is that fires to produce this line
Code: [Select]
Autodesk DWG.  This file is a Trusted DWG last saved by an Autodesk application or Autodesk licensed application.

but it appears to always be the last thing done before control is returned to the reducer.  If it can be determined what this command is, you can issue a commandended reactor to fire axl2qt.  I will try looking into it and see if I can find anything.  Maybe someone else knows what command is being called.
Christopher T. Cowgill, P.E.
AEC Collection 2020 (C3D)
Win 10

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Reactor Question?
« Reply #10 on: December 08, 2006, 07:55:24 AM »
Thanks Chris and welcome to the Swamp. :-)
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

kpblc

  • Bull Frog
  • Posts: 396
Re: Reactor Question?
« Reply #11 on: December 08, 2006, 08:59:56 AM »
Can be, try to load a reactor not in acaddoc.lsp, and into a separate file which and to load automatically?
Sorry for my English.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Reactor Question?
« Reply #12 on: December 08, 2006, 09:36:38 AM »
Well it didn't like that. 8-)
I put the file in the "startup suite"

Quote
"CDGPURGE" - dialog interface
"-CDGPURGE" - command line interface
Command:
"***  Reactor Fired  ***"
"***  Reactor Fired  ***"

"***  Reactor Fired  ***"
"***  Reactor Fired  ***" Command:
"***  Reactor Fired  ***"
"***  Reactor Fired  ***"
"***  Reactor Fired  ***"
"***  Reactor Fired  ***"
"***  Reactor Fired  ***"
"***  Reactor Fired  ***"
"***  Reactor Fired  ***"
"***  Reactor Fired  ***"
"***  Reactor Fired  ***"
"***  Reactor Fired  ***"
AutoCAD Express Tools Copyright © 2000 Autodesk, Inc.

Offset Loaded. Enter OFS to run.
SlideDisplay.LSP for AutoCAD is loaded.
To view a slide one of the following commands:
WCS=Window Call Sizes VSF=Fraction/Decimal Chart
   <<Ignored AutoCAD 2005 Variable List>>
   <<Ignored AutoCAD 2004 Variable List>>
   <<Ignored AutoCAD 2002 Variable List>>
   <<Ignored AutoCAD 2000i Variable List>>
"***  Reactor Fired  ***"
"***  Reactor Fired  ***"
"***  Reactor Fired  ***"
"***  Reactor Fired  ***"
"***  Reactor Fired  ***"
"***  Reactor Fired  ***"
"***  Reactor Fired  ***"
"***  Reactor Fired  ***"
"***  Reactor Fired  ***"
"***  Reactor Fired  ***"
"***  Reactor Fired  ***"
"***  Reactor Fired  ***"
"***  Reactor Fired  ***"
"***  Reactor Fired  ***"
"***  Reactor Fired  ***"
"***  Reactor Fired  ***"
"***  Reactor Fired  ***"
"***  Reactor Fired  ***"
"***  Reactor Fired  ***"
"***  Reactor Fired  ***"
"***  Reactor Fired  ***"
"***  Reactor Fired  ***"
"***  Reactor Fired  ***"
"***  Reactor Fired  ***"
"***  Reactor Fired  ***"
"***  Reactor Fired  ***"
"***  Reactor Fired  ***"
"***  Reactor Fired  ***"
"***  Reactor Fired  ***"
"***  Reactor Fired  ***"
"***  Reactor Fired  ***"
"***  Reactor Fired  ***"
"***  Reactor Fired  ***"
"***  Reactor Fired  ***"
"***  Reactor Fired  ***"
"***  Reactor Fired  ***"
"***  Reactor Fired  ***"
"***  Reactor Fired  ***"
"***  Reactor Fired  ***"
"***  Reactor Fired  ***"
"***  Reactor Fired  ***"
"***  Reactor Fired  ***"
ACADSet_Variables has set system variables to your preset values.
AutoCAD menu utilities loaded.
AutoCAD menu utilities loaded.  DDMODIFY loaded.
CDG Change Case loaded - type "CDGCASE" to run
CDG Purge 3.0 loaded
"CDGPURGE" - dialog interface
"-CDGPURGE" - command line interface
"***  Reactor Fired  ***"
"***  Reactor Fired  ***"
Command:
"***  Reactor Fired  ***"
"***  Reactor Fired  ***"
DOSLib Version 6.1.4 (Feb 12 2004)
Copyright © 1992-2004, Robert McNeel & Associates

Plot2000 - www.plot2000.com
Plot2000 loaded. Commands are: PLOT2000CONFIG, BATCHPLOT, OKTEST!

Command:
"***  Reactor Fired  ***"
« Last Edit: December 08, 2006, 09:38:08 AM by CAB »
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Reactor Question?
« Reply #13 on: December 08, 2006, 10:39:44 AM »
Well thanks to Chris who came up with the reactor that worked.
I can now move on to finding out what you can & can not do in a call back routine. :)

Code: [Select]
;; Set up the Reactor
(if (= (type Quan_Table_Reactor) 'vlr-dwg-reactor)
  (if (not (vlr-added-p Quan_Table_Reactor))
    (vlr-add Quan_Table_Reactor)
  )
  (setq Quan_Table_Reactor
         (vlr-docmanager-reactor
           nil
           '((:vlr-documentToBeActivated  . axl2qt-rea))
         )
  )
)


;; call back function
(defun axl2qt-rea (reactor callbackData)
  (print "***  Reactor Fired  ***")
  ;;  disable the reactor, only used firt time in DWG
  (vlr-remove Quan_Table_Reactor)
  ;(axl2qt-sub) ; call the routine to buid the table.
  (princ)
)
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Reactor Question?
« Reply #14 on: December 08, 2006, 11:11:37 AM »
I can now move on to finding out what you can & can not do in a call back routine. :)
From what I remember, no calls to 'command' whatever, and no asking for user input.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

LE

  • Guest
Re: Reactor Question?
« Reply #15 on: December 08, 2006, 12:52:59 PM »
Alan;

Do you have your routine under control?

One question, if you want to generate a TABLE everytime a drawing is opened, why not do by a simple call in the acad.mnl ie: (load "mytable.lsp" nil) -

Anyway I did a little test here, with some of my code and it works without any error.


Let me know if I can help.

Chris

  • Swamp Rat
  • Posts: 548
Re: Reactor Question?
« Reply #16 on: December 08, 2006, 01:02:12 PM »
in vanilla AutoCAD the table is created fine even without the reactor, when we use a thirdparty software to open the drawing, the program no longer creates the table, it errors out, when using the reactor it spits back an error - invalid AutoCAD Command
Christopher T. Cowgill, P.E.
AEC Collection 2020 (C3D)
Win 10

LE

  • Guest
Re: Reactor Question?
« Reply #17 on: December 08, 2006, 01:13:25 PM »
Alan;

Do you have your routine under control?

One question, if you want to generate a TABLE everytime a drawing is opened, why not do by a simple call in the acad.mnl ie: (load "mytable.lsp" nil) -

Anyway I did a little test here, with some of my code and it works without any error.


Let me know if I can help.

Something I noticed using a2007 this error message:

Command:
Adding the table...; error: Automation Error. AutoCAD main window is invisible

When going from one drawing to another (this is a new message for me)

OK, I just need to add the removal of the reactor in there....

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Reactor Question?
« Reply #18 on: December 08, 2006, 02:10:20 PM »
Let me see if I can explain the process.
When ACAD is started without EaglePoint there is no problem with the lisp. It can be run from the StartUp Suite
or from acaddoc.lsp of via the reactor shown here.

But the desired way to use the drawing is to start EaglePoint first & then have it start ACAD with the drawing needed.
In this scenario something EaglePoint does makes the access to Excel imposable until the "Open Process" is completely
finished. So using the acaddoc or StartUp Suite or a reactor that fires before the OPEN is finished will still conflict
with EaglePoint control. I don't know why EaglePoing is preventing the opening of a spread sheet.

This line returns nil during the EaglePoint start up.
Code: [Select]
(setq objXLApplication (vlax-Get-Or-Create-Object "Excel.Application"))It works fine once the drawing is Open & EaglePoing is still running.
We have tried this as well
Code: [Select]
(setq objXLApplication (vlax-Create-Object "Excel.Application"))
Even the MNL file is loaded before the Drawing is finished Opening.

I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

LE

  • Guest
Re: Reactor Question?
« Reply #19 on: December 08, 2006, 02:53:51 PM »
I see...

Does not doslib have a wait for end process function in there?.... and wait for that app to finish, and from that phase... do your mojo?


All I did in the past about vlisp reactors, I think I have posted here.... these days I do not use them anymore.


Have fun.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Reactor Question?
« Reply #20 on: December 08, 2006, 03:05:05 PM »
Thank you Sir. :-)
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.