Recursion broken?

Hello,

I’m trying to get recursion with custom nodes going and following the examples here and here, but Dynamo/Revit keeps crashing. Is this my setup or has anyone else experienced the problem? I have the latest release 0.7.5.3566 installed.

Thanks,

Renee

Hi Renee, that first sample is mine, try rebuilding it with the scopeIf node, with Dynamo .7x and greater you need to use that node for recursion base case. Make sure that the false and true branches share no common data. Let me know if you need more info.

I just tried to recreate the first link with scope if and had trouble, there may be something wrong with this node at the moment, will check back if I find out.

Hello Renee Puusepp, Michael Kirschner,

There are some regressions in Recursion, we are fixing it.

Will let you know once they are back in action.

Sorry for the inconvenience.

Thanks,

Ritesh

 

As a workaround, you can build a recursive function in a Python node that will call itself until a certain condition is met.

Hi Ritesh, looking forward to the fix. Recursion is one of the core functionalities in Dynamo for building simulations.

Thanks for the suggestion, Andreas. Will give it a go.

 

Hi Ritesh, any news on the recursion fix yet? Thanks

Hello Renee Puusepp,

Sorry for the late reply.

I think we have already fixed that, can you please try this in Daily Build.

Or you can send me your graph to me and I will let you know whether that is fixed or not.

Thanks,

Ritesh

Hi Ritesh,

Please have a look of the attached graph and custom node. I have followed the example here, but newly (15. Feb) installed Dynamo still crashes when running the recursion.dyn. Does it work in your setup?

recursion TestNode

Thanks in advance.

Renee

Hello Renee Puusepp,

For me its just going in infinite loop.

I have logged issue for internal tracking. MAGN-6365

Thanks,

Ritesh

Hi Ritesh,

Thanks for doing this - I appreciate your help! Is the recursion broken in general or does it get stuck in an infinite loop because of the way the script was built? If it is the latter case, would you be able to post a working example?

Best,

Renee

apparently this is a function of how the scopeIF node works, and recursion will actually function if you setup the graph correctly, I have not had time to test, but try this:

try changing the recursive addition to occur before the if node as part of the true branch, would love to know if you can get this working

change

Hi Michael, thanks for the suggestion. I cannot see the whole definition from the image, but it does not seem to work. I tried several ways and Dynamo keeps crashing on recursive nodes. Looks like I have to shelve the idea for a while. Back to GH for now.

Hi Renee,

I just tested your nodes, they seem to work fine when I use scopeIF instead of IF, your recursive graph never returns any results of the recursion though and only returns the 0 at the end when your test is finally false. We need some way to store the recursive results in the parameters that are passed.

we can do it by passing it a list, and continually shortening the list, each time creating a new recursive call with the item we’ve removed, when the recursion bubbles up we get all the sum of all calls.

This node if created exactly should work, make sure to use ScopeIF - just built this on the latest daily, goodluck, let me know if you have any problems

Screen Shot 2015-03-07 at 11.23.45 PM

UGH! That’s why my recursive nodes aren’t working, thanks for posting this tidbit. I was tearing what little hair I have left thinking I’m doing something wrong, and all along it’s been broken functionality. Using ScopeIf repairs the issue, even though to be honest, I have no clue what the difference between If and ScopeIf is :slight_smile:

Just installed DynamoInstall0.8.0.20150310T0953.exe and it’s still broken. And the custom node that worked in 0.7.5 with ScopeIf is now returning nulls instead of strings. Back to the stable version…

BTW the upgrade wasn’t smooth when it comes to custom nodes. I opened a previous workspace and it grabbed a definition from somewhere other than the definitions folder in the roaming profile. I had to re-copy the node manually to the 0.8 roaming profile, restart, re-insert and delete the old node. Search is extremely slow too but I did notice some nice features, like custom nodes within .dyf colored in red, which makes them easier to spot.

Found the problem…the Revit nodes were completely gone so I rolled back one version and it seems to be working better. “If” node still doesn’t work in a recursive node.

Am I doing something wrong?

Ver: 0.8.2.1872

File: SumSeq.dyf

20150708-1