Transaction Manager - (for end user) - Access undo history w/ revit api

Transaction Manager - (for end user) - Access undo history w/ revit api

EATREVITPOOPCAD
Collaborator Collaborator
888 Views
2 Replies
Message 1 of 3

Transaction Manager - (for end user) - Access undo history w/ revit api

EATREVITPOOPCAD
Collaborator
Collaborator

I found a few older posts saying this is not possible with Revit API, wondering if it is still the case

 

I want to create an Undo History similar to that off History Brush in Photoshop. Basically user can see a window of all the actions to undo to, and can select one instead of clicking undo a trillion times...

 

Would be even cooler if you could choose an individual transaction user did 5 transactions ago and just undo it while leaving other ones remaining...

 

Is this doable? Seems easy since all changes to the model are packed into transactions, and they are clearly stored somewhere since Undo works. The only thing that is needed is access to that history and the ability to roll back that change (a pretty big ask lol)

 

 

The definition of insanity is doing the same thing over and over again and expecting different results
0 Likes
889 Views
2 Replies
Replies (2)
Message 2 of 3

RPTHOMAS108
Mentor
Mentor

Undo is in the PostableCommand enum so I assume it can be posted. The difficulty would be to retrigger it i.e. how do you post it multiple times (posting happens after Revit returns from the API context).

 

DocumentChangedEventArgs has the member GetTransactionNames. So all such would have to be stored in a stack based on IsCancelled or not. Would also need to be modified based on undos and redos.

 

I think the API doesn't really interact at the level you need for this.

 

The current undo UI button allows you to drag cursor down to a given step, can only go back so far in practical terms. Modifications by IUpdaters don't even require transactions (although changes may be linked to the transaction that triggered them perhaps).

 

 

Message 3 of 3

EATREVITPOOPCAD
Collaborator
Collaborator

I see... sounds really easy 😅 Thank you for explaining the different pieces

The definition of insanity is doing the same thing over and over again and expecting different results
0 Likes