Author Topic: Cancelling command with reactor...  (Read 2417 times)

0 Members and 1 Guest are viewing this topic.

Andrea

  • Water Moccasin
  • Posts: 2372
Cancelling command with reactor...
« on: November 20, 2006, 10:01:48 AM »
Hi all...

can anyone know how to cancel any command with reactor ?

(CANCELCOMMANDHERE)

Code: [Select]
(defun loadTreactor ()
(vl-load-com)
(vlr-command-reactor nil '((:vlr-commandWillStart . startTCommand)))
)

(defun startTCommand (calling-reactor startcommandInfo)
(if (nth 0 startcommandInfo) (CANCELCOMMANDHERE)))

(loadTreactor)

??

Or if you have any other suggestion.....i'll take it !  :roll:
Keep smile...

Patrick_35

  • Guest
Re: Cancelling command with reactor...
« Reply #1 on: November 20, 2006, 10:58:34 AM »
Salut

You can use
:vlr-commandCancelled --> An AutoCAD command has been canceled. 
:vlr-commandFailed --> An AutoCAD command failed to complete.
 
@+

Andrea

  • Water Moccasin
  • Posts: 2372
Re: Cancelling command with reactor...
« Reply #2 on: November 20, 2006, 11:16:11 AM »
i've tried...

but not working PAt..
maybe i don't know how to.. :|
Keep smile...

Patrick_35

  • Guest
Re: Cancelling command with reactor...
« Reply #3 on: November 20, 2006, 11:40:15 AM »
An example

Code: [Select]
(defun CancelCommand (Rea Cde)
  (alert (strcat "Command Cancelled --> " (car Cde)))
)

(setq a (vlr-command-reactor nil (list (cons :vlr-commandCancelled (function CancelCommand)))))

Use any commands ....

And for removing reactor
Code: [Select]
(vlr-remove a)
@+

Andrea

  • Water Moccasin
  • Posts: 2372
Re: Cancelling command with reactor...
« Reply #4 on: November 20, 2006, 12:13:06 PM »
Thanks PAT..

But is not realy what I'm looking for....

I need to cancel all command...or
unable all command..or
desactive all command...or
return NIL all command...or..... :-o

the code you posted...run someting AFTER the command was ENDED or FAILED....
but I need to run somthing AFTER the command was DETECTED to cancel this current command.

so was thinking that  (:vlr-commandWillStart.....) can be the job..

The..
Code: [Select]
(defun CancelCommand (Rea Cde)
(exit);(alert (strcat "Command Cancelled --> " (car Cde)))
)

(setq a (vlr-command-reactor nil (list (cons :vlr-commandWillStart (function CancelCommand)))))

  not seem to work...it call the (exit) before starting the command.

« Last Edit: November 20, 2006, 12:25:20 PM by Andrea »
Keep smile...

Patrick_35

  • Guest
Re: Cancelling command with reactor...
« Reply #5 on: November 20, 2006, 03:50:41 PM »
The cancel work during the command. Not at the beginning and at the end
Besides this solution to intercept a cancel, I don't see the solution and I don't think that a willstart will give the solution. Nothing stopped an reactor, at least I found this solution yet  :?

@+

LUCAS

  • Newt
  • Posts: 32

Andrea

  • Water Moccasin
  • Posts: 2372
Re: Cancelling command with reactor...
« Reply #7 on: November 21, 2006, 08:58:38 AM »
thanks LUCAS....but

can anyone tell me why this code load VBA module ?
Code: [Select]
(vla-eval (vlax-get-acad-object)
(strcat "Sendkeys \"{ESC}\"")
)

Keep smile...

Andrea

  • Water Moccasin
  • Posts: 2372
Re: Cancelling command with reactor...
« Reply #8 on: November 21, 2006, 09:20:37 AM »
OK....i found something...

Code: [Select]
(command "_line")
(vla-sendcommand
(vla-get-activedocument (vlax-get-acad-object))
"(command) "))

Keep smile...