Author Topic: UNDO command in vlisp  (Read 2095 times)

0 Members and 1 Guest are viewing this topic.

Lupo76

  • Bull Frog
  • Posts: 343
UNDO command in vlisp
« on: February 22, 2015, 12:17:15 PM »
Hello everyone,
I need to use the following code within a reactor
Code: [Select]
(command "_undo" "1")

Unfortunately this is not possible in a reactor.
I then tried with

Code: [Select]
(vl-cmdf "_undo" "1")
but also in this case does not work: no error but does not perform the operation.

Do you have any idea?

Marc'Antonio Alessi

  • Swamp Rat
  • Posts: 1454
  • Marco
Re: UNDO command in vlisp
« Reply #1 on: February 22, 2015, 01:13:21 PM »
Maybe (vlr-undo-reactor data callbacks)?

Lupo76

  • Bull Frog
  • Posts: 343
Re: UNDO command in vlisp
« Reply #2 on: February 23, 2015, 02:50:50 AM »
Maybe (vlr-undo-reactor data callbacks)?

I read here: http://help.autodesk.com/view/ACD/2015/ENU/?guid=GUID-184F011B-8B61-4D3F-82F3-06A75C4459AE

but I did not understand how to use it.
I suspect that is not what I need.

I have made a reactor object:

Code: [Select]
(defun reactor_endmodify (notifier-reactor object-object parameter-list)
    (if (and (= (getvar "CMDNAMES") "BREAK")(= var T))
       (progn
           (princ "\nDo not use the command 'BREAK' but use the command 'XXX'")
           (command "_undo" "1") ;<-----ERROR !!!!
       )
       (progn
          ......
          ......
          ......
       )
     )
)


This reactor has many lines of code and in some circumstances intercepts the start of the BREAK command and issues a message such as "Do not use the command 'BREAK' but use the command 'XXX'. This message should not appear every time it is used BREAK command but only in certain circumstances. To explain all the context is a bit difficult ....

Now I would like to use the UNDO command to cancel the operation of the BREAK command.

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: UNDO command in vlisp
« Reply #3 on: February 23, 2015, 04:08:17 AM »

Lupo76

  • Bull Frog
  • Posts: 343
Re: UNDO command in vlisp
« Reply #4 on: February 23, 2015, 04:27:29 AM »
Try using a postprocess:
http://www.theswamp.org/index.php?topic=42826.5

Very Well!
the post that you indicated was open to me, but at that time I did not realize 100% anyway.
Today, however, is much clearer for me and it works!  :lol:

Thank You

Lupo76

  • Bull Frog
  • Posts: 343
Re: UNDO command in vlisp
« Reply #5 on: February 23, 2015, 04:32:28 AM »
Here is the correct code:

(vla-sendcommand (vla-get-activedocument (vlax-get-acad-object)) "_.undo 1 ")