I’m currently trying to send some models saved as json files to Speckle via the API, but I’m having some trouble creating surfaces.
It’s straight forward enough to create a stream, create Point objects, and push these up to the stream, with the “Value” field given as xyz cordinates. However, I’m not sure how to create a surface defined by a set of points, or how to create a “zone” defined by a set of surfaces.
The SpeckleMesh object takes in a flattened list of the vertices as an array in the vertices field and then takes in the topology of the faces as such:
The first entry is ‘0’ for triangles or ‘1’ for quads
The next three/four entries is the index of the vertices.
For example, this would create a simple square out of triangles:
I just noticed that when using the quads flag, the mesh is still constructed of triangles based on the order you specify (vertices 0, 1, 2 make up first triangle & vertices 1, 2, 3 make up the second), which means your example doesn’t make a solid rectangular surface but rather this kind of thing: