# Recursion broken?

**URL:** <https://forum.dynamobim.com/t/recursion-broken/999>\
**Category:** Packages\
**Created:** [February 1, 2015, 9:01am UTC](https://forum.dynamobim.com/t/recursion-broken/999 "2015-02-01T09:01:22Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![Renee\_Puusepp](https://avatars.discourse-cdn.com/v4/letter/r/e0b2c6/32.png) [@Renee\_Puusepp](https://forum.dynamobim.com/u/Renee_Puusepp)\
**Post date:** [February 1, 2015, 9:01am UTC](https://forum.dynamobim.com/t/recursion-broken/999/1 "2015-02-01T09:01:22Z")

</div>

Hello,

I’m trying to get recursion with custom nodes going and following the examples [here](http://autodeskvasari.com/profiles/blogs/pt-4-recursive-hill-climbing-optimization-in-dynamo) and [here](http://autodeskvasari.com/forum/topics/recursive-for-loop-using-dynamo-nodes), 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

---

<div class="post-metadata">

**Author:** ![Michael\_Kirschner2](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/michael_kirschner2/32/75576_2.png) [@Michael\_Kirschner2](https://forum.dynamobim.com/u/Michael_Kirschner2)\
**Post date:** [February 1, 2015, 6:21pm UTC](https://forum.dynamobim.com/t/recursion-broken/999/2 "2015-02-01T18:21:40Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Michael\_Kirschner2](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/michael_kirschner2/32/75576_2.png) [@Michael\_Kirschner2](https://forum.dynamobim.com/u/Michael_Kirschner2)\
**Post date:** [February 1, 2015, 7:02pm UTC](https://forum.dynamobim.com/t/recursion-broken/999/3 "2015-02-01T19:02:42Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Ritesh\_Chandawar](https://avatars.discourse-cdn.com/v4/letter/r/f05b48/32.png) [@Ritesh\_Chandawar](https://forum.dynamobim.com/u/Ritesh_Chandawar)\
**Post date:** [February 1, 2015, 9:48pm UTC](https://forum.dynamobim.com/t/recursion-broken/999/4 "2015-02-01T21:48:51Z")

</div>

Hello [Renee Puusepp](http://dynamobim.com/forums/users/renee-puuseppartun-ee/ "View Renee Puusepp's profile"), [Michael Kirschner](http://dynamobim.com/forums/users/michael-kirschnerautodesk-com/ "View Michael Kirschner's profile"),

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

&nbsp;

---

<div class="post-metadata">

**Author:** ![Andreas\_Dieckmann](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/andreas_dieckmann/32/365_2.png) [@Andreas\_Dieckmann](https://forum.dynamobim.com/u/Andreas_Dieckmann)\
**Post date:** [February 2, 2015, 3:25am UTC](https://forum.dynamobim.com/t/recursion-broken/999/5 "2015-02-02T03:25:19Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Renee\_Puusepp](https://avatars.discourse-cdn.com/v4/letter/r/e0b2c6/32.png) [@Renee\_Puusepp](https://forum.dynamobim.com/u/Renee_Puusepp)\
**Post date:** [February 3, 2015, 12:16pm UTC](https://forum.dynamobim.com/t/recursion-broken/999/6 "2015-02-03T12:16:34Z")

</div>

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.

&nbsp;

---

<div class="post-metadata">

**Author:** ![Renee\_Puusepp](https://avatars.discourse-cdn.com/v4/letter/r/e0b2c6/32.png) [@Renee\_Puusepp](https://forum.dynamobim.com/u/Renee_Puusepp)\
**Post date:** [February 11, 2015, 10:45am UTC](https://forum.dynamobim.com/t/recursion-broken/999/7 "2015-02-11T10:45:34Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Ritesh\_Chandawar](https://avatars.discourse-cdn.com/v4/letter/r/f05b48/32.png) [@Ritesh\_Chandawar](https://forum.dynamobim.com/u/Ritesh_Chandawar)\
**Post date:** [February 11, 2015, 9:46pm UTC](https://forum.dynamobim.com/t/recursion-broken/999/8 "2015-02-11T21:46:08Z")

</div>

Hello [Renee Puusepp](http://dynamobim.com/forums/users/renee-puuseppartun-ee/ "View Renee Puusepp's profile"),

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

---

<div class="post-metadata">

**Author:** ![Renee\_Puusepp](https://avatars.discourse-cdn.com/v4/letter/r/e0b2c6/32.png) [@Renee\_Puusepp](https://forum.dynamobim.com/u/Renee_Puusepp)\
**Post date:** [February 16, 2015, 10:17am UTC](https://forum.dynamobim.com/t/recursion-broken/999/9 "2015-02-16T10:17:09Z")

</div>

Hi Ritesh,

Please have a look of the attached graph and custom node. I have followed the example [here](http://autodeskvasari.com/forum/topics/recursive-for-loop-using-dynamo-nodes?page=2&commentId=6375667%3AComment%3A73582&x=1#6375667Comment73582), but newly (15. Feb) installed Dynamo still crashes when running the recursion.dyn. Does it work in your setup?

[recursion](http://dynamobim.com/wp-content/uploads/forum-assets/renee-puuseppartun-ee/02/16/recursion.dyn) [TestNode](http://dynamobim.com/wp-content/uploads/forum-assets/renee-puuseppartun-ee/02/16/TestNode.dyf)

Thanks in advance.

Renee

---

<div class="post-metadata">

**Author:** ![Ritesh\_Chandawar](https://avatars.discourse-cdn.com/v4/letter/r/f05b48/32.png) [@Ritesh\_Chandawar](https://forum.dynamobim.com/u/Ritesh_Chandawar)\
**Post date:** [February 18, 2015, 1:03am UTC](https://forum.dynamobim.com/t/recursion-broken/999/10 "2015-02-18T01:03:56Z")

</div>

Hello [Renee Puusepp](http://dynamobim.com/forums/users/renee-puuseppartun-ee/ "View Renee Puusepp's profile"),

For me its just going in infinite loop.

I have logged issue for internal tracking. MAGN-6365

Thanks,

Ritesh

---

<div class="post-metadata">

**Author:** ![Renee\_Puusepp](https://avatars.discourse-cdn.com/v4/letter/r/e0b2c6/32.png) [@Renee\_Puusepp](https://forum.dynamobim.com/u/Renee_Puusepp)\
**Post date:** [February 26, 2015, 4:06pm UTC](https://forum.dynamobim.com/t/recursion-broken/999/11 "2015-02-26T16:06:48Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Michael\_Kirschner1](https://avatars.discourse-cdn.com/v4/letter/m/46a35a/32.png) [@Michael\_Kirschner1](https://forum.dynamobim.com/u/Michael_Kirschner1)\
**Post date:** [March 3, 2015, 4:25pm UTC](https://forum.dynamobim.com/t/recursion-broken/999/12 "2015-03-03T16:25:26Z")

</div>

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](https://cdck-file-uploads-us1.s3.dualstack.us-west-2.amazonaws.com/flex022/uploads/dynamobim/original/2X/6/67e0d782c83a37a9b70da3770303d985ec57c560.png)

---

<div class="post-metadata">

**Author:** ![Renee\_Puusepp](https://avatars.discourse-cdn.com/v4/letter/r/e0b2c6/32.png) [@Renee\_Puusepp](https://forum.dynamobim.com/u/Renee_Puusepp)\
**Post date:** [March 6, 2015, 10:02am UTC](https://forum.dynamobim.com/t/recursion-broken/999/13 "2015-03-06T10:02:40Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Michael\_Kirschner2](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/michael_kirschner2/32/75576_2.png) [@Michael\_Kirschner2](https://forum.dynamobim.com/u/Michael_Kirschner2)\
**Post date:** [March 7, 2015, 11:01pm UTC](https://forum.dynamobim.com/t/recursion-broken/999/14 "2015-03-07T23:01:10Z")

</div>

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](https://cdck-file-uploads-us1.s3.dualstack.us-west-2.amazonaws.com/flex022/uploads/dynamobim/original/2X/b/b67cedff6ecd3e1d06f9826c38373c3507ec739a.png)

---

<div class="post-metadata">

**Author:** ![David\_Baldacchino1](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/david_baldacchino1/32/31779_2.png) [@David\_Baldacchino1](https://forum.dynamobim.com/u/David_Baldacchino1)\
**Post date:** [March 11, 2015, 7:43pm UTC](https://forum.dynamobim.com/t/recursion-broken/999/15 "2015-03-11T19:43:33Z")

</div>

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 🙂

---

<div class="post-metadata">

**Author:** ![David\_Baldacchino1](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/david_baldacchino1/32/31779_2.png) [@David\_Baldacchino1](https://forum.dynamobim.com/u/David_Baldacchino1)\
**Post date:** [March 11, 2015, 8:30pm UTC](https://forum.dynamobim.com/t/recursion-broken/999/16 "2015-03-11T20:30:23Z")

</div>

Just installed [DynamoInstall0.8.0.20150310T0953.exe](http://dyn-builds-data.s3-us-west-2.amazonaws.com/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.

---

<div class="post-metadata">

**Author:** ![David\_Baldacchino1](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/david_baldacchino1/32/31779_2.png) [@David\_Baldacchino1](https://forum.dynamobim.com/u/David_Baldacchino1)\
**Post date:** [March 11, 2015, 10:44pm UTC](https://forum.dynamobim.com/t/recursion-broken/999/17 "2015-03-11T22:44:39Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Vikram\_Subbaiah](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/vikram_subbaiah/32/50797_2.png) [@Vikram\_Subbaiah](https://forum.dynamobim.com/u/Vikram_Subbaiah)\
**Post date:** [July 8, 2015, 2:28am UTC](https://forum.dynamobim.com/t/recursion-broken/999/18 "2015-07-08T02:28:01Z")

</div>

Am I doing something wrong?

Ver: 0.8.2.1872

File: [SumSeq.dyf](http://dynamobim.com/wp-content/uploads/forum-assets/testingwaters/07/08/SumSeq.dyf)

![20150708-1](http://dynamobim.com/wp-content/uploads/forum-assets/testingwaters/07/08/20150708-1-600x216.jpg)

&nbsp;
