# How to divide a triangle in a square mesh?

Hi! I’m a beginner on grasshopper, and I wonder how to do a trick…

I want to subdivide a triangle in a squared mesh. And be able to specify the length of the squares.
I would like to make something like that, taking one of the edge of the triangle as a base for the squared mesh… Any idea?

Thanks a lot!

Hey,

try this.
Note: it should be developed further for obtuse triangles.

3Square.gh (11.6 KB)

Or this, if you meant a “mesh” mesh, instead of grid as i initially asumed.
I am sure some mesh experts on forum can do it better.

3Square_2.gh (18.9 KB)

or this…

Hey Jakinta,

Thanks a lot for that!! Appreciate your help
Well… I’m really a beginner on GH so I’m a bit lost.
Maybe it’s because I don’t have the last version (only the one for r5) but it doesn’t work for me…

For the first one, I have a single dimension array like that:

When I load the second one, some of the elements are red or orange, even if I install the user object of Mesh+

Anyway, I was talking about a mesh grid in order to use the curves afterwards to represent a metal squared grid, so it can be polysurface, not necessary a mesh “mesh” !
And actually, yes I would like to trim the squares at the end so we see only the squares within the triangle surface and not outside. (like you did on the last test), but would like to avoid having some small triangles in the border squares… only squares and trimmed squares!

thanks again!
S.

GENIUS
It works. Thanks a lot!!!
I don’t understand anything about all the stuffs, but I hope I will learn soon!
all the best, and thanks again
S.