Units Mis-match Warning

For non-English versions of EVOLVE, a workstation unit format must match that of the workstation .NET unit format. The following macro can be used to check your Revit unit format vs. your workstation .NET format. If units do not match, users will be presented with the following error:

The script will return a simliar screen below. If any of the sample return values between .NET and Revit do not match, that indicates there is a different input format set.

To change the Revit format, go to the Revit Project Units within the Manage ribbon. Click HERE for more information.

public void NumberParseTest()
var unitType = UnitType.UT_Number;
var results = new List<string>();
var inputs = new List<string>();
inputs.Add("1234 56");
foreach (var input in inputs)
double dotnetParsed;
double.TryParse(input, out dotnetParsed).ToString();
double revitParsed;
string revitMessage;
UnitFormatUtils.TryParse(this.ActiveUIDocument.Document.GetUnits(), unitType, input, out revitParsed, out revitMessage);
results.Add(input + "\n" + "- .NET = " + dotnetParsed.ToString() + "\n" + "- Revit = " + revitParsed.ToString());
TaskDialog.Show("Parse Results - " + unitType.ToString(), string.Join("\n\n", results));

How did we do?

Powered by HelpDocs (opens in a new tab)