Beispiel #1
0
        /***************************************************/
        /****               Public Methods              ****/
        /***************************************************/

        public static oM.Geometry.Mesh MeshFromRevit(this Mesh mesh)
        {
            if (mesh == null)
            {
                return(null);
            }

            oM.Geometry.Mesh bHoMMesh = new oM.Geometry.Mesh {
                Vertices = mesh.Vertices.Select(x => x.PointFromRevit()).ToList()
            };
            for (int i = 0; i < mesh.NumTriangles; i++)
            {
                bHoMMesh.Faces.Add(mesh.get_Triangle(i).FromRevit());
            }

            return(bHoMMesh);
        }
Beispiel #2
0
        /***************************************************/

        public static oM.Geometry.Mesh MeshFromRevit(this Curve curve)
        {
            if (curve == null)
            {
                return(null);
            }

            List <XYZ> vertices = curve.Tessellate().ToList();

            oM.Geometry.Mesh mesh = new oM.Geometry.Mesh {
                Vertices = vertices.Select(x => x.PointFromRevit()).ToList()
            };
            for (int i = 0; i < vertices.Count - 1; i++)
            {
                mesh.Faces.Add(new oM.Geometry.Face {
                    A = i, B = i + 1, C = i + 1
                });
            }

            return(mesh);
        }