public static Topography ToSpeckle(this TopographySurface mySurface) { var speckleTopo = new Topography(); speckleTopo.Vertices = new List <double>(); speckleTopo.Faces = new List <int>(); var geom = mySurface.get_Geometry(new Options()); foreach (var element in geom) { if (element is Mesh) { var mesh = ( Mesh )element; foreach (var vert in mesh.Vertices) { speckleTopo.Vertices.AddRange(new double[] { vert.X / Scale, vert.Y / Scale, vert.Z / Scale }); } for (int i = 0; i < mesh.NumTriangles; i++) { var triangle = mesh.get_Triangle(i); var A = triangle.get_Index(0); var B = triangle.get_Index(1); var C = triangle.get_Index(2); speckleTopo.Faces.Add(0); speckleTopo.Faces.AddRange(new int[] { ( int )A, ( int )B, ( int )C }); } } } speckleTopo.parameters = GetElementParams(mySurface); speckleTopo.typeParameters = GetElementTypeParams(mySurface); speckleTopo.ApplicationId = mySurface.UniqueId; speckleTopo.elementId = mySurface.Id.ToString(); speckleTopo.GenerateHash(); return(speckleTopo); }