Can I use ctrl+z only once?

Can I use ctrl+z only once?

klkl12234
Advocate Advocate
345 Views
1 Reply
Message 1 of 2

Can I use ctrl+z only once?

klkl12234
Advocate
Advocate

HI, I have to try 10 ctrl+z.
I want a rollback with one ctrl+z.
Will it be possible?

 

public ExternalEvent m_ExEvent { get; set; }
public ExternalEvent m_ExEvent2 { get; set; }
public ExternalEvent m_ExEvent3 { get; set; }
public ExternalEvent m_ExEvent4 { get; set; }
public ExternalEvent m_ExEvent5 { get; set; }
public ExternalEvent m_ExEvent6 { get; set; }

private void Button_Click(object sender, RoutedEventArgs e)
{
m_ExEvent.Raise();
m_ExEvent2.Raise();
m_ExEvent3.Raise();
m_ExEvent5.Raise();
m_ExEvent2.Raise();
m_ExEvent4.Raise();
m_ExEvent3.Raise();
m_ExEvent5.Raise();
m_ExEvent2.Raise();
m_ExEvent6.Raise();
}

 

0 Likes
Accepted solutions (1)
346 Views
1 Reply
Reply (1)
Message 2 of 2

Omar_Amen
Advocate
Advocate
Accepted solution

Hi @klkl12234,
In my opinion it's possible to discard your (n) actions with only one [undo action],
first of all, the [undo action] in the Revit API can be achieved by :
   -Rollback a transaction (recommended)
   -Using the undo postable command
but these ways undo just one transaction/action, so to achieve the (n) actions undo you need to group/wrap your external events single transactions into one big transaction group,
 so if the transaction group is rolled back, all the inner, already committed transactions will be undone (and removed).

but if you just want to crate an (magic undo button add-in), I think it's not possible to undo (n) actions that you didn't execute by your add-in because they are not wrapped in one transaction group container, 
then all you can do is to use the undo postable command once as I think you can't use it more than one time per command (or maybe there is a workaround to use it n times)
anyways I hope this may help you
good luck

0 Likes