예제 #1
0
 /// <summary>
 /// Converts a value from one Unit System to another Unit System
 /// </summary>
 /// <param name="value">Value to convert</param>
 /// <param name="fromUnit">Unit object</param>
 /// <param name="toUnit">Unit object</param>
 /// <returns name="double">Converted value</returns>
 public static double ConvertByUnits(double value, Unit fromUnit, Unit toUnit)
 {
     return(ForgeUnitsEngine.convert(value, fromUnit.TypeId, toUnit.TypeId));
 }
예제 #2
0
 /// <summary>
 /// Get latest versions of registered Quantities within the Dynamo session.
 /// </summary>
 /// <returns>A dictionary keyed by a version-less typeID and the latest registered version as value</returns>
 internal static Dictionary <string, Version> GetAllRegisteredQuantityVersions()
 {
     return(GetAllRegisteredQuantityVersions(ForgeUnitsEngine.getAllQuantities()));
 }
예제 #3
0
 /// <summary>
 /// Get latest versions of registered Units within the Dynamo session.
 /// </summary>
 /// <returns>A dictionary keyed by a version-less typeID and the latest registered version as value</returns>
 internal static Dictionary <string, Version> GetAllLatestRegisteredUnitVersions()
 {
     return(GetAllLatestRegisteredUnitVersions(ForgeUnitsEngine.getAllUnits()));
 }
예제 #4
0
 public static IEnumerable <Unit> GetAllUnits()
 {
     return(ConvertForgeUnitDictionaryToCollection(ForgeUnitsEngine.getAllUnits()));
 }
예제 #5
0
 public static IEnumerable <Symbol> GetAllSymbols()
 {
     return(ConvertForgeSymbolDictionaryToCollection(ForgeUnitsEngine.getAllSymbols()));
 }
예제 #6
0
 public static IEnumerable <Quantity> GetAllQuantities()
 {
     return(CovertForgeQuantityDictionaryToCollection(ForgeUnitsEngine.getAllQuantities()));
 }
예제 #7
0
 /// <summary>
 /// Parses a string containing math functions to a unit value.
 /// For example, "(1 + 3)^2 - 4 * 2" could be converted to 8
 /// </summary>
 /// <param name="expression">String to convert to a value</param>
 /// <returns name="double">Converted value</returns>
 public static double ParseExpression(string expression)
 {
     return(ForgeUnitsEngine.parseUnitless(expression));
 }
예제 #8
0
 public static double ParseExpressionByUnitId(string targetUnit, string expression)
 {
     return(ForgeUnitsEngine.parse(targetUnit, expression));
 }
예제 #9
0
 /// <summary>
 /// Parses a string containing values with units and math functions to a unit value.
 /// For example, "1ft + 2.54cm + 3in" could be converted to 14in
 /// </summary>
 /// <param name="targetUnit">Unit system to target</param>
 /// <param name="expression">String to convert to a value</param>
 /// <returns name="double">Converted value</returns>
 public static double ParseExpressionByUnit(Unit targetUnit, string expression)
 {
     return(ForgeUnitsEngine.parse(targetUnit.TypeId, expression));
 }
예제 #10
0
 public static double ConvertByUnitIds(double value, string fromUnit, string toUnit)
 {
     return(ForgeUnitsEngine.convert(value, fromUnit, toUnit));
 }