Tool didn't work properly with a large number of elements

Hi guys, I created a tool to add insulation for elements according to the rules. I accidentally discovered that when running for a small view, the tool works well, but when running for a larger view (a large number of elements), some elements are insulated at the wrong thickness. I found the wrong elements and created a small 3D view containing only them, and when I ran the tool again, it was correct. Has anyone encountered a similar situation? Besides this tool, I have also encountered a situation where when running for a small view it is correct but when running for a large view it is wrong when using other tools.

I’ve never ever had the API make changes to the wrong elements.
Could you share some of your code? I think it might be a bug in your code.
I’m curious to see what you’ve done.