From 282fd5127ced23d42735740f9dae951bf214c64d Mon Sep 17 00:00:00 2001 From: pinzart Date: Wed, 11 Oct 2023 09:09:21 -0400 Subject: [PATCH 1/4] update forge units package --- src/Libraries/DynamoUnits/Quantity.cs | 8 +++--- src/Libraries/DynamoUnits/Symbol.cs | 11 +++----- src/Libraries/DynamoUnits/Unit.cs | 10 +++----- src/Libraries/DynamoUnits/UnitsCore.csproj | 2 +- src/Libraries/DynamoUnits/Utilities.cs | 30 ++++++++++------------ 5 files changed, 25 insertions(+), 36 deletions(-) diff --git a/src/Libraries/DynamoUnits/Quantity.cs b/src/Libraries/DynamoUnits/Quantity.cs index 315e759564e..901c6f00219 100644 --- a/src/Libraries/DynamoUnits/Quantity.cs +++ b/src/Libraries/DynamoUnits/Quantity.cs @@ -1,9 +1,7 @@ using System; using System.Collections.Generic; using Autodesk.DesignScript.Runtime; -#if NET6_0_OR_GREATER -using ForgeUnitsCLR = Autodesk.ForgeUnits; -#endif +using ForgeUnits = Autodesk.ForgeUnits; namespace DynamoUnits { @@ -12,9 +10,9 @@ namespace DynamoUnits /// public class Quantity { - internal readonly ForgeUnitsCLR.Quantity forgeQuantity; + internal readonly ForgeUnits.Quantity forgeQuantity; - internal Quantity(ForgeUnitsCLR.Quantity quantity) + internal Quantity(ForgeUnits.Quantity quantity) { this.forgeQuantity = quantity ?? throw new ArgumentNullException(); } diff --git a/src/Libraries/DynamoUnits/Symbol.cs b/src/Libraries/DynamoUnits/Symbol.cs index 9437fcb39f2..7345b01a564 100644 --- a/src/Libraries/DynamoUnits/Symbol.cs +++ b/src/Libraries/DynamoUnits/Symbol.cs @@ -2,10 +2,7 @@ using System.Collections.Generic; using System.Text; using Autodesk.DesignScript.Runtime; - -#if NET6_0_OR_GREATER -using ForgeUnitsCLR = Autodesk.ForgeUnits; -#endif +using ForgeUnits = Autodesk.ForgeUnits; namespace DynamoUnits { @@ -14,10 +11,10 @@ namespace DynamoUnits /// public class Symbol { - internal readonly ForgeUnitsCLR.Symbol forgeSymbol; - internal readonly ForgeUnitsCLR.PrefixOrSuffix forgePrefixOrSuffix; + internal readonly ForgeUnits.Symbol forgeSymbol; + internal readonly ForgeUnits.PrefixOrSuffix forgePrefixOrSuffix; - internal Symbol(ForgeUnitsCLR.Symbol symbol) + internal Symbol(ForgeUnits.Symbol symbol) { this.forgeSymbol = symbol ?? throw new ArgumentNullException(); this.forgePrefixOrSuffix = symbol.getPrefixOrSuffix(); diff --git a/src/Libraries/DynamoUnits/Unit.cs b/src/Libraries/DynamoUnits/Unit.cs index 5d6fccce194..349bd9af483 100644 --- a/src/Libraries/DynamoUnits/Unit.cs +++ b/src/Libraries/DynamoUnits/Unit.cs @@ -1,9 +1,7 @@ using System; using System.Collections.Generic; using Autodesk.DesignScript.Runtime; -#if NET6_0_OR_GREATER -using ForgeUnitsCLR = Autodesk.ForgeUnits; -#endif +using ForgeUnits = Autodesk.ForgeUnits; namespace DynamoUnits { @@ -12,9 +10,9 @@ namespace DynamoUnits /// public class Unit { - internal readonly ForgeUnitsCLR.Unit forgeUnit; + internal readonly ForgeUnits.Unit forgeUnit; - internal Unit(ForgeUnitsCLR.Unit unit) + internal Unit(ForgeUnits.Unit unit) { this.forgeUnit = unit ?? throw new ArgumentNullException(); } @@ -39,7 +37,7 @@ public IEnumerable ConvertibleUnits { get { - Dictionary units = Utilities.ForgeUnitsEngine.getConvertibleUnits(TypeId); + Dictionary units = Utilities.ForgeUnitsEngine.getConvertibleUnits(TypeId); return Utilities.ConvertForgeUnitDictionaryToCollection(units); } } diff --git a/src/Libraries/DynamoUnits/UnitsCore.csproj b/src/Libraries/DynamoUnits/UnitsCore.csproj index c3a78a75a04..6693aeae79b 100644 --- a/src/Libraries/DynamoUnits/UnitsCore.csproj +++ b/src/Libraries/DynamoUnits/UnitsCore.csproj @@ -21,7 +21,7 @@ - + build diff --git a/src/Libraries/DynamoUnits/Utilities.cs b/src/Libraries/DynamoUnits/Utilities.cs index 651befda698..d58d5350827 100644 --- a/src/Libraries/DynamoUnits/Utilities.cs +++ b/src/Libraries/DynamoUnits/Utilities.cs @@ -4,11 +4,7 @@ using System.Reflection; using System.IO; using System.Configuration; - -#if NET6_0_OR_GREATER -using ForgeUnitsCLR = Autodesk.ForgeUnits; -using SchemasCLR = Autodesk.ForgeUnits; -#endif +using ForgeUnits = Autodesk.ForgeUnits; namespace DynamoUnits { @@ -17,7 +13,7 @@ namespace DynamoUnits /// public static class Utilities { - private static ForgeUnitsCLR.UnitsEngine unitsEngine; + private static ForgeUnits.UnitsEngine unitsEngine; /// /// Path to the directory used load the schema definitions. @@ -53,8 +49,8 @@ internal static void Initialize() try { - unitsEngine = new ForgeUnitsCLR.UnitsEngine(); - SchemasCLR.SchemaUtility.addDefinitionsFromFolder(SchemaDirectory, unitsEngine); + unitsEngine = new ForgeUnits.UnitsEngine(); + ForgeUnits.SchemaUtility.addDefinitionsFromFolder(SchemaDirectory, unitsEngine); unitsEngine.resolveSchemas(); } catch @@ -72,8 +68,8 @@ internal static void SetTestEngine(string testSchemaDir) { try { - unitsEngine = new ForgeUnitsCLR.UnitsEngine(); - SchemasCLR.SchemaUtility.addDefinitionsFromFolder(testSchemaDir, unitsEngine); + unitsEngine = new ForgeUnits.UnitsEngine(); + ForgeUnits.SchemaUtility.addDefinitionsFromFolder(testSchemaDir, unitsEngine); unitsEngine.resolveSchemas(); } catch @@ -146,7 +142,7 @@ public static double ParseExpression(string expression) /// /// Engine which loads schemas and is responsible for all ForgeUnit operations. /// - internal static ForgeUnitsCLR.UnitsEngine ForgeUnitsEngine + internal static ForgeUnits.UnitsEngine ForgeUnitsEngine { get { @@ -205,7 +201,7 @@ public static IEnumerable GetAllSymbols() /// A dictionary keyed by a forge typeID and Forge SDK Quantities as values /// internal static IEnumerable CovertForgeQuantityDictionaryToCollection( - Dictionary forgeDictionary) + Dictionary forgeDictionary) { var dynQuantities = new List(); @@ -229,7 +225,7 @@ internal static IEnumerable CovertForgeQuantityDictionaryToCollection( /// A dictionary keyed by a forge typeID and Forge SDK Symbols as values /// internal static IEnumerable ConvertForgeSymbolDictionaryToCollection( - Dictionary forgeDictionary) + Dictionary forgeDictionary) { var dynSymbols = new List(); @@ -253,7 +249,7 @@ internal static IEnumerable ConvertForgeSymbolDictionaryToCollection( /// A dictionary keyed by a forge typeID and Forge SDK Units as values /// internal static IEnumerable ConvertForgeUnitDictionaryToCollection( - Dictionary forgeDictionary) + Dictionary forgeDictionary) { var dynUnits = new List(); @@ -285,7 +281,7 @@ internal static Dictionary GetAllRegisteredQuantityVersions() /// /// A dictionary keyed by a forge typeID and Forge SDK Quantities as values /// A dictionary keyed by a version-less typeID and the latest registered version as value - internal static Dictionary GetAllRegisteredQuantityVersions(Dictionary forgeDictionary) + internal static Dictionary GetAllRegisteredQuantityVersions(Dictionary forgeDictionary) { var versionDictionary = new Dictionary(); @@ -322,7 +318,7 @@ internal static Dictionary GetAllLastestRegisteredSymbolVersion /// /// A dictionary keyed by a forge typeID and Forge SDK Symbols as values /// A dictionary keyed by a version-less typeID and the latest registered version as value - internal static Dictionary GetAllLastestRegisteredSymbolVersions(Dictionary forgeDictionary) + internal static Dictionary GetAllLastestRegisteredSymbolVersions(Dictionary forgeDictionary) { var versionDictionary = new Dictionary(); @@ -359,7 +355,7 @@ internal static Dictionary GetAllLatestRegisteredUnitVersions() /// /// A dictionary keyed by a forge typeID and Forge SDK Units as values /// A dictionary keyed by a version-less typeID and the latest registered version as value - internal static Dictionary GetAllLatestRegisteredUnitVersions(Dictionary forgeDictionary) + internal static Dictionary GetAllLatestRegisteredUnitVersions(Dictionary forgeDictionary) { var versionDictionary = new Dictionary(); From 324138e13027809cef68d82e7f3edb25d2891478 Mon Sep 17 00:00:00 2001 From: pinzart Date: Wed, 11 Oct 2023 09:21:35 -0400 Subject: [PATCH 2/4] Update UnitsCore.csproj --- src/Libraries/DynamoUnits/UnitsCore.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Libraries/DynamoUnits/UnitsCore.csproj b/src/Libraries/DynamoUnits/UnitsCore.csproj index 6693aeae79b..b87d6c8f18c 100644 --- a/src/Libraries/DynamoUnits/UnitsCore.csproj +++ b/src/Libraries/DynamoUnits/UnitsCore.csproj @@ -24,7 +24,7 @@ build - + From 5c2aff1197514d56e91ab6070c7c48f5c65ac705 Mon Sep 17 00:00:00 2001 From: pinzart Date: Wed, 11 Oct 2023 10:29:52 -0400 Subject: [PATCH 3/4] Update UnitsCore.csproj --- src/Libraries/DynamoUnits/UnitsCore.csproj | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/Libraries/DynamoUnits/UnitsCore.csproj b/src/Libraries/DynamoUnits/UnitsCore.csproj index b87d6c8f18c..360f8714ec6 100644 --- a/src/Libraries/DynamoUnits/UnitsCore.csproj +++ b/src/Libraries/DynamoUnits/UnitsCore.csproj @@ -13,16 +13,14 @@ MSB3539;CS1591;NUnit2005;NUnit2007;CS0618;CS0612;CS0672 - - + + + - - - - - build + + runtime;build @@ -43,6 +41,7 @@ + From e86f2e90d0f886bc9436366469bdbc5fa7331357 Mon Sep 17 00:00:00 2001 From: pinzart Date: Wed, 11 Oct 2023 15:24:11 -0400 Subject: [PATCH 4/4] update --- test/DynamoCoreWpfTests/UnitsUITests.cs | 6 +++--- test/core/units/malformed_unit_dropdowns.dyn | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/test/DynamoCoreWpfTests/UnitsUITests.cs b/test/DynamoCoreWpfTests/UnitsUITests.cs index 27981534ad6..9e6bc6f270e 100644 --- a/test/DynamoCoreWpfTests/UnitsUITests.cs +++ b/test/DynamoCoreWpfTests/UnitsUITests.cs @@ -1,4 +1,4 @@ -using System.Xml; +using System.Xml; using Dynamo.Graph; using Dynamo.Models; using Dynamo.Tests; @@ -15,7 +15,7 @@ namespace DynamoCoreWpfTests { - [TestFixture, Category("Failure")] + [TestFixture] public class UnitsUITests : DynamoTestUIBase { private LengthFromString lengthFromString; @@ -61,7 +61,7 @@ public void MigrateLengthFromFeetToMetersTest() lengthFromString.MigrateLengthFromFeetToMeters(root); - string oneFeetInMeters = "0.304800000001219"; + string oneFeetInMeters = "0.3048000000012192"; Assert.AreEqual(oneFeetInMeters, systemDouble.Attributes[0].Value); } diff --git a/test/core/units/malformed_unit_dropdowns.dyn b/test/core/units/malformed_unit_dropdowns.dyn index f4ff99239bf..3400521e3db 100644 --- a/test/core/units/malformed_unit_dropdowns.dyn +++ b/test/core/units/malformed_unit_dropdowns.dyn @@ -32,7 +32,7 @@ }, { "ConcreteType": "UnitsUI.Units, UnitsUI", - "SelectedIndex": 218, + "SelectedIndex": 221, "SelectedString": "Millimeters AAA", "NodeType": "ExtensionNode", "Id": "2cc49d25d3b447b281a81efd6173c6cf",