Strategy to turn a grid of lines into a grid of cells?

Hi folks,

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).

lines_to_grid_cells.gh (15.4 KB)

Thanks. :slight_smile:

Dave Stasiuk provided a nice vb script for line network in this rescent topic.


lines_to_grid_cells_re.gh (16.3 KB)

2 Likes

Pufferfish has a nice tool for it.

image

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

1 Like

Heteroptera Geometric Region does exactly what you want, if you’re ok with using plug-ins.

lines_to_grid_cells.gh (15.6 KB)

1 Like

@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. :star_struck:

@ebe, @anon39580149, 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. :slight_smile:

2 Likes

This is another method

lines_to_grid_cells2.gh (26.6 KB)

1 Like

Is this discussion relevant?

1 Like

2nd method , the two methods about finding the centers of polygons than the 4 closest points

lines_to_grid_cells3.gh (40.5 KB)

1 Like

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

I don’t think it is a plugin, it appeared in the curve analysis weeks ago, if you don’t have it use point on curve

1 Like

Where does it go? Could you post a screenshot please?

aw

LOL, no, I mean in the definition, since it’s missing somewhere!

Ok i don’t understand you

lines_to_grid_cells3.gh (43.0 KB)

1 Like

Thanks.

1 Like