当前位置: 首页>>代码示例>>C#>>正文


C# Autodesk.get_Triangle方法代码示例

本文整理汇总了C#中Autodesk.get_Triangle方法的典型用法代码示例。如果您正苦于以下问题:C# Autodesk.get_Triangle方法的具体用法?C# Autodesk.get_Triangle怎么用?C# Autodesk.get_Triangle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Autodesk的用法示例。


在下文中一共展示了Autodesk.get_Triangle方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: PushMesh

        public static void PushMesh(Autodesk.Revit.DB.Mesh mesh, IRenderPackage package)
        {
            for (var i = 0; i < mesh.NumTriangles; i++)
            {
                var triangle = mesh.get_Triangle(i);
                for (var j = 0; j < 3; j++)
                {
                    var xyz = triangle.get_Vertex(j);
                    package.PushTriangleVertex(xyz.X, xyz.Y, xyz.Z);
                }

                var a = mesh.get_Triangle(i).get_Vertex(1).Subtract(mesh.get_Triangle(i).get_Vertex(0)).Normalize();
                var b = mesh.get_Triangle(i).get_Vertex(2).Subtract(mesh.get_Triangle(i).get_Vertex(0)).Normalize();
                var norm = a.CrossProduct(b);
                package.PushTriangleVertexNormal(norm.X, norm.Y, norm.Z);
                package.PushTriangleVertexNormal(norm.X, norm.Y, norm.Z);
                package.PushTriangleVertexNormal(norm.X, norm.Y, norm.Z);
            }
        }
开发者ID:RobertiF,项目名称:Dynamo,代码行数:19,代码来源:GraphicsManager.cs

示例2: RevitMeshToHelixMesh

        // must return an array to make mesh double sided
        public static Mesh3D[] RevitMeshToHelixMesh(Autodesk.Revit.DB.Mesh rmesh)
        {
            List<int> indices_front = new List<int>();
            List<int> indices_back = new List<int>();
            List<Point3D> vertices = new List<Point3D>();

            for (int i = 0; i < rmesh.NumTriangles; ++i)
            {
                MeshTriangle tri = rmesh.get_Triangle(i);

                for (int k = 0; k < 3; ++k)
                {
                    Point3D new_point = RevitPointToWindowsPoint(tri.get_Vertex(k));

                    bool new_point_exists = false;
                    for (int l = 0; l < vertices.Count; ++l)
                    {
                        Point3D p = vertices[l];
                        if ((p.X == new_point.X) && (p.Y == new_point.Y) && (p.Z == new_point.Z))
                        {
                            indices_front.Add(l);
                            new_point_exists = true;
                            break;
                        }
                    }

                    if (new_point_exists)
                        continue;

                    indices_front.Add(vertices.Count);
                    vertices.Add(new_point);
                }

                int a = indices_front[indices_front.Count - 3];
                int b = indices_front[indices_front.Count - 2];
                int c = indices_front[indices_front.Count - 1];

                indices_back.Add(c);
                indices_back.Add(b);
                indices_back.Add(a);
            }

            List<Mesh3D> meshes = new List<Mesh3D>();
            meshes.Add(new Mesh3D(vertices, indices_front));
            meshes.Add(new Mesh3D(vertices, indices_back));

            return meshes.ToArray();
        }
开发者ID:epeter61,项目名称:Dynamo,代码行数:49,代码来源:dynRevitTransactionNode.cs

示例3: TriangulateTopoMesh

        //function processing the meash
        public void TriangulateTopoMesh(Autodesk.Revit.DB.Mesh vMesh)
        {
            //setup utility class
            LuxExporter.UnitConverter Converter = new UnitConverter();

            // set pointer
            Data.NumberOfVerticesinFace = 3;

            //export all triangles
            for (int i = 0; i < vMesh.NumTriangles; i++)
            {
                //increase face counter
                iNumberOfFaces++;

                //create a triangle
                MeshTriangle objTriangular = vMesh.get_Triangle(i);

                //calculate normal of triangle
                LuxExporter.NormalOfTriangle NormalofT = new NormalOfTriangle();
                XYZ NormalAtPoint =  NormalofT.calcNormal(objTriangular.get_Vertex(0), objTriangular.get_Vertex(1), objTriangular.get_Vertex(2));

                for (int iPointsCounter = 0; iPointsCounter < 3; iPointsCounter++)
                {
                    XYZ point = objTriangular.get_Vertex(iPointsCounter);
                    //convert to meter
                    point = Converter.ConvertPointCoordToMeter(point);
                    //add to ply class
                    Data.AddVertice(point, NormalAtPoint);
               }
            }
        }
开发者ID:jchristel,项目名称:LuxExporter,代码行数:32,代码来源:PLY_By_Material.cs

示例4: SendMesh

        /// <summary>
        /// send a mesh to OpenCOVER.
        /// </summary>
        /// <param name="geomMesh"></param>
        /// <remarks></remarks>
        private void SendMesh(Autodesk.Revit.DB.Mesh geomMesh, ref MessageBuffer mb, bool twoSided)
        {
            int i = 0;
             mb.add(twoSided);
             mb.add(geomMesh.NumTriangles);

             for (i = 0; i < geomMesh.NumTriangles; i++)
             {
            Autodesk.Revit.DB.MeshTriangle triangle = default(Autodesk.Revit.DB.MeshTriangle);
            triangle = geomMesh.get_Triangle(i);
            mb.add((float)triangle.get_Vertex(0).X);
            mb.add((float)triangle.get_Vertex(0).Y);
            mb.add((float)triangle.get_Vertex(0).Z);
            mb.add((float)triangle.get_Vertex(1).X);
            mb.add((float)triangle.get_Vertex(1).Y);
            mb.add((float)triangle.get_Vertex(1).Z);
            mb.add((float)triangle.get_Vertex(2).X);
            mb.add((float)triangle.get_Vertex(2).Y);
            mb.add((float)triangle.get_Vertex(2).Z);
             }
        }
开发者ID:dwickeroth,项目名称:covise,代码行数:26,代码来源:COVER.cs


注:本文中的Autodesk.get_Triangle方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。