# How can I make a 3D model out of a set of vertices, UVs and faces using a script?

I have 1 UV .png, and 3 numpy arrays that I will describe below:

• Vertices: An array that has many triplet float values eg. [1.1, 2.1, 3.1]
• Faces: An array that has many sextuplet integer values. eg. [4, 5, 6, 7, 8, 9]
• UVs: An array that has many doublet float values. eg. [1.1,2.1]

I am very new to Blender and 3D modeling so bear with me with my speculation.

I think that the values in the Faces array are possibly indexes that somehow map the UV values to the vertices.

What I wonder is whether if this is a common format with which 3d models are represented with, and how to parse it. If the faces are to represent indexes, why are there 6 of them instead of 5? How could I possibly parse this information into a 3D model?

To put my question more succintly, how would one go about parsing all of this data and turning it into a 3d model in blender using a python script?

• 6 verts per face implies the faces are hexagons. In the text editor > templates > python  menu check out add new object re making a mesh from verts and faces based on their indices. There is also a UV example re assigning UV's on a per face loop vertex basis. eg if you have 10 faces will have 10 x 6 (u, v) coordinates – batFINGER Nov 17 '19 at 4:03
• This is very useful. I must follow up with this question though. My data apparently has 4 big sub-arrays of faces. Meaning there are 4 distinct sub-arrays in the faces array that all contain integer sextuplets. What could the meaning of this be? 4 different face types? In addition to this, the Faces Array has indexes that surpass the indexes of the vertices array, whereasin all of Faces array's indexes are within the range of the UV array. If the Faces array is to represent a mapping of faces using point indexes in the vertices array, how can these out-of-bounds values be explained away? – Lanky Panky Nov 17 '19 at 15:29