1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
-
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using Autodesk.Revit.DB;
- using SAGA.DotNetUtils.Extend;
- using SAGA.RevitUtils;
- using SAGA.RevitUtils.Extends;
- namespace RevitToJBim.Extension
- {
- public static class WallExtension
- {
- public static List<PlanarFace> GetTopFaces(this Wall wall)
- {
- var solids = Extension.GeometryElementExtension.GetSolids(wall, wall.Document.GetUseView());
-
-
- double topZ = double.MinValue;
- List<PlanarFace> faces = new List<PlanarFace>();
- foreach (var solid in solids)
- {
- foreach (Face face in solid.Faces)
- {
- if (face is PlanarFace planarFace && planarFace.FaceNormal.IsEqual(XYZ.BasisZ))
- {
- var tempZ = planarFace.Origin.Z;
- if (tempZ.IsThan(topZ))
- {
- faces.Clear();
- topZ = tempZ;
- faces.Add(planarFace);
- }
- else if(tempZ.IsEqual(topZ))
- {
- faces.Add(planarFace);
- }
-
- }
- }
- }
- return faces;
- }
- }
- }
|