Troubleshooting a circle pack definition

A little embarrassed to ask for help, I’ve been modifying this script I made from two found scripts for about a year now. I use it regularly on my CNC/design job for perforating material.

It circle packs a defined shape (surface) with a set number of circles of random sizes, with a set offset between the circles.

I’d like to fix an issue that allows me to add circles but not remove them without resetting the script. Also, I’d like to make the offset a random range as well, so some circles will nest closer than others, more organically.

Can anyone give me any tips or know of a more complete script that does this? What I really like about this one is the pushing feature, I can add more circles or increase overall circle scale until circles jitter around too much and pop up, giving a tight pack.

circle pack (41.2 KB)