From dd1edf413dadf60090524fb8597a76d1bfc65ed7 Mon Sep 17 00:00:00 2001 From: Pawel Baran Date: Wed, 22 Mar 2023 19:25:13 +0100 Subject: [PATCH 1/2] NotImplementedAttributes added to relevant getters --- Revit_Core_Engine/Objects/SpecTypeId.cs | 39 +++++------ Revit_Core_Engine/Objects/UnitTypeId.cs | 91 +++++++++++++------------ 2 files changed, 66 insertions(+), 64 deletions(-) diff --git a/Revit_Core_Engine/Objects/SpecTypeId.cs b/Revit_Core_Engine/Objects/SpecTypeId.cs index 73df27f4f..854355741 100644 --- a/Revit_Core_Engine/Objects/SpecTypeId.cs +++ b/Revit_Core_Engine/Objects/SpecTypeId.cs @@ -22,6 +22,7 @@ using Autodesk.Revit.DB; +using BH.oM.Base.Attributes; using System.ComponentModel; #if (REVIT2018 || REVIT2019 || REVIT2020) @@ -166,27 +167,27 @@ public static partial class SpecTypeId public static UnitType PipingTemperatureDifference { get { return UnitType.UT_Piping_TemperatureDifference; } } public static UnitType ElectricalTemperatureDifference { get { return UnitType.UT_Electrical_TemperatureDifference; } } public static UnitType Custom { get { return UnitType.UT_Custom; } } - - public static UnitType Stationing { get { return NonExistentUnitType(nameof(Stationing), 2021); } } - public static UnitType ThermalGradientCoefficientForMoistureCapacity { get { return NonExistentUnitType(nameof(ThermalGradientCoefficientForMoistureCapacity), 2021); } } - public static UnitType StationingInterval { get { return NonExistentUnitType(nameof(StationingInterval), 2021); } } - public static UnitType RotationAngle { get { return NonExistentUnitType(nameof(RotationAngle), 2021); } } - public static UnitType PowerPerLength { get { return NonExistentUnitType(nameof(PowerPerLength), 2021); } } - public static UnitType PowerPerFlow { get { return NonExistentUnitType(nameof(PowerPerFlow), 2021); } } - public static UnitType PipingMassPerTime { get { return NonExistentUnitType(nameof(PipingMassPerTime), 2021); } } - public static UnitType IsothermalMoistureCapacity { get { return NonExistentUnitType(nameof(IsothermalMoistureCapacity), 2021); } } - public static UnitType HvacMassPerTime { get { return NonExistentUnitType(nameof(HvacMassPerTime), 2021); } } - public static UnitType FlowPerPower { get { return NonExistentUnitType(nameof(FlowPerPower), 2021); } } - public static UnitType Distance { get { return NonExistentUnitType(nameof(Distance), 2021); } } - public static UnitType Diffusivity { get { return NonExistentUnitType(nameof(Diffusivity), 2021); } } - public static UnitType CostRatePower { get { return NonExistentUnitType(nameof(CostRatePower), 2021); } } - public static UnitType CostRateEnergy { get { return NonExistentUnitType(nameof(CostRateEnergy), 2021); } } - public static UnitType CostPerArea { get { return NonExistentUnitType(nameof(CostPerArea), 2021); } } - public static UnitType AngularSpeed { get { return NonExistentUnitType(nameof(AngularSpeed), 2021); } } + + public static UnitType Stationing { [NotImplemented] get { return NonExistentUnitType(nameof(Stationing), 2021); } } + public static UnitType ThermalGradientCoefficientForMoistureCapacity { [NotImplemented] get { return NonExistentUnitType(nameof(ThermalGradientCoefficientForMoistureCapacity), 2021); } } + public static UnitType StationingInterval { [NotImplemented] get { return NonExistentUnitType(nameof(StationingInterval), 2021); } } + public static UnitType RotationAngle { [NotImplemented] get { return NonExistentUnitType(nameof(RotationAngle), 2021); } } + public static UnitType PowerPerLength { [NotImplemented] get { return NonExistentUnitType(nameof(PowerPerLength), 2021); } } + public static UnitType PowerPerFlow { [NotImplemented] get { return NonExistentUnitType(nameof(PowerPerFlow), 2021); } } + public static UnitType PipingMassPerTime { [NotImplemented] get { return NonExistentUnitType(nameof(PipingMassPerTime), 2021); } } + public static UnitType IsothermalMoistureCapacity { [NotImplemented] get { return NonExistentUnitType(nameof(IsothermalMoistureCapacity), 2021); } } + public static UnitType HvacMassPerTime { [NotImplemented] get { return NonExistentUnitType(nameof(HvacMassPerTime), 2021); } } + public static UnitType FlowPerPower { [NotImplemented] get { return NonExistentUnitType(nameof(FlowPerPower), 2021); } } + public static UnitType Distance { [NotImplemented] get { return NonExistentUnitType(nameof(Distance), 2021); } } + public static UnitType Diffusivity { [NotImplemented] get { return NonExistentUnitType(nameof(Diffusivity), 2021); } } + public static UnitType CostRatePower { [NotImplemented] get { return NonExistentUnitType(nameof(CostRatePower), 2021); } } + public static UnitType CostRateEnergy { [NotImplemented] get { return NonExistentUnitType(nameof(CostRateEnergy), 2021); } } + public static UnitType CostPerArea { [NotImplemented] get { return NonExistentUnitType(nameof(CostPerArea), 2021); } } + public static UnitType AngularSpeed { [NotImplemented] get { return NonExistentUnitType(nameof(AngularSpeed), 2021); } } #if (REVIT2018 || REVIT2019) - public static UnitType Time { get { return NonExistentUnitType(nameof(Time), 2020); } } - public static UnitType Speed { get { return NonExistentUnitType(nameof(Speed), 2020); } } + public static UnitType Time { [NotImplemented] get { return NonExistentUnitType(nameof(Time), 2020); } } + public static UnitType Speed { [NotImplemented] get { return NonExistentUnitType(nameof(Speed), 2020); } } #else public static UnitType Time { get { return UnitType.UT_TimeInterval; } } public static UnitType Speed { get { return UnitType.UT_Speed; } } diff --git a/Revit_Core_Engine/Objects/UnitTypeId.cs b/Revit_Core_Engine/Objects/UnitTypeId.cs index 4552c4590..ecb38376e 100644 --- a/Revit_Core_Engine/Objects/UnitTypeId.cs +++ b/Revit_Core_Engine/Objects/UnitTypeId.cs @@ -21,6 +21,7 @@ */ using Autodesk.Revit.DB; +using BH.oM.Base.Attributes; using System.ComponentModel; #if (REVIT2018 || REVIT2019 || REVIT2020) @@ -282,51 +283,51 @@ public static class UnitTypeId public static DisplayUnitType RankineInterval { get { return DisplayUnitType.DUT_RANKINE_DIFFERENCE; } } public static DisplayUnitType Custom { get { return DisplayUnitType.DUT_CUSTOM; } } - public static DisplayUnitType StationingMeters { get { return NonExistent(nameof(StationingMeters), 2021); } } - public static DisplayUnitType StationingFeet { get { return NonExistent(nameof(StationingFeet), 2021); } } - public static DisplayUnitType CubicFeetPerHour { get { return NonExistent(nameof(CubicFeetPerHour), 2021); } } - public static DisplayUnitType LitersPerHour { get { return NonExistent(nameof(LitersPerHour), 2021); } } - public static DisplayUnitType RatioTo1 { get { return NonExistent(nameof(RatioTo1), 2021); } } - public static DisplayUnitType UsSurveyFeet { get { return NonExistent(nameof(UsSurveyFeet), 2021); } } - public static DisplayUnitType WattsPerMeter { get { return NonExistent(nameof(WattsPerMeter), 2021); } } - public static DisplayUnitType WattsPerFoot { get { return NonExistent(nameof(WattsPerFoot), 2021); } } - public static DisplayUnitType WattsPerCubicMeterPerSecond { get { return NonExistent(nameof(WattsPerCubicMeterPerSecond), 2021); } } - public static DisplayUnitType WattsPerCubicFootPerMinute { get { return NonExistent(nameof(WattsPerCubicFootPerMinute), 2021); } } - public static DisplayUnitType ThousandBritishThermalUnitsPerHour { get { return NonExistent(nameof(ThousandBritishThermalUnitsPerHour), 2021); } } - public static DisplayUnitType SquareMetersPerSecond { get { return NonExistent(nameof(SquareMetersPerSecond), 2021); } } - public static DisplayUnitType SquareFeetPerSecond { get { return NonExistent(nameof(SquareFeetPerSecond), 2021); } } - public static DisplayUnitType RevolutionsPerSecond { get { return NonExistent(nameof(RevolutionsPerSecond), 2021); } } - public static DisplayUnitType RevolutionsPerMinute { get { return NonExistent(nameof(RevolutionsPerMinute), 2021); } } - public static DisplayUnitType PoundsMassPerSecond { get { return NonExistent(nameof(PoundsMassPerSecond), 2021); } } - public static DisplayUnitType PoundsMassPerPoundDegreeFahrenheit { get { return NonExistent(nameof(PoundsMassPerPoundDegreeFahrenheit), 2021); } } - public static DisplayUnitType PoundsMassPerMinute { get { return NonExistent(nameof(PoundsMassPerMinute), 2021); } } - public static DisplayUnitType PoundsMassPerHour { get { return NonExistent(nameof(PoundsMassPerHour), 2021); } } - public static DisplayUnitType PoundForceSecondsPerSquareFoot { get { return NonExistent(nameof(PoundForceSecondsPerSquareFoot), 2021); } } - public static DisplayUnitType Pi { get { return NonExistent(nameof(Pi), 2021); } } - public static DisplayUnitType NewtonSecondsPerSquareMeter { get { return NonExistent(nameof(NewtonSecondsPerSquareMeter), 2021); } } - public static DisplayUnitType MillimetersOfWaterColumnPerMeter { get { return NonExistent(nameof(MillimetersOfWaterColumnPerMeter), 2021); } } - public static DisplayUnitType MillimetersOfWaterColumn { get { return NonExistent(nameof(MillimetersOfWaterColumn), 2021); } } - public static DisplayUnitType MetersOfWaterColumnPerMeter { get { return NonExistent(nameof(MetersOfWaterColumnPerMeter), 2021); } } - public static DisplayUnitType MetersOfWaterColumn { get { return NonExistent(nameof(MetersOfWaterColumn), 2021); } } - public static DisplayUnitType KilogramsPerSecond { get { return NonExistent(nameof(KilogramsPerSecond), 2021); } } - public static DisplayUnitType KilogramsPerMinute { get { return NonExistent(nameof(KilogramsPerMinute), 2021); } } - public static DisplayUnitType KilogramsPerMeterSecond { get { return NonExistent(nameof(KilogramsPerMeterSecond), 2021); } } - public static DisplayUnitType KilogramsPerMeterHour { get { return NonExistent(nameof(KilogramsPerMeterHour), 2021); } } - public static DisplayUnitType KilogramsPerKilogramKelvin { get { return NonExistent(nameof(KilogramsPerKilogramKelvin), 2021); } } - public static DisplayUnitType KilogramsPerHour { get { return NonExistent(nameof(KilogramsPerHour), 2021); } } - public static DisplayUnitType CurrencyPerWattHour { get { return NonExistent(nameof(CurrencyPerWattHour), 2021); } } - public static DisplayUnitType CurrencyPerWatt { get { return NonExistent(nameof(CurrencyPerWatt), 2021); } } - public static DisplayUnitType CurrencyPerSquareMeter { get { return NonExistent(nameof(CurrencyPerSquareMeter), 2021); } } - public static DisplayUnitType CurrencyPerSquareFoot { get { return NonExistent(nameof(CurrencyPerSquareFoot), 2021); } } - public static DisplayUnitType CurrencyPerBritishThermalUnitPerHour { get { return NonExistent(nameof(CurrencyPerBritishThermalUnitPerHour), 2021); } } - public static DisplayUnitType CurrencyPerBritishThermalUnit { get { return NonExistent(nameof(CurrencyPerBritishThermalUnit), 2021); } } - public static DisplayUnitType CubicMetersPerWattSecond { get { return NonExistent(nameof(CubicMetersPerWattSecond), 2021); } } - public static DisplayUnitType CubicMetersPerKilogram { get { return NonExistent(nameof(CubicMetersPerKilogram), 2021); } } - public static DisplayUnitType CubicMetersPerHourSquareMeter { get { return NonExistent(nameof(CubicMetersPerHourSquareMeter), 2021); } } - public static DisplayUnitType CubicMetersPerHourCubicMeter { get { return NonExistent(nameof(CubicMetersPerHourCubicMeter), 2021); } } - public static DisplayUnitType CubicFeetPerPoundMass { get { return NonExistent(nameof(CubicFeetPerPoundMass), 2021); } } - public static DisplayUnitType CubicFeetPerMinutePerBritishThermalUnitPerHour { get { return NonExistent(nameof(CubicFeetPerMinutePerBritishThermalUnitPerHour), 2021); } } - public static DisplayUnitType CandelasPerSquareFoot { get { return NonExistent(nameof(CandelasPerSquareFoot), 2021); } } + public static DisplayUnitType StationingMeters { [NotImplemented] get { return NonExistent(nameof(StationingMeters), 2021); } } + public static DisplayUnitType StationingFeet { [NotImplemented] get { return NonExistent(nameof(StationingFeet), 2021); } } + public static DisplayUnitType CubicFeetPerHour { [NotImplemented] get { return NonExistent(nameof(CubicFeetPerHour), 2021); } } + public static DisplayUnitType LitersPerHour { [NotImplemented] get { return NonExistent(nameof(LitersPerHour), 2021); } } + public static DisplayUnitType RatioTo1 { [NotImplemented] get { return NonExistent(nameof(RatioTo1), 2021); } } + public static DisplayUnitType UsSurveyFeet { [NotImplemented] get { return NonExistent(nameof(UsSurveyFeet), 2021); } } + public static DisplayUnitType WattsPerMeter { [NotImplemented] get { return NonExistent(nameof(WattsPerMeter), 2021); } } + public static DisplayUnitType WattsPerFoot { [NotImplemented] get { return NonExistent(nameof(WattsPerFoot), 2021); } } + public static DisplayUnitType WattsPerCubicMeterPerSecond { [NotImplemented] get { return NonExistent(nameof(WattsPerCubicMeterPerSecond), 2021); } } + public static DisplayUnitType WattsPerCubicFootPerMinute { [NotImplemented] get { return NonExistent(nameof(WattsPerCubicFootPerMinute), 2021); } } + public static DisplayUnitType ThousandBritishThermalUnitsPerHour { [NotImplemented] get { return NonExistent(nameof(ThousandBritishThermalUnitsPerHour), 2021); } } + public static DisplayUnitType SquareMetersPerSecond { [NotImplemented] get { return NonExistent(nameof(SquareMetersPerSecond), 2021); } } + public static DisplayUnitType SquareFeetPerSecond { [NotImplemented] get { return NonExistent(nameof(SquareFeetPerSecond), 2021); } } + public static DisplayUnitType RevolutionsPerSecond { [NotImplemented] get { return NonExistent(nameof(RevolutionsPerSecond), 2021); } } + public static DisplayUnitType RevolutionsPerMinute { [NotImplemented] get { return NonExistent(nameof(RevolutionsPerMinute), 2021); } } + public static DisplayUnitType PoundsMassPerSecond { [NotImplemented] get { return NonExistent(nameof(PoundsMassPerSecond), 2021); } } + public static DisplayUnitType PoundsMassPerPoundDegreeFahrenheit { [NotImplemented] get { return NonExistent(nameof(PoundsMassPerPoundDegreeFahrenheit), 2021); } } + public static DisplayUnitType PoundsMassPerMinute { [NotImplemented] get { return NonExistent(nameof(PoundsMassPerMinute), 2021); } } + public static DisplayUnitType PoundsMassPerHour { [NotImplemented] get { return NonExistent(nameof(PoundsMassPerHour), 2021); } } + public static DisplayUnitType PoundForceSecondsPerSquareFoot { [NotImplemented] get { return NonExistent(nameof(PoundForceSecondsPerSquareFoot), 2021); } } + public static DisplayUnitType Pi { [NotImplemented] get { return NonExistent(nameof(Pi), 2021); } } + public static DisplayUnitType NewtonSecondsPerSquareMeter { [NotImplemented] get { return NonExistent(nameof(NewtonSecondsPerSquareMeter), 2021); } } + public static DisplayUnitType MillimetersOfWaterColumnPerMeter { [NotImplemented] get { return NonExistent(nameof(MillimetersOfWaterColumnPerMeter), 2021); } } + public static DisplayUnitType MillimetersOfWaterColumn { [NotImplemented] get { return NonExistent(nameof(MillimetersOfWaterColumn), 2021); } } + public static DisplayUnitType MetersOfWaterColumnPerMeter { [NotImplemented] get { return NonExistent(nameof(MetersOfWaterColumnPerMeter), 2021); } } + public static DisplayUnitType MetersOfWaterColumn { [NotImplemented] get { return NonExistent(nameof(MetersOfWaterColumn), 2021); } } + public static DisplayUnitType KilogramsPerSecond { [NotImplemented] get { return NonExistent(nameof(KilogramsPerSecond), 2021); } } + public static DisplayUnitType KilogramsPerMinute { [NotImplemented] get { return NonExistent(nameof(KilogramsPerMinute), 2021); } } + public static DisplayUnitType KilogramsPerMeterSecond { [NotImplemented] get { return NonExistent(nameof(KilogramsPerMeterSecond), 2021); } } + public static DisplayUnitType KilogramsPerMeterHour { [NotImplemented] get { return NonExistent(nameof(KilogramsPerMeterHour), 2021); } } + public static DisplayUnitType KilogramsPerKilogramKelvin { [NotImplemented] get { return NonExistent(nameof(KilogramsPerKilogramKelvin), 2021); } } + public static DisplayUnitType KilogramsPerHour { [NotImplemented] get { return NonExistent(nameof(KilogramsPerHour), 2021); } } + public static DisplayUnitType CurrencyPerWattHour { [NotImplemented] get { return NonExistent(nameof(CurrencyPerWattHour), 2021); } } + public static DisplayUnitType CurrencyPerWatt { [NotImplemented] get { return NonExistent(nameof(CurrencyPerWatt), 2021); } } + public static DisplayUnitType CurrencyPerSquareMeter { [NotImplemented] get { return NonExistent(nameof(CurrencyPerSquareMeter), 2021); } } + public static DisplayUnitType CurrencyPerSquareFoot { [NotImplemented] get { return NonExistent(nameof(CurrencyPerSquareFoot), 2021); } } + public static DisplayUnitType CurrencyPerBritishThermalUnitPerHour { [NotImplemented] get { return NonExistent(nameof(CurrencyPerBritishThermalUnitPerHour), 2021); } } + public static DisplayUnitType CurrencyPerBritishThermalUnit { [NotImplemented] get { return NonExistent(nameof(CurrencyPerBritishThermalUnit), 2021); } } + public static DisplayUnitType CubicMetersPerWattSecond { [NotImplemented] get { return NonExistent(nameof(CubicMetersPerWattSecond), 2021); } } + public static DisplayUnitType CubicMetersPerKilogram { [NotImplemented] get { return NonExistent(nameof(CubicMetersPerKilogram), 2021); } } + public static DisplayUnitType CubicMetersPerHourSquareMeter { [NotImplemented] get { return NonExistent(nameof(CubicMetersPerHourSquareMeter), 2021); } } + public static DisplayUnitType CubicMetersPerHourCubicMeter { [NotImplemented] get { return NonExistent(nameof(CubicMetersPerHourCubicMeter), 2021); } } + public static DisplayUnitType CubicFeetPerPoundMass { [NotImplemented] get { return NonExistent(nameof(CubicFeetPerPoundMass), 2021); } } + public static DisplayUnitType CubicFeetPerMinutePerBritishThermalUnitPerHour { [NotImplemented] get { return NonExistent(nameof(CubicFeetPerMinutePerBritishThermalUnitPerHour), 2021); } } + public static DisplayUnitType CandelasPerSquareFoot { [NotImplemented] get { return NonExistent(nameof(CandelasPerSquareFoot), 2021); } } /***************************************************/ From f21a950de6a7fc423e6e60bc6986aa2aee98b623 Mon Sep 17 00:00:00 2001 From: Pawel Baran Date: Wed, 22 Mar 2023 19:25:25 +0100 Subject: [PATCH 2/2] #1325 fixed --- Revit_Core_Engine/Query/UnitTypeByPropertyName.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Revit_Core_Engine/Query/UnitTypeByPropertyName.cs b/Revit_Core_Engine/Query/UnitTypeByPropertyName.cs index 834c4c934..e630d1e4e 100644 --- a/Revit_Core_Engine/Query/UnitTypeByPropertyName.cs +++ b/Revit_Core_Engine/Query/UnitTypeByPropertyName.cs @@ -73,9 +73,12 @@ private static void CollectUnitTypes() m_UnitTypesWithIdentifiers = new Dictionary(); foreach (PropertyInfo info in typeof(SpecTypeId).GetProperties()) { - UnitType? unitType = info.GetValue(null) as UnitType?; - if (unitType != null && unitType != UnitType.UT_Undefined) - m_UnitTypesWithIdentifiers.Add(info.Name, unitType.Value); + if (info.GetGetMethod().GetCustomAttribute() == null) + { + UnitType? unitType = info.GetValue(null) as UnitType?; + if (unitType != null && unitType != UnitType.UT_Undefined) + m_UnitTypesWithIdentifiers.Add(info.Name, unitType.Value); + } } }