Ejemplo n.º 1
0
 /// <summary>
 /// Get a string version of a number in a given unit system / display mode.
 /// </summary>
 /// <param name="x">The number to format into a string.</param>
 /// <param name="units">The unit system for the number.</param>
 /// <param name="mode">How the number should be formatted.</param>
 /// <param name="precision">The precision of the number.</param>
 /// <param name="appendUnitSystemName">Adds unit system name to the end of the number.</param>
 /// <returns>The formatted number.</returns>
 /// <since>5.0</since>
 public static string FormatNumber(double x, UnitSystem units, DistanceDisplayMode mode, int precision, bool appendUnitSystemName)
 {
     using (var sh = new StringHolder())
     {
         IntPtr pString = sh.NonConstPointer();
         UnsafeNativeMethods.RHC_RhinoFormatNumber(x, (int)units, (int)mode, precision, appendUnitSystemName, pString);
         return(sh.ToString());
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Get a string version of a number in a given unit system / display mode.
 /// </summary>
 /// <param name="x">The number to format into a string.</param>
 /// <param name="units">The unit system for the number.</param>
 /// <param name="mode">How the number should be formatted.</param>
 /// <param name="precision">The precision of the number.</param>
 /// <param name="appendUnitSystemName">Adds unit system name to the end of the number.</param>
 /// <returns>The formatted number.</returns>
 public static string FormatNumber( double x, UnitSystem units, DistanceDisplayMode mode, int precision, bool appendUnitSystemName )
 {
   using (var sh = new StringHolder())
   {
     IntPtr pString = sh.NonConstPointer();
     UnsafeNativeMethods.RHC_RhinoFormatNumber(x, (int)units, (int)mode, precision, appendUnitSystemName, pString);
     return sh.ToString();
   }
 }