Finding the right edges for filleting

I was wondering if someone has a smart(er) way for selecting the right brep-edges inside this script. See the attached. I’ve made up some logic in order to select specific edges in my model that need to get rounded. It works for most of it, but it is not very robust. This is part one that consists of 20 modules. Other parts will consist of 38-56 modules each.

The upper part of the script works quite well and will round all ‘small outer edges’ with a radius of 2mm

The lower 2 parts will however try to replace the first and last module, as these need large roundings at the start and end.
The first works:

the second not 100%:

as you can see it misses 1 rounding.

Adding the fillets manually is not an option, at least not in this stage where the design still needs finetuning. To get an idea of the project I am working on see (4.1 MB)

thanks in advance for your help :slight_smile: