| | |
| | | using HStation.Model; |
| | | |
| | | namespace HStation.Service |
| | | namespace HStation.Service |
| | | { |
| | | /// <summary> |
| | | /// |
| | | /// Revit组件拓展 |
| | | /// </summary> |
| | | internal static class RevitParterExtensions |
| | | { |
| | | /// <summary> |
| | | /// 获取属性状态 |
| | | /// </summary> |
| | | public static HStation.Model.RevitPropStatus GetPropStatus(this HStation.Model.RevitParter parter, string propName) |
| | | { |
| | | if (string.IsNullOrEmpty(propName)) |
| | | { |
| | | return default; |
| | | } |
| | | var propStatus = parter.PropStatusList?.Find(x => x.PropName == propName); |
| | | return propStatus; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// 是否存在属性状态 |
| | | /// </summary> |
| | | public static void AppendPropStatus(this RevitParter rhs, string propName, ePropStatus propStatus, string statusInfo) |
| | | public static bool IsExistPropStatus(this HStation.Model.RevitParter parter, string propName) |
| | | { |
| | | if (rhs == null) |
| | | if (string.IsNullOrEmpty(propName)) |
| | | { |
| | | return; |
| | | return false; |
| | | } |
| | | if (rhs.PropStatusList == null) |
| | | if (parter.PropStatusList == null || parter.PropStatusList.Count < 1) |
| | | { |
| | | rhs.PropStatusList = new List<RevitPropStatus>(); |
| | | return false; |
| | | } |
| | | var status = new RevitPropStatus(propName, propStatus, statusInfo); |
| | | rhs.PropStatusList.Add(status); |
| | | return parter.PropStatusList.Exists(x => x.PropName == propName); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 添加或者更新属性状态 |
| | | /// </summary> |
| | | public static bool AppendOrUpdatePropStatus(this HStation.Model.RevitParter parter, string propName, ePropStatus propStatus, string statusInfo) |
| | | { |
| | | if (parter == null) |
| | | { |
| | | return false; |
| | | } |
| | | if (string.IsNullOrEmpty(propName)) |
| | | { |
| | | return false; |
| | | } |
| | | if (parter.PropStatusList == null) |
| | | { |
| | | parter.PropStatusList = new List<Model.RevitPropStatus>(); |
| | | } |
| | | var propStatusModel = parter.GetPropStatus(propName); |
| | | if (propStatusModel == null) |
| | | { |
| | | propStatusModel = new Model.RevitPropStatus() { PropName = propName }; |
| | | parter.PropStatusList.Add(propStatusModel); |
| | | } |
| | | propStatusModel.PropStatus = propStatus; |
| | | propStatusModel.StatusInfo = statusInfo; |
| | | return true; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | } |