123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- /* ==============================================================================
- * 功能描述:SpaceExtend
- * 创 建 者:Garrett
- * 创建日期:2019/12/6 14:52:05
- * ==============================================================================*/
- using Autodesk.Revit.DB;
- using Autodesk.Revit.DB.Mechanical;
- using RevitToJBim.MBI;
- using SAGA.DotNetUtils.Extend;
- using SAGA.RevitUtils.Extends;
- namespace RevitToJBim.Extension
- {
- /// <summary>
- /// SpaceExtend
- /// </summary>
- public static class SpaceExtend
- {
- /// <summary>
- /// 手动删除的空间,仅在明细表中可见
- /// </summary>
- /// <param name="space"></param>
- /// <returns></returns>
- public static bool IsDeleteSpace(this Space space)
- {
- //周长
- double perimeter = space.Perimeter;
- //面积
- double area = space.Area;
- //空间比较特殊,周长为零就相当于删除
- return (perimeter.IsZero(MBIConst.SpacePerimeterTolerance)) || (area.IsZero(MBIConst.SpaceAreaTolerance));
- }
- /// <summary>
- /// 获取空间的默认名称
- /// 如果空间名称为“空间”或者为“”则显示Name
- /// 否则显示Room_Name
- /// </summary>
- /// <param name="space"></param>
- /// <returns></returns>
- public static string GetSpaceDefaultName(this Space space)
- {
- string defaultName = space.Name;
- var roomname = space.GetParameterString(BuiltInParameter.ROOM_NAME);
- if (roomname == "空间" || roomname.IsNullOrEmptyExt()) return defaultName;
- defaultName = roomname;
- return defaultName;
- }
- }
- }
|