From 931cdd251757f72d0ecf82d3fb3c032e845e6665 Mon Sep 17 00:00:00 2001 From: Claudio Benghi Date: Mon, 1 Apr 2024 13:24:02 +0200 Subject: [PATCH] Fixed measure information. --- ids-lib.codegen/buildingSMART/units.md | 2 +- ids-lib/IfcSchema/IfcMeasureInformation.cs | 15 +++++++++------ ids-lib/IfcSchema/SchemaInfo.MeasureNames.g.cs | 2 +- ids-lib/LibraryInformation.cs | 2 +- ids-lib/ids-lib.csproj | 2 +- ids-tool.tests/IfcSchemaTests.cs | 12 ++++++++++++ ids-tool/ids-tool.csproj | 2 +- 7 files changed, 26 insertions(+), 11 deletions(-) diff --git a/ids-lib.codegen/buildingSMART/units.md b/ids-lib.codegen/buildingSMART/units.md index 8821d2e..a174380 100644 --- a/ids-lib.codegen/buildingSMART/units.md +++ b/ids-lib.codegen/buildingSMART/units.md @@ -49,7 +49,7 @@ The order of dimensional exponent units is `(m, Kg, s, A, K, mol, cd)`. | IFCMAGNETICFLUXMEASURE | Magnetic flux | weber | Wb | Wb | (2, 1, -2, -1, 0, 0, 0) | IfcDerivedUnitEnum.MAGNETICFLUXUNIT | | IFCMASSDENSITYMEASURE | Mass density | | | Kg / m3 | (-3, 1, 0, 0, 0, 0, 0) | IfcDerivedUnitEnum.MASSDENSITYUNIT | | IFCMASSFLOWRATEMEASURE | Mass flow rate | | | Kg / s | (0, 1, -1, 0, 0, 0, 0) | IfcDerivedUnitEnum.MASSFLOWRATEUNIT | -| IFCMASSMEASURE | Mass | kilogram | | Kg | (0, 1, 0, 0, 0, 0, 0) | IfcUnitEnum.MASSUNIT | +| IFCMASSMEASURE | Mass | kilogram | Kg | Kg | (0, 1, 0, 0, 0, 0, 0) | IfcUnitEnum.MASSUNIT | | IFCMASSPERLENGTHMEASURE | Mass per length | | | Kg / m | (-1, 1, 0, 0, 0, 0, 0) | IfcDerivedUnitEnum.MASSPERLENGTHUNIT | | IFCMODULUSOFELASTICITYMEASURE | Modulus of elasticity | | | N / m2 | (-1, 1, -2, 0, 0, 0, 0) | IfcDerivedUnitEnum.MODULUSOFELASTICITYUNIT | | IFCMODULUSOFLINEARSUBGRADEREACTIONMEASURE | Modulus of linear subgrade reaction | | | N / m2 | (-1, 1, -2, 0, 0, 0, 0) | IfcDerivedUnitEnum.MODULUSOFLINEARSUBGRADEREACTIONUNIT | diff --git a/ids-lib/IfcSchema/IfcMeasureInformation.cs b/ids-lib/IfcSchema/IfcMeasureInformation.cs index d2af3cd..d4ab16c 100644 --- a/ids-lib/IfcSchema/IfcMeasureInformation.cs +++ b/ids-lib/IfcSchema/IfcMeasureInformation.cs @@ -1,21 +1,24 @@ -namespace IdsLib.IfcSchema; +using System.Diagnostics; + +namespace IdsLib.IfcSchema; /// /// Metadata about measure conversion behaviours. /// +[DebuggerDisplay("{Id}, {Description}")] public readonly struct IfcMeasureInformation { /// /// basic constructor /// - public IfcMeasureInformation(string measure, string description, string unit, string symbol, string defDisplayUnit, string exponents, string unitTypeEnum) + public IfcMeasureInformation(string measureId, string description, string unit, string unitSymbol, string defDisplayUnit, string exponents, string unitTypeEnum) { - Id = measure; - IfcMeasure = measure; + Id = measureId; + IfcMeasure = measureId; Description = description; Unit = unit; - UnitSymbol = symbol; - DefaultDisplay = symbol; + UnitSymbol = unitSymbol; + DefaultDisplay = defDisplayUnit; Exponents = DimensionalExponents.FromString(exponents) ?? new DimensionalExponents(); UnitTypeEnum = unitTypeEnum; } diff --git a/ids-lib/IfcSchema/SchemaInfo.MeasureNames.g.cs b/ids-lib/IfcSchema/SchemaInfo.MeasureNames.g.cs index 4e3b1ae..3650fdd 100644 --- a/ids-lib/IfcSchema/SchemaInfo.MeasureNames.g.cs +++ b/ids-lib/IfcSchema/SchemaInfo.MeasureNames.g.cs @@ -217,7 +217,7 @@ public static IEnumerable AllDataTypes yield return new IfcDataTypeInformation("IFCMARINEPARTTYPEENUM", new[] { "Ifc4x3" }, "xs:string"); yield return new IfcDataTypeInformation("IFCMASSDENSITYMEASURE", new[] { "Ifc2x3", "Ifc4", "Ifc4x3" }, new IfcMeasureInformation("IFCMASSDENSITYMEASURE","Mass density","","","Kg / m3","(-3, 1, 0, 0, 0, 0, 0)","IfcDerivedUnitEnum.MASSDENSITYUNIT"), "xs:double"); yield return new IfcDataTypeInformation("IFCMASSFLOWRATEMEASURE", new[] { "Ifc2x3", "Ifc4", "Ifc4x3" }, new IfcMeasureInformation("IFCMASSFLOWRATEMEASURE","Mass flow rate","","","Kg / s","(0, 1, -1, 0, 0, 0, 0)","IfcDerivedUnitEnum.MASSFLOWRATEUNIT"), "xs:double"); - yield return new IfcDataTypeInformation("IFCMASSMEASURE", new[] { "Ifc2x3", "Ifc4", "Ifc4x3" }, new IfcMeasureInformation("IFCMASSMEASURE","Mass","kilogram","","Kg","(0, 1, 0, 0, 0, 0, 0)","IfcUnitEnum.MASSUNIT"), "xs:double"); + yield return new IfcDataTypeInformation("IFCMASSMEASURE", new[] { "Ifc2x3", "Ifc4", "Ifc4x3" }, new IfcMeasureInformation("IFCMASSMEASURE","Mass","kilogram","Kg","Kg","(0, 1, 0, 0, 0, 0, 0)","IfcUnitEnum.MASSUNIT"), "xs:double"); yield return new IfcDataTypeInformation("IFCMASSPERLENGTHMEASURE", new[] { "Ifc2x3", "Ifc4", "Ifc4x3" }, new IfcMeasureInformation("IFCMASSPERLENGTHMEASURE","Mass per length","","","Kg / m","(-1, 1, 0, 0, 0, 0, 0)","IfcDerivedUnitEnum.MASSPERLENGTHUNIT"), "xs:double"); yield return new IfcDataTypeInformation("IFCMECHANICALFASTENERTYPEENUM", new[] { "Ifc4", "Ifc4x3" }, "xs:string"); yield return new IfcDataTypeInformation("IFCMEDICALDEVICETYPEENUM", new[] { "Ifc4", "Ifc4x3" }, "xs:string"); diff --git a/ids-lib/LibraryInformation.cs b/ids-lib/LibraryInformation.cs index 179aac8..f1447a5 100644 --- a/ids-lib/LibraryInformation.cs +++ b/ids-lib/LibraryInformation.cs @@ -26,5 +26,5 @@ public static class LibraryInformation /// /// Static field with hardcoded DLL version number. /// - public static string AssemblyVersion => "1.0.67"; + public static string AssemblyVersion => "1.0.68"; } diff --git a/ids-lib/ids-lib.csproj b/ids-lib/ids-lib.csproj index 5198ccc..1e2f912 100644 --- a/ids-lib/ids-lib.csproj +++ b/ids-lib/ids-lib.csproj @@ -20,7 +20,7 @@ First implementation. README.md - 1.0.67 + 1.0.68 $(AssemblyVersion) $(AssemblyVersion) true diff --git a/ids-tool.tests/IfcSchemaTests.cs b/ids-tool.tests/IfcSchemaTests.cs index ceaf1fd..406ba60 100644 --- a/ids-tool.tests/IfcSchemaTests.cs +++ b/ids-tool.tests/IfcSchemaTests.cs @@ -177,6 +177,18 @@ public void CanParseMeasure() } } + [Fact] + public void HasMeasureInfo() + { + var m = IdsLib.IfcSchema.SchemaInfo.AllMeasureInformation.ToList(); + m.Should().HaveCount(83); + foreach (var measure in m) + { + Debug.WriteLine($"{measure.UnitSymbol}\t{measure.DefaultDisplay}"); + } + } + + [Fact] public void CanGetTopLevelClassesByAttribute() { diff --git a/ids-tool/ids-tool.csproj b/ids-tool/ids-tool.csproj index 75ae243..e3f3baa 100644 --- a/ids-tool/ids-tool.csproj +++ b/ids-tool/ids-tool.csproj @@ -16,7 +16,7 @@ icon.png IDS, buildingSmart - 1.0.67 + 1.0.68 $(AssemblyVersion) $(AssemblyVersion) https://github.com/buildingSMART/IDS-Audit-tool.git