Do one step Back

Who nows how i can back one step using api
image

Careful - from a Dynamo standpoint, that’s some dark magic you’re poking.

6 Likes

Hmm… i want to say one…
how i can use it?:laughing:

Custom Python code or a zero touch node will be the only way to attempt this.

Reason it’s dark magic is because of how it will function with Dynamo itself. Manage your transactions carefully.

How well would this work considering running Dynamo is an action and undoing the action could undo this current Dynamo script? Can I expect a time paradox leading to a black hole?

3 Likes

TIME AS WE KNOW IT WILL CEASE TO BE AND ALL THINGS WILL HAPPEN AT ONCE!

Seriously though, if the transaction isn’t managed this could behave in fun ways.

3 Likes


May be its possible only using ribbonPanel (Buttons)?
but how do undo operation
using JacobSmall s link
https://apidocs.co/apps/revit/2016/d5c8c31a-3b69-48c0-feac-b176a54e7934.htm
i cant understand

Another idea - > using KeyPress operation “Ctrl+Z” , but exist next problem -> detect this press inside of Revit only (not inside another opened programms)

Why do you want to do this? It would be better to manage the logic in Dynamo to not require the undo. Is there a particular reason you have to undo?

A better way of doing it perhaps (although haven’t tested in dynamo, not sure how the transaction manager would react) would be via the API and using the Transaction.Rollback method. This allows revit to perform a transaction and when it has completed all code within, it rolls back the changes. This is done usually when error handling, or if conditions aren’t met then revert. It is also used to get around some holes in the API where performing an action (Like delete or group) can give you guaranteed pointer to some elements. For example, getting sketch lines for slabs can be done by getting all sketch lines, deleting the slab, finding which sketch lines are missing and rolling back the delete. You are then left with the sketch lines you need.

Drawback is that you have to code all that you want to rollback in Python or C#.

3 Likes