From cec8d92bdca1da0b2eafe6eb3130f4bf6f03028b Mon Sep 17 00:00:00 2001 From: duheng <2286773002@qq.com> Date: 星期三, 12 三月 2025 10:21:09 +0800 Subject: [PATCH] Merge branch 'master' of http://47.103.154.90:83/r/HStation/XHS.V1.0 --- Service/HStation.Service.Revit.Core/04-service/01-json/RevitJsonHelper.cs | 832 +++++++++++++++++++++++++++++++++++++++++++++++++++------- 1 files changed, 727 insertions(+), 105 deletions(-) diff --git a/Service/HStation.Service.Revit.Core/04-service/01-json/RevitJsonHelper.cs b/Service/HStation.Service.Revit.Core/04-service/01-json/RevitJsonHelper.cs index 63c625d..3f86b58 100644 --- a/Service/HStation.Service.Revit.Core/04-service/01-json/RevitJsonHelper.cs +++ b/Service/HStation.Service.Revit.Core/04-service/01-json/RevitJsonHelper.cs @@ -21,8 +21,8 @@ msg = "Revit json 瀛楃涓蹭负绌�"; return default; } - try - { + //try + //{ var model = new Model.RevitModel(); //瑙f瀽缁撴瀯json @@ -150,6 +150,15 @@ } } break; + case RevitJsonCatalog.Cooling: + { + var cooling = ParseCooling(jobject); + if (cooling != null) + { + model.Coolings.Add(cooling); + } + } + break; case RevitJsonCatalog.Pipe: { var pipe = ParsePipe(jobject); @@ -251,12 +260,12 @@ } return model; - } - catch (Exception ex) - { - msg = ex.Message; - return default; - } + //} + //catch (Exception ex) + //{ + // msg = ex.Message; + // return default; + //} } @@ -363,6 +372,10 @@ { reservoir.UpdatePropStatus(nameof(reservoir.Flags), ePropStatus.Error, "缂哄皯[鏍囩淇℃伅]"); } + if (reservoir.Flags == null) + { + reservoir.Flags = new List<string>(); + } #endregion @@ -433,6 +446,17 @@ if (jobject[RevitJsonProp.ElevOfElevation].MatchNumeric(out double elevOfElevation)) { reservoir.PoolElev = elevOfElevation / 1000f; + var jre = jobject[RevitJsonProp.Elev]; + if (jre != null) + { + if (jre.HasValues) + { + if (jre[RevitJsonProp.ElevFacade].MatchNumeric(out double facade)) + { + reservoir.PoolElev += facade / 1000f; + } + } + } } else { @@ -562,6 +586,11 @@ tank.UpdatePropStatus(nameof(tank.Flags), ePropStatus.Error, "缂哄皯[鏍囩淇℃伅]"); } + if (tank.Flags == null) + { + tank.Flags = new List<string>(); + } + #endregion #region Description @@ -631,6 +660,17 @@ if (jobject[RevitJsonProp.ElevOfElevation].MatchNumeric(out double elevOfElevation)) { tank.PoolElev = elevOfElevation / 1000f; + var jre = jobject[RevitJsonProp.Elev]; + if (jre != null) + { + if (jre.HasValues) + { + if (jre[RevitJsonProp.ElevFacade].MatchNumeric(out double facade)) + { + tank.PoolElev += facade / 1000f; + } + } + } } else { @@ -835,6 +875,11 @@ waterbox.UpdatePropStatus(nameof(waterbox.Flags), ePropStatus.Error, "缂哄皯[鏍囩淇℃伅]"); } + if (waterbox.Flags == null) + { + waterbox.Flags = new List<string>(); + } + #endregion #region Description @@ -904,6 +949,17 @@ if (jobject[RevitJsonProp.ElevOfElevation].MatchNumeric(out double elevOfElevation)) { waterbox.PoolElev = elevOfElevation / 1000f; + var jre = jobject[RevitJsonProp.Elev]; + if (jre != null) + { + if (jre.HasValues) + { + if (jre[RevitJsonProp.ElevFacade].MatchNumeric(out double facade)) + { + waterbox.PoolElev += facade / 1000f; + } + } + } } else { @@ -1108,6 +1164,11 @@ junction.UpdatePropStatus(nameof(junction.Flags), ePropStatus.Error, "缂哄皯[鏍囩淇℃伅]"); } + if (junction.Flags == null) + { + junction.Flags = new List<string>(); + } + #endregion #region Description @@ -1163,7 +1224,7 @@ #region Elev - if (jobject[RevitJsonProp.Elev].MatchNumeric(out double elev)) + if (jobject[RevitJsonProp.ElevInfo].MatchNumeric(out double elev)) { junction.Elev = elev; } @@ -1177,11 +1238,23 @@ if (jobject[RevitJsonProp.ElevOfElevation].MatchNumeric(out double elevOfElevation)) { junction.Elev = elevOfElevation / 1000f; + var jre = jobject[RevitJsonProp.Elev]; + if (jre != null) + { + if (jre.HasValues) + { + if (jre[RevitJsonProp.ElevFacade].MatchNumeric(out double facade)) + { + junction.Elev += facade / 1000f; + } + } + } } else { junction.UpdatePropStatus(nameof(junction.Elev), ePropStatus.Abnormal, "[鏍囬珮涓殑楂樼▼]缂哄皯鎴栬�呮牸寮忛敊璇�"); } + } if (junction.Elev <= 0) @@ -1319,6 +1392,11 @@ blunthead.UpdatePropStatus(nameof(blunthead.Flags), ePropStatus.Error, "缂哄皯[鏍囩淇℃伅]"); } + if (blunthead.Flags == null) + { + blunthead.Flags = new List<string>(); + } + #endregion #region Description @@ -1374,7 +1452,7 @@ #region Elev - if (jobject[RevitJsonProp.Elev].MatchNumeric(out double elev)) + if (jobject[RevitJsonProp.ElevInfo].MatchNumeric(out double elev)) { blunthead.Elev = elev; } @@ -1388,6 +1466,17 @@ if (jobject[RevitJsonProp.ElevOfElevation].MatchNumeric(out double elevOfElevation)) { blunthead.Elev = elevOfElevation / 1000f; + var jre = jobject[RevitJsonProp.Elev]; + if (jre != null) + { + if (jre.HasValues) + { + if (jre[RevitJsonProp.ElevFacade].MatchNumeric(out double facade)) + { + blunthead.Elev += facade / 1000f; + } + } + } } else { @@ -1434,7 +1523,14 @@ { blunthead.Caliber = caliber; } - else + if (blunthead.Caliber <= 0) + { + if (jobject[RevitJsonProp.DN].MatchNumeric(out caliber)) + { + blunthead.Caliber = caliber; + } + } + if (blunthead.Caliber <= 0) { blunthead.UpdatePropStatus(nameof(blunthead.Caliber), ePropStatus.Abnormal, "[鍙e緞淇℃伅]缂哄皯鎴栬�呮暟鎹牸寮忛敊璇�"); } @@ -1561,6 +1657,11 @@ elbow.UpdatePropStatus(nameof(elbow.Flags), ePropStatus.Error, "缂哄皯[鏍囩淇℃伅]"); } + if (elbow.Flags == null) + { + elbow.Flags = new List<string>(); + } + #endregion #region Description @@ -1616,7 +1717,7 @@ #region Elev - if (jobject[RevitJsonProp.Elev].MatchNumeric(out double elev)) + if (jobject[RevitJsonProp.ElevInfo].MatchNumeric(out double elev)) { elbow.Elev = elev; } @@ -1630,6 +1731,17 @@ if (jobject[RevitJsonProp.ElevOfElevation].MatchNumeric(out double elevOfElevation)) { elbow.Elev = elevOfElevation / 1000f; + var jre = jobject[RevitJsonProp.Elev]; + if (jre != null) + { + if (jre.HasValues) + { + if (jre[RevitJsonProp.ElevFacade].MatchNumeric(out double facade)) + { + elbow.Elev += facade / 1000f; + } + } + } } else { @@ -1676,7 +1788,14 @@ { elbow.Caliber = caliber; } - else + if (elbow.Caliber <= 0) + { + if (jobject[RevitJsonProp.DN].MatchNumeric(out caliber)) + { + elbow.Caliber = caliber; + } + } + if (elbow.Caliber <= 0) { elbow.UpdatePropStatus(nameof(elbow.Caliber), ePropStatus.Abnormal, "[鍙e緞淇℃伅]缂哄皯鎴栬�呮暟鎹牸寮忛敊璇�"); } @@ -1730,7 +1849,7 @@ if (jobject[RevitJsonProp.BendingAngle].MatchNumeric(out double bendingAngle)) { - elbow.BendingAngle = bendingAngle; + elbow.BendingAngle = (int)bendingAngle; } else { @@ -1832,6 +1951,11 @@ threelink.UpdatePropStatus(nameof(threelink.Flags), ePropStatus.Error, "缂哄皯[鏍囩淇℃伅]"); } + if (threelink.Flags == null) + { + threelink.Flags = new List<string>(); + } + #endregion #region Description @@ -1887,7 +2011,7 @@ #region Elev - if (jobject[RevitJsonProp.Elev].MatchNumeric(out double elev)) + if (jobject[RevitJsonProp.ElevInfo].MatchNumeric(out double elev)) { threelink.Elev = elev; } @@ -1901,6 +2025,17 @@ if (jobject[RevitJsonProp.ElevOfElevation].MatchNumeric(out double elevOfElevation)) { threelink.Elev = elevOfElevation / 1000f; + var jre = jobject[RevitJsonProp.Elev]; + if (jre != null) + { + if (jre.HasValues) + { + if (jre[RevitJsonProp.ElevFacade].MatchNumeric(out double facade)) + { + threelink.Elev += facade / 1000f; + } + } + } } else { @@ -1947,7 +2082,14 @@ { threelink.Caliber = caliber; } - else + if (threelink.Caliber <= 0) + { + if (jobject[RevitJsonProp.DN].MatchNumeric(out caliber)) + { + threelink.Caliber = caliber; + } + } + if (threelink.Caliber <= 0) { threelink.UpdatePropStatus(nameof(threelink.Caliber), ePropStatus.Abnormal, "[鍙e緞淇℃伅]缂哄皯鎴栬�呮暟鎹牸寮忛敊璇�"); } @@ -2099,6 +2241,11 @@ fourlink.UpdatePropStatus(nameof(fourlink.Flags), ePropStatus.Error, "缂哄皯[鏍囩淇℃伅]"); } + if (fourlink.Flags == null) + { + fourlink.Flags = new List<string>(); + } + #endregion #region Description @@ -2154,7 +2301,7 @@ #region Elev - if (jobject[RevitJsonProp.Elev].MatchNumeric(out double elev)) + if (jobject[RevitJsonProp.ElevInfo].MatchNumeric(out double elev)) { fourlink.Elev = elev; } @@ -2168,6 +2315,17 @@ if (jobject[RevitJsonProp.ElevOfElevation].MatchNumeric(out double elevOfElevation)) { fourlink.Elev = elevOfElevation / 1000f; + var jre = jobject[RevitJsonProp.Elev]; + if (jre != null) + { + if (jre.HasValues) + { + if (jre[RevitJsonProp.ElevFacade].MatchNumeric(out double facade)) + { + fourlink.Elev += facade / 1000f; + } + } + } } else { @@ -2214,7 +2372,14 @@ { fourlink.Caliber = caliber; } - else + if (fourlink.Caliber <= 0) + { + if (jobject[RevitJsonProp.DN].MatchNumeric(out caliber)) + { + fourlink.Caliber = caliber; + } + } + if (fourlink.Caliber <= 0) { fourlink.UpdatePropStatus(nameof(fourlink.Caliber), ePropStatus.Abnormal, "[鍙e緞淇℃伅]缂哄皯鎴栬�呮暟鎹牸寮忛敊璇�"); } @@ -2340,6 +2505,11 @@ nozzle.UpdatePropStatus(nameof(nozzle.Flags), ePropStatus.Error, "缂哄皯[鏍囩淇℃伅]"); } + if (nozzle.Flags == null) + { + nozzle.Flags = new List<string>(); + } + #endregion #region Description @@ -2395,7 +2565,7 @@ #region Elev - if (jobject[RevitJsonProp.Elev].MatchNumeric(out double elev)) + if (jobject[RevitJsonProp.ElevInfo].MatchNumeric(out double elev)) { nozzle.Elev = elev; } @@ -2409,6 +2579,17 @@ if (jobject[RevitJsonProp.ElevOfElevation].MatchNumeric(out double elevOfElevation)) { nozzle.Elev = elevOfElevation / 1000f; + var jre = jobject[RevitJsonProp.Elev]; + if (jre != null) + { + if (jre.HasValues) + { + if (jre[RevitJsonProp.ElevFacade].MatchNumeric(out double facade)) + { + nozzle.Elev += facade / 1000f; + } + } + } } else { @@ -2611,6 +2792,11 @@ hydrant.UpdatePropStatus(nameof(hydrant.Flags), ePropStatus.Error, "缂哄皯[鏍囩淇℃伅]"); } + if (hydrant.Flags == null) + { + hydrant.Flags = new List<string>(); + } + #endregion #region Description @@ -2666,7 +2852,7 @@ #region Elev - if (jobject[RevitJsonProp.Elev].MatchNumeric(out double elev)) + if (jobject[RevitJsonProp.ElevInfo].MatchNumeric(out double elev)) { hydrant.Elev = elev; } @@ -2680,6 +2866,17 @@ if (jobject[RevitJsonProp.ElevOfElevation].MatchNumeric(out double elevOfElevation)) { hydrant.Elev = elevOfElevation / 1000f; + var jre = jobject[RevitJsonProp.Elev]; + if (jre != null) + { + if (jre.HasValues) + { + if (jre[RevitJsonProp.ElevFacade].MatchNumeric(out double facade)) + { + hydrant.Elev += facade / 1000f; + } + } + } } else { @@ -2804,6 +3001,305 @@ return hydrant; } + //瑙f瀽鍐峰嵈濉� + private static HStation.Model.RevitCooling ParseCooling(JToken jobject) + { + if (jobject == null) + { + return default; + } + + var cooling = new Model.RevitCooling(); + cooling.Catalog = RevitJsonCatalog.Cooling; + + #region Id + + if (jobject.ParseString(RevitJsonProp.Id, out string id)) + { + cooling.Id = id; + } + else + { + cooling.UpdatePropStatus(nameof(cooling.Id), ePropStatus.Error, "缂哄皯[鏋勪欢缂栫爜]"); + } + + #endregion + + #region Name + + if (jobject.ParseString(RevitJsonProp.Name, out string name)) + { + cooling.Name = name; + cooling.UpdatePropStatus(nameof(cooling.Name), ePropStatus.Lack, "[鏋勪欢鍚嶇О]缂虹渷"); + } + else + { + cooling.UpdatePropStatus(nameof(cooling.Name), ePropStatus.Error, "缂哄皯 [鏋勪欢鍚嶇О]"); + } + + #endregion + + #region ModelType + + if (jobject.ParseString(RevitJsonProp.ModelType, out string modelType)) + { + cooling.ModelType = modelType; + if (string.IsNullOrEmpty(cooling.ModelType)) + { + cooling.UpdatePropStatus(nameof(cooling.ModelType), ePropStatus.Lack, "[鍨嬪彿淇℃伅]缂虹渷"); + } + } + else + { + cooling.UpdatePropStatus(nameof(cooling.ModelType), ePropStatus.Error, "缂哄皯[鍨嬪彿淇℃伅]"); + } + + #endregion + + #region Flags + + if (jobject.ParseString(RevitJsonProp.Flags, out string flags)) + { + cooling.Flags = Yw.Untity.FlagsHelper.ToList(flags); + if (!string.IsNullOrEmpty(flags)) + { + if (cooling.Flags == null || cooling.Flags.Count < 1) + { + cooling.UpdatePropStatus(nameof(cooling.Flags), ePropStatus.Abnormal, "[鏍囩淇℃伅]鏍煎紡閿欒"); + } + } + } + else + { + cooling.UpdatePropStatus(nameof(cooling.Flags), ePropStatus.Error, "缂哄皯[鏍囩淇℃伅]"); + } + + if (cooling.Flags == null) + { + cooling.Flags = new List<string>(); + } + + #endregion + + #region Description + + if (jobject.ParseString(RevitJsonProp.Description, out string description)) + { + cooling.Description = description; + } + else + { + cooling.UpdatePropStatus(nameof(cooling.Description), ePropStatus.Error, "缂哄皯[璇存槑淇℃伅]"); + } + + #endregion + + #region ConnectList + + if (jobject.ParseString(RevitJsonProp.Connects, out string connectString)) + { + var connectList = JsonHelper.Json2Object<List<RevitJsonConnectModel>>(connectString); + cooling.ConnectList = connectList?.Select(x => new Model.RevitConnect() + { + Id = x.ConnectId, + Direction = x.Dirction, + Position = new Model.RevitPosition() + { + X = x.Point.X / 1000f, + Y = x.Point.Y / 1000f, + Z = x.Point.Z / 1000f + } + }).ToList(); + if (cooling.ConnectList == null || cooling.ConnectList.Count < 1) + { + cooling.UpdatePropStatus(nameof(cooling.ConnectList), ePropStatus.Error, "[杩炴帴鍒楄〃]瑙f瀽澶辫触"); + } + } + else + { + cooling.UpdatePropStatus(nameof(cooling.ConnectList), ePropStatus.Error, "缂哄皯[杩炴帴鍒楄〃]"); + } + + #endregion + + #region Position + + cooling.Position = cooling.ConnectList?.GetCenterPosition(); + if (cooling.Position == null) + { + cooling.UpdatePropStatus(nameof(cooling.Position), ePropStatus.Lack, "[浣嶇疆淇℃伅]缂虹渷锛屽彲鑳芥槸鍙梉杩炴帴鍒楄〃]瑙f瀽澶辫触褰卞搷"); + } + + #endregion + + #region Elev + + if (jobject[RevitJsonProp.ElevInfo].MatchNumeric(out double elev)) + { + cooling.Elev = elev; + } + else + { + cooling.UpdatePropStatus(nameof(cooling.Elev), ePropStatus.Abnormal, "[鏍囬珮淇℃伅]缂哄皯鎴栬�呮牸寮忛敊璇�"); + } + + if (cooling.Elev <= 0) + { + if (jobject[RevitJsonProp.ElevOfElevation].MatchNumeric(out double elevOfElevation)) + { + cooling.Elev = elevOfElevation / 1000f; + var jre = jobject[RevitJsonProp.Elev]; + if (jre != null) + { + if (jre.HasValues) + { + if (jre[RevitJsonProp.ElevFacade].MatchNumeric(out double facade)) + { + cooling.Elev += facade / 1000f; + } + } + } + } + else + { + cooling.UpdatePropStatus(nameof(cooling.Elev), ePropStatus.Abnormal, "[鏍囬珮涓殑楂樼▼]缂哄皯鎴栬�呮牸寮忛敊璇�"); + } + } + + if (cooling.Elev <= 0) + { + //閫氳繃z杞磋嚜鍔ㄨ绠� + if (cooling.Position == null) + { + cooling.UpdatePropStatus(nameof(cooling.Elev), ePropStatus.Lack, "[鏍囬珮淇℃伅]缂虹渷锛屽彈[浣嶇疆]褰卞搷锛屾棤娉曢�氳繃Z杞磋嚜鍔ㄨ绠�"); + } + else + { + cooling.Elev = cooling.Position.Z; + cooling.UpdatePropStatus(nameof(cooling.Elev), ePropStatus.Lack, "[鏍囬珮淇℃伅]缂虹渷锛岄�氳繃Z杞磋嚜鍔ㄨ绠�"); + } + } + + #endregion + + #region Material + + if (jobject.ParseString(RevitJsonProp.Material, out string material)) + { + cooling.Material = material; + if (string.IsNullOrEmpty(cooling.Material)) + { + cooling.UpdatePropStatus(nameof(cooling.Material), ePropStatus.Lack, "[鏉愯川淇℃伅]缂虹渷"); + } + } + else + { + cooling.UpdatePropStatus(nameof(cooling.Material), ePropStatus.Abnormal, "缂哄皯[鏉愯川淇℃伅]"); + } + + #endregion + + #region Caliber + + if (jobject[RevitJsonProp.Caliber].MatchNumeric(out double caliber)) + { + cooling.Caliber = caliber; + } + else + { + cooling.UpdatePropStatus(nameof(cooling.Caliber), ePropStatus.Abnormal, "[鍙e緞淇℃伅]缂哄皯鎴栬�呮暟鎹牸寮忛敊璇�"); + } + + #endregion + + #region Demand + + if (jobject[RevitJsonProp.Demand].MatchNumeric(out double demand)) + { + cooling.Demand = demand; + } + else + { + cooling.UpdatePropStatus(nameof(cooling.Demand), ePropStatus.Abnormal, "[闇�姘撮噺]缂哄皯鎴栬�呮暟鎹牸寮忛敊璇�"); + } + + #endregion + + #region DemandPattern + + if (jobject.ParseString(RevitJsonProp.DemandPattern, out string demandPattern)) + { + cooling.DemandPattern = demandPattern; + if (string.IsNullOrEmpty(cooling.DemandPattern)) + { + cooling.UpdatePropStatus(nameof(cooling.DemandPattern), ePropStatus.Lack, "[闇�姘存ā寮廬缂虹渷"); + } + } + else + { + cooling.UpdatePropStatus(nameof(cooling.DemandPattern), ePropStatus.Abnormal, "缂哄皯[闇�姘存ā寮廬"); + } + + #endregion + + #region MinorLoss + + if (jobject[RevitJsonProp.MinorLoss].MatchNumeric(out double minorLoss)) + { + cooling.MinorLoss = minorLoss; + } + else + { + cooling.UpdatePropStatus(nameof(cooling.MinorLoss), ePropStatus.Abnormal, "[灞�闃荤郴鏁癩缂哄皯鎴栬�呮暟鎹牸寮忛敊璇�"); + } + + #endregion + + #region Coefficient + + if (jobject[RevitJsonProp.CoefficientP].MatchNumeric(out double coeffientp)) + { + cooling.Coefficient = coeffientp; + if (cooling.Coefficient <= 0) + { + cooling.UpdatePropStatus(nameof(cooling.Coefficient), ePropStatus.Lack, "[鍠峰皠绯绘暟]缂虹渷"); + } + } + else + { + cooling.UpdatePropStatus(nameof(cooling.Coefficient), ePropStatus.Abnormal, "[鍠峰皠绯绘暟]缂哄皯鎴栬�呮牸寮忛敊璇�"); + if (jobject[RevitJsonProp.CoefficientF].MatchNumeric(out double coeffientf)) + { + cooling.Coefficient = coeffientf; + if (cooling.Coefficient <= 0) + { + cooling.UpdatePropStatus(nameof(cooling.Coefficient), ePropStatus.Lack, "[娴侀噺绯绘暟]缂虹渷"); + } + } + } + + #endregion + + #region LowerLimit + + if (jobject[RevitJsonProp.LowerLimit].MatchNumeric(out double lowerLimit)) + { + cooling.LowerLimit = lowerLimit; + if (cooling.LowerLimit <= 0) + { + cooling.UpdatePropStatus(nameof(cooling.LowerLimit), ePropStatus.Lack, "[鏈�灏忓帇鍔沒缂虹渷"); + } + } + else + { + cooling.UpdatePropStatus(nameof(cooling.LowerLimit), ePropStatus.Abnormal, "[鏈�灏忓帇鍔沒缂哄皯鎴栬�呮牸寮忛敊璇�"); + } + + #endregion + + return cooling; + } + //瑙f瀽姘磋〃 private static HStation.Model.RevitMeter ParseMeter(JToken jobject) { @@ -2877,6 +3373,11 @@ meter.UpdatePropStatus(nameof(meter.Flags), ePropStatus.Error, "缂哄皯[鏍囩淇℃伅]"); } + if (meter.Flags == null) + { + meter.Flags = new List<string>(); + } + #endregion #region Description @@ -2932,7 +3433,7 @@ #region Elev - if (jobject[RevitJsonProp.Elev].MatchNumeric(out double elev)) + if (jobject[RevitJsonProp.ElevInfo].MatchNumeric(out double elev)) { meter.Elev = elev; } @@ -2946,6 +3447,17 @@ if (jobject[RevitJsonProp.ElevOfElevation].MatchNumeric(out double elevOfElevation)) { meter.Elev = elevOfElevation / 1000f; + var jre = jobject[RevitJsonProp.Elev]; + if (jre != null) + { + if (jre.HasValues) + { + if (jre[RevitJsonProp.ElevFacade].MatchNumeric(out double facade)) + { + meter.Elev += facade / 1000f; + } + } + } } else { @@ -3088,6 +3600,11 @@ flowmeter.UpdatePropStatus(nameof(flowmeter.Flags), ePropStatus.Error, "缂哄皯[鏍囩淇℃伅]"); } + if (flowmeter.Flags == null) + { + flowmeter.Flags = new List<string>(); + } + #endregion #region Description @@ -3143,7 +3660,7 @@ #region Elev - if (jobject[RevitJsonProp.Elev].MatchNumeric(out double elev)) + if (jobject[RevitJsonProp.ElevInfo].MatchNumeric(out double elev)) { flowmeter.Elev = elev; } @@ -3157,6 +3674,14 @@ if (jobject[RevitJsonProp.ElevOfElevation].MatchNumeric(out double elevOfElevation)) { flowmeter.Elev = elevOfElevation / 1000f; + var jre = jobject[RevitJsonProp.Elev]; + if (jre != null) + { + if (jre[RevitJsonProp.ElevFacade].MatchNumeric(out double facade)) + { + flowmeter.Elev += facade / 1000f; + } + } } else { @@ -3219,19 +3744,6 @@ else { flowmeter.UpdatePropStatus(nameof(flowmeter.MinorLoss), ePropStatus.Abnormal, "[灞�闃荤郴鏁癩缂哄皯鎴栬�呮暟鎹牸寮忛敊璇�"); - } - - #endregion - - #region CurrentFlow - - if (jobject[RevitJsonProp.CurrentFlow].MatchNumeric(out double currentFlow)) - { - flowmeter.CurrentFlow = currentFlow; - } - else - { - flowmeter.UpdatePropStatus(nameof(flowmeter.CurrentFlow), ePropStatus.Abnormal, "[娴侀噺淇℃伅]缂哄皯鎴栬�呮暟鎹牸寮忛敊璇�"); } #endregion @@ -3312,6 +3824,11 @@ pressmeter.UpdatePropStatus(nameof(pressmeter.Flags), ePropStatus.Error, "缂哄皯[鏍囩淇℃伅]"); } + if (pressmeter.Flags == null) + { + pressmeter.Flags = new List<string>(); + } + #endregion #region Description @@ -3367,7 +3884,7 @@ #region Elev - if (jobject[RevitJsonProp.Elev].MatchNumeric(out double elev)) + if (jobject[RevitJsonProp.ElevInfo].MatchNumeric(out double elev)) { pressmeter.Elev = elev; } @@ -3381,6 +3898,17 @@ if (jobject[RevitJsonProp.ElevOfElevation].MatchNumeric(out double elevOfElevation)) { pressmeter.Elev = elevOfElevation / 1000f; + var jre = jobject[RevitJsonProp.Elev]; + if (jre != null) + { + if (jre.HasValues) + { + if (jre[RevitJsonProp.ElevFacade].MatchNumeric(out double facade)) + { + pressmeter.Elev += facade / 1000f; + } + } + } } else { @@ -3447,19 +3975,6 @@ #endregion - #region CurrentPress - - if (jobject[RevitJsonProp.CurrentPress].MatchNumeric(out double currentPress)) - { - pressmeter.CurrentPress = currentPress; - } - else - { - pressmeter.UpdatePropStatus(nameof(pressmeter.CurrentPress), ePropStatus.Abnormal, "[鍘嬪姏淇℃伅]缂哄皯鎴栬�呮暟鎹牸寮忛敊璇�"); - } - - #endregion - return pressmeter; } @@ -3492,7 +4007,10 @@ if (jobject.ParseString(RevitJsonProp.Name, out string name)) { pipe.Name = name; - pipe.UpdatePropStatus(nameof(pipe.Name), ePropStatus.Lack, "[鏋勪欢鍚嶇О]缂虹渷"); + if (string.IsNullOrEmpty(pipe.Name)) + { + pipe.UpdatePropStatus(nameof(pipe.Name), ePropStatus.Lack, "[鏋勪欢鍚嶇О]缂虹渷"); + } } else { @@ -3522,7 +4040,7 @@ if (jobject.ParseString(RevitJsonProp.Flags, out string flags)) { - pipe.Flags = Yw.Untity.FlagsHelper.ToList(flags); + pipe.Flags = FlagsHelper.ToList(flags); if (!string.IsNullOrEmpty(flags)) { if (pipe.Flags == null || pipe.Flags.Count < 1) @@ -3534,6 +4052,11 @@ else { pipe.UpdatePropStatus(nameof(pipe.Flags), ePropStatus.Error, "缂哄皯[鏍囩淇℃伅]"); + } + + if (pipe.Flags == null) + { + pipe.Flags = new List<string>(); } #endregion @@ -3657,7 +4180,8 @@ #region Diameter - if (jobject[RevitJsonProp.Diameter].MatchNumeric(out double diameter)) + //鐩村緞淇℃伅 + if (jobject[RevitJsonProp.DiameterInfo].MatchNumeric(out double diameter)) { pipe.Diameter = diameter; } @@ -3666,11 +4190,26 @@ pipe.UpdatePropStatus(nameof(pipe.Diameter), ePropStatus.Abnormal, "[鐩村緞淇℃伅]缂哄皯鎴栬�呮牸寮忛敊璇�"); } + //鐩村緞 if (pipe.Diameter < 1) { - if (jobject[RevitJsonProp.InternalDiameter].MatchNumeric(out double internalDiameter)) + if (jobject[RevitJsonProp.Diameter].MatchNumeric(out diameter)) { - pipe.Diameter = internalDiameter; + pipe.Diameter = diameter; + pipe.UpdatePropStatus(nameof(pipe.Diameter), ePropStatus.Lack, "[鐩村緞淇℃伅]閫氳繃[鐩村緞]杩涜淇]"); + } + else + { + pipe.UpdatePropStatus(nameof(pipe.Diameter), ePropStatus.Abnormal, "[鐩村緞淇℃伅]鏃犳硶閫氳繃[鐩村緞]杩涜淇]"); + } + } + + //鍐呭緞 + if (pipe.Diameter < 1) + { + if (jobject[RevitJsonProp.InternalDiameter].MatchNumeric(out diameter)) + { + pipe.Diameter = diameter; pipe.UpdatePropStatus(nameof(pipe.Diameter), ePropStatus.Lack, "[鐩村緞淇℃伅]閫氳繃[鍐呭緞]杩涜淇]"); } else @@ -3679,6 +4218,7 @@ } } + //鍏О鐩村緞 if (pipe.Diameter < 1) { if (jobject[RevitJsonProp.DN].MatchNumeric(out double dn)) @@ -3694,8 +4234,7 @@ if (pipe.Diameter < 1) { - pipe.Diameter = 500; - pipe.UpdatePropStatus(nameof(pipe.Diameter), ePropStatus.Lack, "[鐩村緞淇℃伅][鍐呭緞]瑙f瀽閿欒锛屼娇鐢ㄩ粯璁ゅ��(500mm)淇]"); + pipe.UpdatePropStatus(nameof(pipe.Diameter), ePropStatus.Error, "[鐩村緞淇℃伅]瑙f瀽閿欒锛屾棤娉曢�氳繃銆愮洿寰勩�戙�愬唴寰勩�戙�愬叕绉扮洿寰勩�戜慨澶�"); } #endregion @@ -3833,6 +4372,11 @@ translation.UpdatePropStatus(nameof(translation.Flags), ePropStatus.Error, "缂哄皯[鏍囩淇℃伅]"); } + if (translation.Flags == null) + { + translation.Flags = new List<string>(); + } + #endregion #region Description @@ -3937,7 +4481,7 @@ #region Elev - if (jobject[RevitJsonProp.Elev].MatchNumeric(out double elev)) + if (jobject[RevitJsonProp.ElevInfo].MatchNumeric(out double elev)) { translation.Elev = elev; } @@ -3951,6 +4495,17 @@ if (jobject[RevitJsonProp.ElevOfElevation].MatchNumeric(out double elevOfElevation)) { translation.Elev = elevOfElevation / 1000f; + var jre = jobject[RevitJsonProp.Elev]; + if (jre != null) + { + if (jre.HasValues) + { + if (jre[RevitJsonProp.ElevFacade].MatchNumeric(out double facade)) + { + translation.Elev += facade / 1000f; + } + } + } } else { @@ -3995,47 +4550,20 @@ #endregion - #region Diameter + #region StartDiameter - if (jobject[RevitJsonProp.Diameter].MatchNumeric(out double diameter)) + if (jobject[RevitJsonProp.MaxSize].MatchNumeric(out double maxSize)) { - translation.Diameter = diameter; - } - else - { - translation.UpdatePropStatus(nameof(translation.Diameter), ePropStatus.Abnormal, "[鐩村緞淇℃伅]缂哄皯鎴栬�呮牸寮忛敊璇�"); + translation.StartDiameter = maxSize; } - if (translation.Diameter < 1) - { - if (jobject[RevitJsonProp.InternalDiameter].MatchNumeric(out double internalDiameter)) - { - translation.Diameter = internalDiameter; - translation.UpdatePropStatus(nameof(translation.Diameter), ePropStatus.Lack, "[鐩村緞淇℃伅]閫氳繃[鍐呭緞]杩涜淇]"); - } - else - { - translation.UpdatePropStatus(nameof(translation.Diameter), ePropStatus.Abnormal, "[鐩村緞淇℃伅]鏃犳硶閫氳繃[鍐呭緞]杩涜淇]"); - } - } + #endregion - if (translation.Diameter < 1) - { - if (jobject[RevitJsonProp.DN].MatchNumeric(out double dn)) - { - translation.Diameter = dn; - translation.UpdatePropStatus(nameof(translation.Diameter), ePropStatus.Lack, "[鐩村緞淇℃伅]閫氳繃[鍏О鐩村緞]杩涜淇]"); - } - else - { - translation.UpdatePropStatus(nameof(translation.Diameter), ePropStatus.Abnormal, "[鐩村緞淇℃伅]鏃犳硶閫氳繃[鍏О鐩村緞]杩涜淇]"); - } - } + #region EndDiameter - if (translation.Diameter < 1) + if (jobject[RevitJsonProp.MinSize].MatchNumeric(out double minSize)) { - translation.Diameter = 500; - translation.UpdatePropStatus(nameof(translation.Diameter), ePropStatus.Lack, "[鐩村緞淇℃伅][鍐呭緞]瑙f瀽閿欒锛屼娇鐢ㄩ粯璁ゅ��(500mm)淇]"); + translation.EndDiameter = minSize; } #endregion @@ -4172,6 +4700,11 @@ pump.UpdatePropStatus(nameof(pump.Flags), ePropStatus.Error, "缂哄皯[鏍囩淇℃伅]"); } + if (pump.Flags == null) + { + pump.Flags = new List<string>(); + } + #endregion #region Description @@ -4276,7 +4809,7 @@ #region Elev - if (jobject[RevitJsonProp.Elev].MatchNumeric(out double elev)) + if (jobject[RevitJsonProp.ElevInfo].MatchNumeric(out double elev)) { pump.Elev = elev; } @@ -4290,6 +4823,17 @@ if (jobject[RevitJsonProp.ElevOfElevation].MatchNumeric(out double elevOfElevation)) { pump.Elev = elevOfElevation / 1000f; + var jre = jobject[RevitJsonProp.Elev]; + if (jre != null) + { + if (jre.HasValues) + { + if (jre[RevitJsonProp.ElevFacade].MatchNumeric(out double facade)) + { + pump.Elev += facade / 1000f; + } + } + } } else { @@ -4570,6 +5114,11 @@ valve.UpdatePropStatus(nameof(valve.Flags), ePropStatus.Error, "缂哄皯[鏍囩淇℃伅]"); } + if (valve.Flags == null) + { + valve.Flags = new List<string>(); + } + #endregion #region Description @@ -4647,7 +5196,7 @@ #region Elev - if (jobject[RevitJsonProp.Elev].MatchNumeric(out double elev)) + if (jobject[RevitJsonProp.ElevInfo].MatchNumeric(out double elev)) { valve.Elev = elev; } @@ -4661,6 +5210,17 @@ if (jobject[RevitJsonProp.ElevOfElevation].MatchNumeric(out double elevOfElevation)) { valve.Elev = elevOfElevation / 1000f; + var jre = jobject[RevitJsonProp.Elev]; + if (jre != null) + { + if (jre.HasValues) + { + if (jre[RevitJsonProp.ElevFacade].MatchNumeric(out double facade)) + { + valve.Elev += facade / 1000f; + } + } + } } else { @@ -4734,7 +5294,7 @@ #region Diameter - if (jobject[RevitJsonProp.Diameter].MatchNumeric(out double diameter)) + if (jobject[RevitJsonProp.DiameterInfo].MatchNumeric(out double diameter)) { valve.Diameter = diameter; } @@ -4745,9 +5305,9 @@ if (valve.Diameter < 1) { - if (jobject[RevitJsonProp.InternalDiameter].MatchNumeric(out double internalDiameter)) + if (jobject[RevitJsonProp.InternalDiameter].MatchNumeric(out diameter)) { - valve.Diameter = internalDiameter; + valve.Diameter = diameter; valve.UpdatePropStatus(nameof(valve.Diameter), ePropStatus.Lack, "[鐩村緞淇℃伅]閫氳繃[鍐呭緞]杩涜淇]"); } else @@ -4758,9 +5318,9 @@ if (valve.Diameter < 1) { - if (jobject[RevitJsonProp.DN].MatchNumeric(out double dn)) + if (jobject[RevitJsonProp.DN].MatchNumeric(out diameter)) { - valve.Diameter = dn; + valve.Diameter = diameter; valve.UpdatePropStatus(nameof(valve.Diameter), ePropStatus.Lack, "[鐩村緞淇℃伅]閫氳繃[鍏О鐩村緞]杩涜淇]"); } else @@ -4771,8 +5331,33 @@ if (valve.Diameter < 1) { - valve.Diameter = 500; - valve.UpdatePropStatus(nameof(valve.Diameter), ePropStatus.Lack, "[鐩村緞淇℃伅][鍐呭緞]瑙f瀽閿欒锛屼娇鐢ㄩ粯璁ゅ��(500mm)淇]"); + if (jobject[RevitJsonProp.MaxSize].MatchNumeric(out diameter)) + { + valve.Diameter = diameter; + valve.UpdatePropStatus(nameof(valve.Diameter), ePropStatus.Lack, "[鐩村緞淇℃伅]閫氳繃[鏈�澶у昂瀵竇杩涜淇]"); + } + else + { + valve.UpdatePropStatus(nameof(valve.Diameter), ePropStatus.Abnormal, "[鐩村緞淇℃伅]鏃犳硶閫氳繃[鏈�澶у昂瀵竇杩涜淇]"); + } + } + + if (valve.Diameter < 1) + { + if (jobject[RevitJsonProp.MinSize].MatchNumeric(out diameter)) + { + valve.Diameter = diameter; + valve.UpdatePropStatus(nameof(valve.Diameter), ePropStatus.Lack, "[鐩村緞淇℃伅]閫氳繃[鏈�灏忓昂瀵竇杩涜淇]"); + } + else + { + valve.UpdatePropStatus(nameof(valve.Diameter), ePropStatus.Abnormal, "[鐩村緞淇℃伅]鏃犳硶閫氳繃[鏈�灏忓昂瀵竇杩涜淇]"); + } + } + + if (valve.Diameter < 1) + { + valve.UpdatePropStatus(nameof(valve.Diameter), ePropStatus.Lack, "[鐩村緞淇℃伅]瑙f瀽閿欒锛屾棤娉曢�氳繃[鍐呭緞][鍏О鐩村緞][鏈�澶у昂瀵竇[鏈�灏忓昂瀵竇淇"); } #endregion @@ -4845,7 +5430,7 @@ else { valve.OpeningDegree = 100; - valve.UpdatePropStatus(nameof(valve.MinorLoss), ePropStatus.Abnormal, "[闃�闂ㄥ紑搴缂哄皯鎴栬�呮暟鎹牸寮忛敊璇紝浣跨敤榛樿鍊�(100)杩涜淇"); + valve.UpdatePropStatus(nameof(valve.OpeningDegree), ePropStatus.Abnormal, "[闃�闂ㄥ紑搴缂哄皯鎴栬�呮暟鎹牸寮忛敊璇紝浣跨敤榛樿鍊�(100)杩涜淇"); } #endregion @@ -4946,6 +5531,11 @@ else { exchanger.UpdatePropStatus(nameof(exchanger.Flags), ePropStatus.Error, "缂哄皯[鏍囩淇℃伅]"); + } + + if (exchanger.Flags == null) + { + exchanger.Flags = new List<string>(); } #endregion @@ -5052,7 +5642,7 @@ #region Elev - if (jobject[RevitJsonProp.Elev].MatchNumeric(out double elev)) + if (jobject[RevitJsonProp.ElevInfo].MatchNumeric(out double elev)) { exchanger.Elev = elev; } @@ -5066,6 +5656,22 @@ if (jobject[RevitJsonProp.ElevOfElevation].MatchNumeric(out double elevOfElevation)) { exchanger.Elev = elevOfElevation / 1000f; + var jre = jobject[RevitJsonProp.Elev]; + + if (!jre.HasValues) + { + + } + if (jre != null) + { + if (jre.HasValues) + { + if (jre[RevitJsonProp.ElevFacade].MatchNumeric(out double facade)) + { + exchanger.Elev += facade / 1000f; + } + } + } } else { @@ -5112,7 +5718,7 @@ #region Diameter - if (jobject[RevitJsonProp.Diameter].MatchNumeric(out double diameter)) + if (jobject[RevitJsonProp.DiameterInfo].MatchNumeric(out double diameter)) { exchanger.Diameter = diameter; } @@ -5266,6 +5872,11 @@ compressor.UpdatePropStatus(nameof(compressor.Flags), ePropStatus.Error, "缂哄皯[鏍囩淇℃伅]"); } + if (compressor.Flags == null) + { + compressor.Flags = new List<string>(); + } + #endregion #region Description @@ -5370,7 +5981,7 @@ #region Elev - if (jobject[RevitJsonProp.Elev].MatchNumeric(out double elev)) + if (jobject[RevitJsonProp.ElevInfo].MatchNumeric(out double elev)) { compressor.Elev = elev; } @@ -5384,6 +5995,17 @@ if (jobject[RevitJsonProp.ElevOfElevation].MatchNumeric(out double elevOfElevation)) { compressor.Elev = elevOfElevation / 1000f; + var jre = jobject[RevitJsonProp.Elev]; + if (jre != null) + { + if (jre.HasValues) + { + if (jre[RevitJsonProp.ElevFacade].MatchNumeric(out double facade)) + { + compressor.Elev += facade / 1000f; + } + } + } } else { @@ -5430,7 +6052,7 @@ #region Diameter - if (jobject[RevitJsonProp.Diameter].MatchNumeric(out double diameter)) + if (jobject[RevitJsonProp.DiameterInfo].MatchNumeric(out double diameter)) { compressor.Diameter = diameter; } -- Gitblit v1.9.3