I’m trying to add a series of polygons to a mesh. I have defined `num_pts`

and `num_poly`

(around 87 in full) but get an error message I don’t understand when trying to add polygons from two predefined arrays of points, `points1[ ]`

and `points2[ ]`

I believe the points are valid: before trying to make faces, I was able to draw and display `curves`

in a component from the points arrays.

To simplify things, I only ran from `i = 0 to 5`

, but there are 87 or 88 entries in `points1 and points2`

arrays, respectively. `num_slices1`

is defined earlier, and is 87.

```
#### Now we have the points, create a polygon mesh to add faces
num_pts = 2 * (num_slices1 + 1)
num_poly = num_slices1 + 1
mesh = Geom::PolygonMesh.new num_pts, num_poly
i = 0
while i < 5 do
mesh.add_polygon points1[i], points2[i], points2[i+1], points1[i+1]
i += 1
end
ellipse_comp.definition.add_faces_from_mesh mesh
```

When run, this gives the error:

`Error: #<ArgumentError: point index -9000 out of range> /Users/JohnWMcC/Downloads/RiverArch/RiverArch eliipses drawing.rb:154:in`

add_polygon’

/Users/JohnWMcC/Downloads/RiverArch/RiverArch eliipses drawing.rb:154:in `<top (required`

Why is the `point index`

negative?

PS. I have just realised that the above code doesn’t close the polygon, but this does, and still gives the same error.

```
mesh.add_polygon points1[i], points2[i], points2[i+1],
points1[i+1], points1[i]
```

And when I try again with just the first face of points, hard coded, like this:

```
puts "#{points1[0]}, #{points2[0]}, #{points2[1]}, #{points1[1]}, #{points1[0]}"
mesh.add_polygon points1[0], points2[0], points2[1], points1[1], points1[0]
```

this outputs (from the puts statement)

`[-9000.0, 0.0, 0.0], [-9150.0, 0.0, 0.0], [-9149.419144427724, 24.0, 120.0], [-8999.412225704702, 24.0, 120.0], [-9000.0, 0.0, 0.0]`

and gives the same error message.

I see that the first value `points1[0]`

is -9000 (inches) - why is this being treated as a point_index?

PPS: Should I just be iterating through each individual point to add, one at a time, using `add_point`

?