/// <summary>
/// 获取墙平行的面
/// </summary>
/// <param name="wall">墙</param>
/// <param name="transform">转换矩阵</param>
/// <returns></returns>
private List<PlanarFace> GetWallFaces(Wall wall, Transform transform)
{
Options opt = new Options();
opt.ComputeReferences = true;
opt.DetailLevel = ViewDetailLevel.Medium;
GeometryElement ge = wall.get_Geometry(opt);
List<PlanarFace> lstpf = new List<PlanarFace>();
Solid solid = null;
foreach (GeometryObject obj in ge)
{
solid = obj as Solid;
if (solid != null)
{
solid = SolidUtils.CreateTransformed(solid, transform);
foreach (Face face in solid.Faces)
{
PlanarFace pf = face as PlanarFace;
if (pf != null)
{
if (pf.FaceNormal.IsAlmostEqualTo(wall.Orientation) || pf.FaceNormal.IsAlmostEqualTo(-wall.Orientation))
{
lstpf.Add(pf);
}
}
}
break;
}
}
//opt.Dispose();
//ge.Dispose();
//if (solid != null)
// solid.Dispose();
return lstpf;
}
/// <summary>
/// 获取墙平行的面
/// </summary>
/// <param name="wall">墙</param>
/// <returns></returns>
private List<PlanarFace> GetWallFaces(Wall wall)
{
Options opt = new Options();
opt.ComputeReferences = true;
opt.DetailLevel = ViewDetailLevel.Medium;
GeometryElement ge = wall.get_Geometry(opt);
List<PlanarFace> lstpf = new List<PlanarFace>();
Solid solid = null;
foreach (GeometryObject obj in ge)
{
solid = obj as Solid;
if (solid != null)
{
foreach (Face face in solid.Faces)
{
PlanarFace pf = face as PlanarFace;
if (pf != null)
{
if (pf.FaceNormal.IsAlmostEqualTo(wall.Orientation) || pf.FaceNormal.IsAlmostEqualTo(-wall.Orientation))
{
lstpf.Add(pf);
}
//if (pf.FaceNormal.CrossProduct(wall.Orientation).IsZeroLength())
//{
//}
}
}
break;
}
}
//opt.Dispose();
//ge.Dispose();
//if (solid != null)
// solid.Dispose();
return lstpf;
}
Revit获取墙平行的面
最新推荐文章于 2025-05-02 21:14:58 发布