| | |
| | | model.Fourlinks.Add(fourlink); |
| | | } |
| | | break; |
| | | case RevitJsonCatalog.Meter: |
| | | { |
| | | var meter = new Model.RevitMeter(); |
| | | meter.Id = jobject[RevitJsonProp.Id].ToString(); |
| | | meter.Code = jobject[RevitJsonProp.Code].ToString(); |
| | | if (string.IsNullOrEmpty(meter.Code)) |
| | | { |
| | | meter.Code = meter.Id; |
| | | } |
| | | meter.Name = jobject[RevitJsonProp.Name].ToString(); |
| | | meter.ModelType = jobject[RevitJsonProp.ModelType].ToString(); |
| | | meter.Flags = Yw.Untity.FlagsHelper.ToList(jobject[RevitJsonProp.Flags].ToString()); |
| | | meter.Description = jobject[RevitJsonProp.Description].ToString(); |
| | | if (jobject[RevitJsonProp.Quality].MatchNumeric(out double quality)) |
| | | { |
| | | meter.Quality = quality; |
| | | } |
| | | var linkList = JsonHelper.Json2Object<List<RevitJsonLinkerModel>>(jobject[RevitJsonProp.Links].ToString()); |
| | | var centerPoint = linkList.GetCenterPoint(); |
| | | meter.Position = new Model.RevitPosition() |
| | | { |
| | | X = centerPoint.X, |
| | | Y = centerPoint.Y, |
| | | Z = centerPoint.Z |
| | | }; |
| | | if (jobject[RevitJsonProp.Elev].MatchNumeric(out double elev)) |
| | | { |
| | | meter.Elev = elev; |
| | | } |
| | | if (jobject[RevitJsonProp.Demand].MatchNumeric(out double demand)) |
| | | { |
| | | meter.Demand = demand; |
| | | } |
| | | meter.DemandPattern = jobject[RevitJsonProp.DemandPattern].ToString(); |
| | | model.Meters.Add(meter); |
| | | } |
| | | break; |
| | | case RevitJsonCatalog.Flowmeter: |
| | | { |
| | | var flowmeter = new Model.RevitFlowmeter(); |
| | |
| | | model.Translations.Add(translation); |
| | | } |
| | | break; |
| | | case RevitJsonCatalog.Exchanger: |
| | | { |
| | | var exchanger = new Model.RevitExchanger(); |
| | | exchanger.Id = jobject[RevitJsonProp.Id].ToString(); |
| | | exchanger.Code = jobject[RevitJsonProp.Code].ToString(); |
| | | if (string.IsNullOrEmpty(exchanger.Code)) |
| | | { |
| | | exchanger.Code = exchanger.Id; |
| | | } |
| | | exchanger.Name = jobject[RevitJsonProp.Name].ToString(); |
| | | exchanger.ModelType = jobject[RevitJsonProp.ModelType].ToString(); |
| | | exchanger.Flags = Yw.Untity.FlagsHelper.ToList(jobject[RevitJsonProp.Flags].ToString()); |
| | | exchanger.Description = jobject[RevitJsonProp.Description].ToString(); |
| | | var linkList = JsonHelper.Json2Object<List<RevitJsonLinkerModel>>(jobject[RevitJsonProp.Links].ToString()); |
| | | var startLinker = linkList.GetStartLinker(); |
| | | var endLinker = linkList.GetEndLinker(); |
| | | exchanger.StartCode = startLinker.ConnectId; |
| | | exchanger.EndCode = endLinker.ConnectId; |
| | | exchanger.StartPosition = new Model.RevitPosition() |
| | | { |
| | | X = startLinker.Point.X, |
| | | Y = startLinker.Point.Y, |
| | | Z = startLinker.Point.Z |
| | | }; |
| | | exchanger.EndPosition = new Model.RevitPosition() |
| | | { |
| | | X = endLinker.Point.X, |
| | | Y = endLinker.Point.Y, |
| | | Z = endLinker.Point.Z |
| | | }; |
| | | exchanger.LinkStatus = jobject[RevitJsonProp.LinkStatusPipe].ToString(); |
| | | if (jobject[RevitJsonProp.StartElev].MatchNumeric(out double startElev)) |
| | | { |
| | | exchanger.StartElev = startElev; |
| | | } |
| | | if (jobject[RevitJsonProp.EndElev].MatchNumeric(out double endElev)) |
| | | { |
| | | exchanger.EndElev = endElev; |
| | | } |
| | | if (jobject[RevitJsonProp.StartQuality].MatchNumeric(out double startQuality)) |
| | | { |
| | | exchanger.StartQuality = startQuality; |
| | | } |
| | | if (jobject[RevitJsonProp.EndQuality].MatchNumeric(out double endQuality)) |
| | | { |
| | | exchanger.EndQuality = endQuality; |
| | | } |
| | | |
| | | if (jobject[RevitJsonProp.Length].MatchNumeric(out double length)) |
| | | { |
| | | exchanger.Length = length; |
| | | } |
| | | if (jobject[RevitJsonProp.Diameter].MatchNumeric(out double diameter)) |
| | | { |
| | | exchanger.Diameter = diameter; |
| | | } |
| | | else if (jobject[RevitJsonProp.InternalDiameter].MatchNumeric(out double internalDiameter)) |
| | | { |
| | | exchanger.Diameter = internalDiameter; |
| | | } |
| | | if (jobject[RevitJsonProp.MinorLoss].MatchNumeric(out double minorLoss)) |
| | | { |
| | | exchanger.MinorLoss = minorLoss; |
| | | } |
| | | if (jobject[RevitJsonProp.Roughness].MatchNumeric(out double roughness)) |
| | | { |
| | | exchanger.Roughness = roughness; |
| | | } |
| | | model.Exchangers.Add(exchanger); |
| | | } |
| | | break; |
| | | case RevitJsonCatalog.Pump: |
| | | { |
| | | var pump = new Model.RevitPump(); |