DistanceListParse Method (String, IFormatProvider, DistanceUnitType) |
Parses a distance list from a string representation.
Namespace: Tekla.Structures.Datatype
Assembly: Tekla.Structures.Datatype (in Tekla.Structures.Datatype.dll) Version: 2023.0.3
Syntax
public static DistanceList Parse( string input, IFormatProvider formatProvider, DistanceUnitType defaultUnitType )
Parameters
- input
- Type: SystemString
The input string. - formatProvider
- Type: SystemIFormatProvider
The format provider. - defaultUnitType
- Type: Tekla.Structures.DatatypeDistanceUnitType
The default unit type.
Return Value
Type: DistanceListThe distance list.
Examples
This example shows how to override both the format provider and the unit type
when parsing distance lists.
using Tekla.Structures.Datatype; using System.Globalization; public class Example { public void Example1() { // Current unit type controls the default unit type used in parsing. // The default unit is millimeter. Distance.CurrentUnitType = Distance.UnitType.Millimeter; // We can override the current unit type to force the parsing to perform automatic unit conversion. // This will be parsed as 3 times 3.2 inches. DistanceList distanceInInches = DistanceList.Parse("3*3.2", CultureInfo.InvariantCulture, Distance.UnitType.Inch); // When using feet or inches as the distance unit, the fractional format is supported as well. // This will be parsed as 3 times 3/4 inches. DistanceList inchesInFractionalFormat = DistanceList.Parse("3*3/4", CultureInfo.InvariantCulture, Distance.UnitType.Inch); // When a distance list is used in a plug-in dialog, the dialog attribute is passed to the plug-in execution as a string. // Distance values are then parsed from the string using InvariantCulture and Millimeter. DistanceList distancesInPluginRun = DistanceList.Parse("3*40.00 50.00", CultureInfo.InvariantCulture, Distance.UnitType.Millimeter); } }
See Also