Autodesk.Revit.DB.TriangulationInterfaceForTriangulatedSolidOrShell是一个用于表示由三角形组成的立体或壳体的接口类。该类提供的方法可以访问包含立体或壳体的三角形形状。该类主要应用于Revit的图形引擎中。
//初始化TriangulationInterfaceForTriangulatedSolidOrShell对象
TriangulationInterfaceForTriangulatedSolidOrShell triangulation = obj.Geometry.GetTriangulation();
//获取法线向量数组
XYZ[] normals = triangulation.GetNormals();
//获取三角形的数目
int triangleCount = triangulation.TrianglesCount;
//获取第i个三角形的三个顶点坐标值
for(int i = 0; i < triangleCount; i++)
{
XYZ[] triangle = triangulation.GetTriangle(i);
// do something with triangle vertices
}
//获取第i个三角形的法线向量值
for(int i = 0; i < triangleCount; i++)
{
XYZ normal = triangulation.GetTriangleNormal(i);
// do something with normal vector
}