/// <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)); }
/// <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())); }
/// <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())); }
public static IEnumerable <Unit> GetAllUnits() { return(ConvertForgeUnitDictionaryToCollection(ForgeUnitsEngine.getAllUnits())); }
public static IEnumerable <Symbol> GetAllSymbols() { return(ConvertForgeSymbolDictionaryToCollection(ForgeUnitsEngine.getAllSymbols())); }
public static IEnumerable <Quantity> GetAllQuantities() { return(CovertForgeQuantityDictionaryToCollection(ForgeUnitsEngine.getAllQuantities())); }
/// <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)); }
public static double ParseExpressionByUnitId(string targetUnit, string expression) { return(ForgeUnitsEngine.parse(targetUnit, expression)); }
/// <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)); }
public static double ConvertByUnitIds(double value, string fromUnit, string toUnit) { return(ForgeUnitsEngine.convert(value, fromUnit, toUnit)); }