Undo/Redo vb.net


#1

Hi,

Is it possible to change a public property before the command actually runs?

Hoped I could use:

  AddHandler Rhino.Commands.Command.UndoRedo, AddressOf undo


 Private Function undo(ByVal sender As Object, ByVal e As Rhino.Commands.UndoRedoEventArgs)
    MsgBox("undo")

    Return Rhino.Commands.Result.Success
End Function

but this runs at every undoredo added and not when Undo is used.

Can someone help me?


#2

using this now:

   AddHandler Rhino.Commands.Command.BeginCommand, AddressOf startofcommand
   AddHandler Rhino.Commands.Command.EndCommand, AddressOf endofcommand


Private Function startofcommand(ByVal sender As Object, ByVal e As Rhino.Commands.CommandEventArgs)

              'change command
    Return Rhino.Commands.Result.Success
End Function

Private Function endofcommand(ByVal sender As Object, ByVal e As Rhino.Commands.CommandEventArgs)

  'change command

    Return Rhino.Commands.Result.Success
End Function

Works for all commands. Even better for me :slight_smile:

  • Jordy

(Dale Fugier) #3

So is there still a question here, or are you good?


#4

No questions. Got it figured out. Thanks for asking :slight_smile:


#5

Got a question again.

Some of my commands do a lot automatic. But if I undo I sometimes have to undo 3-4 times to get back to before I used the command. Is it possible the undo them all at the same time again?

I know I can do this with:

-_runscript(
new sub blablabla
rhino.command(“mycommand”)
end sub
blablabla
)

But got the feeling there is an easier solution.
Any suggestions?