I have a collection of intersecting lines that visually represent a grid, and I’m looking for a strategy to get grid cells (closed polylines) from them.

I’ve already sorted the lines into vertical and horizontal ones, in consecutive order.
The strategy will be part of a bigger Python script, however I’m open to any suggestion (even vanilla Grasshopper ones).
It would also be great, if this would be feasible without recurring to expansive surface divisions (if at all possible).

I don’t understand what you mean by strategy ; if you mean sorting cells in x or y direction you can do that by sorting points
And finding cells from lines you can use split surface or Heteroptera region

@HS_Kim, thank you! The VB script works great. Now, i only need to translate it to Python. It’s gonna be a challenge though, since I don’t know much about VB.

@ebe, @seghierkhaled, and @jaymezd, thanks, but I explicitly asked for a strategy that doesn’t involve costly surface operations, like splitting.
Furthermore, third-party components don’t really help me in this case, since I need to be able to reproduce/reverse-engineer the whole process, in order to integrate it into a more extensive Python script.
Great recommendations though, guys! Mayhap somebody else will find this useful someday.

@DanielPiker, thanks for the link. I’ll check it out. @seghierkhaled, thanks for all the time you spend on this. Which plugin has the curve middle component?