public static BHG.Mesh FromSpeckle(this SCG.SpeckleMesh speckleMesh) { List <BHG.Point> vertices = speckleMesh.Vertices.ToPoints(); List <int> sfaces = speckleMesh.Faces; List <BHG.Face> faces = new List <BHG.Face>(); for (int i = 0; i < sfaces.Count;) { if (sfaces[i] == 1) // triangle face { faces.Add(new BHG.Face { A = sfaces[i + 1], B = sfaces[i + 2], C = sfaces[i + 3], D = -1 }); i = i + 4; } if (sfaces[i] == 0) // quad face { faces.Add(new BHG.Face { A = sfaces[i + 1], B = sfaces[i + 2], C = sfaces[i + 3], D = sfaces[i + 4] }); i = i + 5; } } return(new BHG.Mesh { Vertices = vertices, Faces = faces }); }
public SpeckleBrep(object rawData, string provenance, SpeckleMesh displayValue, string applicationId = null, Dictionary <string, object> properties = null) { this.RawData = rawData; this.Provenance = provenance; this.DisplayValue = displayValue; this.ApplicationId = applicationId; this.Properties = properties; GenerateHash(); }