本文整理汇总了C#中Units.SetFormatOptions方法的典型用法代码示例。如果您正苦于以下问题:C# Units.SetFormatOptions方法的具体用法?C# Units.SetFormatOptions怎么用?C# Units.SetFormatOptions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Units
的用法示例。
在下文中一共展示了Units.SetFormatOptions方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Create
/// <summary>
/// Creates or populates Revit elements based on the information contained in this class.
/// </summary>
/// <param name="doc">The document.</param>
protected override void Create(Document doc)
{
Units documentUnits = new Units(doc.DisplayUnitSystem == DisplayUnit.METRIC ?
UnitSystem.Metric : UnitSystem.Imperial);
foreach (IFCUnit unit in UnitsInContext)
{
if (!IFCUnit.IsNullOrInvalid(unit))
{
try
{
FormatOptions formatOptions = new FormatOptions(unit.UnitName);
formatOptions.UnitSymbol = unit.UnitSymbol;
documentUnits.SetFormatOptions(unit.UnitType, formatOptions);
}
catch (Exception ex)
{
Importer.TheLog.LogError(unit.Id, ex.Message, false);
}
}
}
doc.SetUnits(documentUnits);
// We will randomize unused grid names so that they don't conflict with new entries with the same name.
// This is only for relink.
foreach (ElementId gridId in Importer.TheCache.GridNameToElementMap.Values)
{
Grid grid = doc.GetElement(gridId) as Grid;
if (grid == null)
continue;
grid.Name = new Guid().ToString();
}
base.Create(doc);
// IfcProject usually won't create an element, as it contains no geometry.
// If it doesn't, use the ProjectInfo element in the document to store its parameters.
if (CreatedElementId == ElementId.InvalidElementId)
CreatedElementId = Importer.TheCache.ProjectInformationId;
}