# Diagonal on a triangular grid (lunchbox)

hello guys, sorry this might be a very simple question but still learning the basics for GH and having some dumb issues.

So I used a lunchbox plugin to grate a triangular grid… I wanted to get the diagonals and select one of them. As far as I was able to accomplish i could get all the diagonals of the grid with the mesh edges component (also from lunchbox). but when I try to select one of the diagonals with the list item I get only a piece of the diagonal. Tried to join the curves but still get only a part of the diagonal. I want to select the entire line of only one diagonal… is that possible?

you could do it also with native components:
file:option.gh (8.1 KB)

or with relative item

hi Baris, thank you for your answer. I tried to apply to a more complex surface and it worked well. Even though I was wondering if I could get a pattern like the lunchbox component does ( if you notice, to create the triangles we need all lines: both diagonal and both orthogonal lines - vertical and horizontal). I was trying to get the triangles without the vertical. However, if i just ignore the vertical lines I get triangles and also diamond shapes (which I don’t want). I tried to find the intersection points between the 2 diagonals but I have no clue how to connect these points in the direction I want to create a grid similar to what the lunchbox component does.

Thank you again

this worked well on a plane surface but when I applied to a more complex geometry the code get messed up… I believe because of the vectors get in various directions… do you think your solution could be applied to a more rounded and tri-dimensional shape?

Thank you again!

like this?

Hi Baris, thank you again

and yes just like this, but I wish I could select one diagonal from the pattern. I am almost there but there is only one problem with the diagonals created… I get this weird discontinuity even my surface being continuous…

What do you want, lines or surfaces?
The disc is becuase of the missing triangles.
If you want just polylines you could do it this way:

It may be a little different from what you want, but check it out.
You’ll need to change the tolerance setting for every different cases…

SortVectors_reV2.gh (45.6 KB)

2 Likes

I was recently working on a component to do something along these lines…(no pun intended). There are quite a few methods, (as listed in above posts), for getting the desired diagonal lines. I think it becomes an even more interesting challenge when you need to get the surfaces/faces that would follow a a similar form. This takes a stab at getting the surface “strips” that would follow those lines. It’s not ready for release/distribution yet but this is the general idea. Resulting “strips” are all developable, meaning they can be unrolled using a variety of existing plug-ins. (kangaroo’s unroller component). Preview of basic functionality is below.

1 Like

this is amazing HS_Kim ! It works so well I am still trying to undertand the code deeply but as far as I know this is what I was looking for! Thank you very very much!

By the way, do you think I could generate the triangular surfaces with this? I am trying to create the surfaces with lines or maybe mashing them but still cant seem to figure it out.

Thank you