Grasshopper Archicad window points for facades

Hello,
I am trying to create a multifacade script which follows a dash pattern to control the distances where the windows should be placed. I have managed to cull and replace with a second and eventually a third window type, and it is working for multiple floors. However, my issue is coming from the fact that my script is unable to stop placement points at the corners of the multiple curves, my script has now started to return unpredictable results where it is placing points at the end of the pattern where i would not like it to. I am unable to understand what is going wrong and how do i fix it. I have made a snippet of the logic for fetching the points to place windows on, i would appreciate some help here. I am attaching the script and screenshots explaining the same. Thanks in advance.

Snippet - placement of windows.gh (16.2 KB)