EaBIM
标题: 找到墙的正面 [打印本页]
作者: 萧闫子 时间: 2014-1-9 13:06
标题: 找到墙的正面
Wall.Orientation指示墙的正方向,判断Face与这个正方向的夹角一致,即为墙的正面。
//找到墙的正面
- 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;
- }
复制代码
作者: We晕晕 时间: 2014-2-20 14:34
顶!!!!!!!!!!
欢迎光临 EaBIM (https://eabim.net/) |
Powered by Discuz! X3.2 |