本文整理汇总了C#中Dimension.AddContext方法的典型用法代码示例。如果您正苦于以下问题:C# Dimension.AddContext方法的具体用法?C# Dimension.AddContext怎么用?C# Dimension.AddContext使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dimension
的用法示例。
在下文中一共展示了Dimension.AddContext方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetStyleAnnotative
private void SetStyleAnnotative(DimStyleTableRecord[] resultStyleName, DBObject item, Dimension y)
{
AnnotationScale mainScale = new AnnotationScale();
ObjectContextManager ocm = targetDB.ObjectContextManager;
double scale = 2.5 / (y.Dimscale * y.Dimtxt);
double difference = 200;
if (ocm != null)
{
ObjectContextCollection occ = ocm.GetContextCollection("ACDB_ANNOTATIONSCALES");
ObjectContext currentContext = occ.CurrentContext;
foreach (ObjectContext context in occ)
{
double currentDifference = 200;
AnnotationScale annotScale = (AnnotationScale)context;
if (annotScale.Scale == scale)
{
mainScale = annotScale;
break;
}
else
{
currentDifference = Math.Abs(scale - annotScale.Scale);
if (currentDifference < difference)
{
difference = currentDifference;
mainScale = annotScale;
}
}
}
SetStyleByType(resultStyleName, item, y);
if (y.HasContext(currentContext))
y.RemoveContext(currentContext);
y.AddContext(mainScale);
y.Dimtxt = 2.5;
}
}