Jump to content

Recommended Posts

Posted

I've got a question, regarding the loading of reactor programs. I'm a little confused as to proper procedure as I know that loading a reactor more than once can cause issues. Here's the situation: We use a third party software called Eagle Point for our civil applications. I have found through many hours of frustration, and experimenting, that Eagle Point doesnt seem to get along with a lot of the programs we have running that fire based on a reactor. However, there are some programs, that I hope dont cause issues, that are vital to our productivity (linking notes so when one is changed, the other linked notes are changed; and automatically switching layers when starting certain commands; are the big ones). When it comes to loading a reactor, currently I am using:

 

[font=Arial](if (not Command_Ending_Reactor)[/font]
 [font=Arial]  (setq    Command_Ending_Reactor[/font]
 [font=Arial]     (vlr-command-reactor[/font]
 [font=Arial]       nil[/font]
 [font=Arial]       '((:vlr-commandended[/font]
 [font=Arial]          .[/font]
 [font=Arial]          Command_Ended_Command[/font]
 [font=Arial]         )[/font]
 [font=Arial]        )[/font]
 [font=Arial]     ) ;_ end of vlr-command-reactor[/font]
 [font=Arial]  ) ;_ end of setq[/font]
 [font=Arial]  () ;_ the reactor is already loaded[/font]
 [font=Arial]) ;_ end of if[/font]
 [font=Arial] [/font]
 

when "not loading a reactor multiple times" is referred to, is it referring to the :vlr-commandended or is it referring to Command_Ending_Reactor? In other words, can I run the following without creating issues:

 

[font=Arial](cond[/font]
 [font=Arial]((and (not Command_Ending_Reactor) (not (member "egpt.exe" (dos_processes))))[/font]
 [font=Arial]  (setq    Command_Ending_Reactor_EP[/font]
 [font=Arial]     (vlr-command-reactor[/font]
 [font=Arial]       nil[/font]
 [font=Arial]       '((:vlr-commandended[/font]
 [font=Arial]          .[/font]
 [font=Arial]          Command_Ended_Command_EP[/font]
 [font=Arial]         )[/font]
 [font=Arial]        )[/font]
 [font=Arial]     ) ;_ end of vlr-command-reactor[/font]
 [font=Arial]  ) ;_ end of setq[/font]
 [font=Arial] (setq    Command_Ending_Reactor_NOEP[/font]
 [font=Arial]      (vlr-command-reactor[/font]
 [font=Arial]        nil[/font]
 [font=Arial]        '((:vlr-commandended[/font]
 [font=Arial]           .[/font]
 [font=Arial]           Command_Ended_Command_NOEP[/font]
 [font=Arial]          )[/font]
 [font=Arial]         )[/font]
 [font=Arial]      ) ;_ end of vlr-command-reactor[/font]
 [font=Arial]   ) ;_ end of setq[/font]
 [font=Arial]) ;_ end of cond1[/font]
 [font=Arial]((and (not Command_Ending_Reactor) (member "egpt.exe" (dos_processes)))[/font]
 [font=Arial]   (setq    Command_Ending_Reactor_EP[/font]
 [font=Arial]      (vlr-command-reactor[/font]
 [font=Arial]        nil[/font]
 [font=Arial]        '((:vlr-commandended[/font]
 [font=Arial]           .[/font]
 [font=Arial]           Command_Ended_Command_EP[/font]
 [font=Arial]          )[/font]
 [font=Arial]         )[/font]
 [font=Arial]      ) ;_ end of vlr-command-reactor[/font]
 [font=Arial]   ) ;_ end of setq[/font]
 [font=Arial] ) ;_ end of cond2[/font]
 [font=Arial]) ;_ end cond[/font]
 [font=Arial] [/font]
 

(the preceding is an untested code, it's more of a psuedo code for example purposes)

Posted

Give this a look, Chris:

 

;;;--------------------------------------------------------------------;
;;; Start reactor function:
(defun Reactors:Command  ()
 ;; CommandCancelled reactor:
 (cond
   (*Reactor_CommandCancelled*)
   ((setq *Reactor_CommandCancelled*
           (vlr-command-reactor
             nil
             '((:vlr-commandCancelled . Callback:CommandEnded))))))
 ;; CommandEnded reactor:
 (cond
   (*Reactor_CommandEnded*)
   ((setq *Reactor_CommandEnded*
           (vlr-command-reactor
             nil
             '((:vlr-commandEnded . Callback:CommandEnded))))))
 ;; CommandFailed reactor:
 (cond
   (*Reactor_CommandFailed*)
   ((setq *Reactor_CommandFailed*
           (vlr-command-reactor
             nil
             '((:vlr-commandFailed . Callback:CommandEnded))))))
 ;; CommandStarted reactor:
 (cond
   (*Reactor_CommandStarted*)
   ((setq *Reactor_CommandStarted*
           (vlr-command-reactor
             nil
             '((:vlr-commandwillstart . Callback:CommandStarted))))))
 (prompt "\n \n  >>  Command Reactors Loaded ")
 (princ)) ;_end defun
;;;--------------------------------------------------------------------;
;; CommandStarted callback function:
(defun Callback:CommandStarted  (Rea Cmd / layerName LayerItem)
 ;; <- Your code here
 (princ))
;;;--------------------------------------------------------------------;
;; CommandEnded callback function:
(defun Callback:CommandEnded  (Rea Cmd)
 ;; <- Your code here
 (princ))
;;;--------------------------------------------------------------------;
(cond
 ((or (vl-string-search "R17.2" *vrsn*)                                ; 2009 LDC
      (vl-string-search "R18.1" *vrsn*))                               ; 2011 C3D
  (Reactors:Command)))
(princ)

 

 

[edit]

I use ACADDOC.lsp to load a compiled .FAS for each user, where our reactors are loaded as shown with the conditional statement toward the bottom.

 

As for the question of loading reactors more than once, I believe even defining a reactor with setq as a different name would potentially pose an issue (i.e., Command_Ending_Reactor, Command_Ending_Reactor2).

 

Instead, the model I use is conditionally based within the Callback function(s), based on the command argument being fed to the callback, to use the above posted example.

 

Hope this helps!

[/edit]

Posted

Renderman,

 

Why not just use one reactor:

 

(defun Reactors:Command nil
 (cond
   ( *Reactor_Command* )
   ( (setq *Reactor_Command*
       (vlr-command-reactor nil
        '(
           (:vlr-commandcancelled . callback:commandended)
           (:vlr-commandended     . callback:commandended)
           (:vlr-commandfailed    . callback:commandended)
           (:vlr-commandwillstart . callback:commandstarted)
         )
       )
     )
   )
 )
 (princ "\n--> Command Reactors Loaded.")
 (princ)
)

 

I usually use reactor data to keep track of reactors however:

 

(defun Reactors:Command ( / reactor )
 (if
   (setq reactor
     (vl-some
       (function
         (lambda ( _reactor )
           (if (eq "Reactor-Command" (vlr-data _reactor)) _reactor)
         )
       )
       (cdar (vlr-reactors :vlr-command-reactor))
     )
   )
   (if (not (vlr-added-p reactor))
     (vlr-add reactor)
   )
   (vlr-command-reactor "Reactor-Command"
     (list
       (cons :vlr-commandcancelled 'callback:commandended)
       (cons :vlr-commandended     'callback:commandended)
       (cons :vlr-commandfailed    'callback:commandended)
       (cons :vlr-commandwillstart 'callback:commandstarted)
     )
   )
 )
 (princ "\n--> Command Reactors Loaded.")
 (princ)
)

 

This way, global variables needn't be involved :)

Posted

As usual Lee, you have a brilliant suggestion that causes me to reconsider something developed last year... all the while I am trying to setup our support structure, and standards for Civil 3D 2011, and backward planning for our transition from Land Desktop to Civil 3D.

 

Thanks for adding to the workload, buddy. lmao :lol:

Posted
Thanks for adding to the workload, buddy. lmao :lol:

 

lol don't feel compelled to implement it...

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...