# Node editor Hexagon

I currently have the Maths expressions addon installed in blender. I know it has a hexagon preset already, but it comes up with this:

1) How do I fix this?

2) How do I make a hexagon?

• It looks as though, somewhere, your/the generated expression is trying to access the 4th element of a list of size 3. In the mean time, there's a hand-rolled version here – Robin Betts Mar 1 at 4:57

It works by splitting the radial angle into (sides) angular regions, each region with shading-point values from (-pi/sides) to (pi/sides), and multiplying the cosine of those values with the distance from the UV origin. If the result is put through a threshold (the color ramp), it produces a polygon with sides sides.
For the sake of illustration, I've plugged the Pass Index of the plane objects into the sides input. That's where you would enter 6 for a hexagon.