Recursive Loop

Hello,

I’m using a button as a switch switch toggles a c# component output to true. The true output triggers a Ladybug calculation, when the calculation has been done and a value is calculated, it is stored and the condition in the toggle is set to false which outputs false and ends calculation. Well, this doesn’t work ofc, but I’m struggling to find a way around this. Any tips?

You would normally do recursion with Anemone or by placing your C# variables outside the scope of the definition - but it’s unclear what you’re actually doing with the stored data to require recursion? Are you reusing it in the loop at any point?

I have different models to choose from for the calculation and instead of using a toggle, I just want to trigger the calculation for selected model and then be able to select another model, and trigger the calculation. There’s going to be a lot of other calculation as well (embodied carbon etc..) and having to toggle all the calculations off/on every time before and after selecting model isn’t what I’m aiming for. That’s also why I want to store the values when the calculation has been done for the specific model to see which models that already been calculated. But maybe I need to use Anemone for this or this is simply not possible

I see - I wonder if LB Dump Data might be more useful here than recursion so you can save the simulations outside of Gh entirely and pull them back in if they prove useful - although might also be worth posting on the LB forums for a more graceful solution https://discourse.ladybug.tools/