Guys,
I’m confused why I get different results when using a Custom Node.
Here is my script.
The script presents 3 ways to select elements by Assembly Code
option1: use Nodes to select
option2: use Nodes with Python to select
option3: use a Custom Node with used nodes as in option1
I’ve tried to count element by running the script in Dynamo windows
Then I copied some elements and run it again.
It gives a wrong answer when working with custom node when running in Dynamo windows.
But it gives the right answer when running in Dynamo Player
In my script i’m only counting elements.
Counting elements fails when i copy elements before i start the script again in Dynamo windows.
Is 'transaction end’ and ‘transaction start’ still necessary?
But I will give it a try.
How did you create the custom node? Dynamo does not always translate it correctly or mixes things up. I would suggest that you go into the edit window of the custom node and check it by yourself for errors. Had the same issue several times especially when the nodes that where hand over to a custom node where wired quite complicated.
The custom node works… the counting is alway correct via Dynamo Player. But it’s not always correct when running in Dynamo window when the model (=database) is changed.
Then it should have something to do with the fact that dynamo does not always reruns every node. For example:
You import data from an excel file and calculate something and everything works fine. If you now change something in the excel-file it won’t affect your calculations in dynamo as it won’t rerun the import. Only if you close dynamo, change the filepath or disconnect->run->connect->run it will consider the changes.
It’s because Dynamo player starts a new session of Dynamo every run. If you have Dynamo open, run your graph, make changes in Revit, then run the same graph again without closing/reopening then you could have element binding issues or just outdated data. It’s technically working as intended, it’s just that you haven’t given Dynamo a chance to update its information.
You have a few options for avoiding this:
Close and reopen between runs. This is the tried and true method that should always work.
Disconnect something at the beginning of your graph and run once with your graph (presumably) failing. This is to cause a change that will force Dynamo to reevaluate all the nodes. Then just reconnect and run again.
Make a change to an early node rather than completely disconnecting. Replacing a node (even with the exact same data) should also work. This is the same idea as Option 2, to force a reevaluation of nodes.