Gradient circle packing with obstacles

Hi there,

I’m trying to do circle packing with a gradient in circle size with smaller circles towards the edges and some obstacles on my mesh.

I’m currently doing it using the kangaroo step solver and a loop, with the idea that the radii of the circles are updated before the solver takes them to circle pack. However I think something is wrong with my loop:

It seems to change the radii once more after it’s finished with the packing, leaving me with the following result with a lot of overlaps:

I managed to find a fix if I force the solver to perform one more step by adding this expression and only connecting it after the loop has already finished.

Which leads to the result I want:

I would like to skip this last manual step, so I tried connecting the addition before starting the loop, but it breaks it completely as seen here:

Does someone know what I’m doing wrong here? Any help would be greatly appreciated.

The files I used are these:
CirclePackingGradient.3dm (80.8 KB) (37.2 KB)