Transaction

I want to understand the proces of transactions and I want to depend as little as possible on packages and therefore want to replace the passthrough node with transaction start and end.

How should I alter this:

Thanks

Transactions and Passthroughs aren’t always interchangeable.

Dynamo executes all its logic “at once” and then passes that on to Revit as a single transaction by default. A passthrough node is just a simple logic gate that ensures that two inputs exist before passing one of them on to a new argument - effectively forcing one part of a graph to finish running before another part starts. That result is still sent to Revit as single transaction.

A transaction is just a single “operation” in Revit. In your case, your Dynamo logic creates a new project parameter and then assigns a value to that parameter. The problem is that the parameter won’t actually exist in Revit until the transaction completes and therefore you wouldn’t be able to write a value to it in the same transaction. You would need one transaction to add the parameter to Revit and a second one to modify the value.

So in your case, you actually need both a transaction and a passthrough. The transaction would come directly before or after the passthrough to ensure that the parameter is created and present in the model before writing to it.

Additionally: You can very easily create your own passthrough node with a code block. In fact, if you edit the custom node you’re using I bet it’s just an embedded code block itself.

4 Likes

Great!..I’ve changed the passthrough node with a code block and it seams to be working.


The transaction part is still a bit confusing as I’ve only added the transaction.end node and the code is working fine without the transaction.start node.

In fact… I don’t need the transaction nodes at all, as everything seems to work fine without them.

You typically don’t need both transaction nodes as there’s always one running. So either node will end the current transaction and start a new one.

The CreateProjectParameter node may have an internal transaction. Or, if you’ve ran this graph multiple times already, the parameter may already exist.

1 Like