Hi Aniket.
Thank you for your positive feedback and for your quick reply. Currently I do not have the 2023R1 version, but I am glad to know that there is a solution in the future version. In the meantime, the hint of using the centroid is super useful.
I will proceed to update my script and kudos for you too :).
Cheers,
Ramiro