Generate Closed Curves from Grid

Hi guys,

I have been having some trouble figuring this one out. I am trying to generate closed polygons out of these polylines that generate a grid. The polylines are like a zig-zag. (yellow)

I have tried quite somethings that failed miserably, so what I ended up doing was creating the boundary surface and splitting it (baked). Not ideal because it’s slow.

Thanks in advance for any help in speeding up my code.

Diagonal (14.4 KB)

first you need to explode the polylines (grid + polylines = bad thing). Eliminate any duplicates. Be sure that all lines are connected. Build a list with nodes (vertices). Build a list with beams (edges). As you have a unweighted undirected graph, build connectivity. Run some freaky algo to find the panels (faces).
You may need code to solve this problem.


This might not always be a solution, but in this case (i.e. lines to quads) you could use Weaverbird's Mesh From Lines: (12.2 KB)

I spent a lot of time on this without being really sure what you wanted, but that’s my problem. I first created the pattern on a square grid and then mapped to a surface like yours. Maybe you’ll find something of value.

Diagonal Grid (15.2 KB)

Hi, thanks for the input. I don’t believe the problem is that complex. It can actually be reduced to a regular smaller grid. The way the lines are organized, one can easily select the lines that need to be duplicated and the ones that don’t. The problem now is merging these two lists so that there are 4 lines in each branch and the join is done properly. (14.1 KB)

Yes, that pretty much it. Thank you.

Then I would need to organize the curves again, but that could be done with a point inside curve component.

Just the closed polygons. I think you mentioned something similar to what Anders suggested before deleting your post. But thank you still.
You think maybe changing something from the way the geometry is generated I could end up with closed polygons from the start? I doubt it but it could be. I still think joining these shouldn’t be that complicated.