# Create a Mesh with vertices

If I have a list of vectors. Then how can I create a mesh out of it using the vectors as vertices?

I don't wan't to create a mesh before that exactly matches the vertices count to the one of the vector list.

To give an example, a mesh existing of vertices from this vector list: • Please show a Blender screen capture to show your work and clarify. I do not understand the second sentence. Perhaps others do. – atomicbezierslinger Apr 16 '16 at 19:43

AN allows you to manipulate meshes with the Mesh Object OuputNode. It takes Mesh Data as input and in order to get mesh data from vectors (vector list), you have to call the Combine Mesh DataNode. Take the vertex location list (vector list) that you need and connect it to the input of the combine mesh data. Then Choose an object to copy the data to or create a target by clicking the +button. The thing is this node setup will only create the vertices in the mesh, and no faces. Why is that? Because you didn't give the AN enough information to create edges and faces. How should it know which vertex to connect with which one if you don't say it explicitly? This is why there are two more inputs to the Object Mesh Data Node. Edge Indices and Polygon Indices.

Unlike the vertex locations, these inputs are a little bit more difficult to understand. In order to know how to fill these intputs and get a whole mesh, let's see what the vertex location is. If you are familiar with any programmation language, you should be familiar with the concept of lists. If not, a list has got elements in there, (here 3D vectors). And to access these element in the list, each of the vector has an index. The first point will have the index 0, etc. You can figure this out by selecting the node which outputs the vector list and hit W and then debug. If your list has 5 elements, the first is going to be 0: V("x", "y", "z") and the last one 4: V("x", "y", "z").

Now let's go into the edge indices: as we have seen it's just a way to connect two vertices. Edge indices is a list, so it is also going to have elements and indices. Each element is a list (a tuple if you are familiar with python or programmation) saying which index of the vector list is connected to which one. For example if you want to have one edge connecting the second and third vertex, the element is going to be 0: (1, 2). The 0 is the index of the edge (there is only one), the one is the index AN uses to access the second vertex and to connect it to the vertex of index 2 (the third).

The same principe applies to the polygon index list. I think the polygon indices select the vertices to create the faces, and not the edges

So now how do you create these lists in order to say the AN how to create the mesh? You can use the create edge indices list and create edge indices nodes. From there you can set each connexion between each point.

for the polygon indices, call the create polygon indices list, and create polygon indices.

If you don't want to become crazy with all these indices, you can take the edge and polygon indices of a basemesh (ex: base_cube). Just make sure your target has the same amount of vertices than the mesh you use to copy the indices. 