【文件属性】:
文件名称:Revit API找到墙的正面
文件大小:359KB
文件格式:CHM
更新时间:2015-04-20 16:36:15
Revit API找到墙的正面
//找到墙的正面
public static Face FindWallFace(Wall wall)
{
Face normalFace = null;
//
Options opt = new Options();
opt.ComputeReferences = true;
opt.DetailLevel = Autodesk.Revit.DB.DetailLevels.Medium;
//
GeometryElement e = wall.get_Geometry(opt);
foreach (GeometryObject obj in e.Objects)
{
Solid solid = obj as Solid;
if (solid != null && solid.Faces.Size > 0)
{
foreach (Face face in solid.Faces)
{
PlanarFace pf = face as PlanarFace;
if (pf != null)
{
if (pf.Normal.AngleTo(wall.Orientation) < 0.01)//数值在0到PI之间
{
normalFace = face;
}
}
}
}
}
return normalFace;
}