chuongmep
(Chuong Ho)
1
Hi team, can I know any issue with this code ? I have some confuse with example from team.
I’m try create some mesh but it not show
List<Base> baseMeshes = new List<Base>();
// Triangle 1
var vertices = new List<double> { 0, 0, 0, 1, 0, 0, 0, 1, 0, };
var faces = new List<int> { 0, 1, 2,};
// Append Triangle 2 vertices
vertices = new List<double> { 0, 0, 0, 0, 0, 1, 1, 1, 0 } ;
faces = new List<int> { 3, 4, 5, } ;
Objects.Geometry.Mesh baseMesh = new Objects.Geometry.Mesh( vertices, faces );
baseMeshes.Add( baseMesh );
string streamId = "db5902deb6";
// send list baseMeshes to speckle
Base data = new Base();
data["@baseMeshes"] = baseMeshes;
Console.WriteLine("Done with Send Data To Speckle");
string send = await Helpers.Send(streamId, data, "test").ConfigureAwait(false);
Any help apprecitate
jonathon
(Jonathon)
2
Your Faces list needs to be fomulated differently.
for Vertices [ 0,0,0, 1,0,2, 3,3,3 ... ]
should have a Faces of [ 3, 0, 3, 6 ... ]
to break that down the set of four figures
n, V1, V2, V3
= number of vertices for the face followed by the starting index for each vertex X, Y Z
so for a quad face:
[ 4, 0, 3, 6, 9 ]
1 Like
chuongmep
(Chuong Ho)
3
Thank for quick help, I guess it must easier :
List<Base> baseMeshes = new List<Base>();
// Triangle 1
var vertices1 = new List<double> { 0, 0, 0, 1, 0, 0, 0, 1, 0 };
var faces1 = new List<int> { 0, 1, 2 };
// Triangle 2
var vertices2 = new List<double> { 0, 0, 0, 0, 0, 1, 1, 1, 0 };
var faces2 = new List<int> { 3, 4, 5 };
Objects.Geometry.Mesh baseMesh1 = new Objects.Geometry.Mesh(vertices1, faces1);
Objects.Geometry.Mesh baseMesh2 = new Objects.Geometry.Mesh(vertices2, faces2);
baseMeshes.Add(baseMesh1);
baseMeshes.Add(baseMesh2);
string streamId = "db5902deb6";
// send list baseMeshes to speckle
Base data = new Base();
data["@baseMeshes"] = baseMeshes;
Console.WriteLine("Done with Send Data To Speckle");
string send = await Helpers.Send(streamId, data, "test").ConfigureAwait(false);
jonathon
(Jonathon)
4
It is still your faces array that needs work.
// Triangle 1
var vertices1 = new List<double> { 0, 0, 0, 1, 0, 0, 0, 1, 0 };
var faces1 = new List<int> { 3, 0, 3, 6 };
// Triangle 2
var vertices2 = new List<double> { 0, 0, 0, 0, 0, 1, 1, 1, 0 };
var faces2 = new List<int> { 3, 0, 3, 6 };
1 Like
chuongmep
(Chuong Ho)
5
Thank you @jonathon , Now I understand the meaning now.
1 Like