本文整理汇总了C#中System.Windows.Forms.Document.Regenerate方法的典型用法代码示例。如果您正苦于以下问题:C# Document.Regenerate方法的具体用法?C# Document.Regenerate怎么用?C# Document.Regenerate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.Document
的用法示例。
在下文中一共展示了Document.Regenerate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateDoorsGeometry
/// <summary>
/// Doors related rooms: update doors' geometry according to its To/From room information.
/// </summary>
/// <param name="creFilter">One element filter utility object.</param>
/// <param name="doc">Revit project.</param>
/// <param name="onlyUpdateSelect">
/// true means only update selected doors' information else false.
/// </param>
public static void UpdateDoorsGeometry(Document doc, bool onlyUpdateSelect)
{
IEnumerator iter;
int doorCount = 0;
if (onlyUpdateSelect) // update doors in select elements
{
UIDocument newUIdoc = new UIDocument(doc);
iter = newUIdoc.Selection.Elements.GetEnumerator();
}
else // update all doors in current Revit document
{
ElementClassFilter familyInstanceFilter = new ElementClassFilter(typeof(FamilyInstance));
ElementCategoryFilter doorsCategoryfilter = new ElementCategoryFilter(BuiltInCategory.OST_Doors);
LogicalAndFilter doorInstancesFilter = new LogicalAndFilter(familyInstanceFilter, doorsCategoryfilter);
iter = new FilteredElementCollector(doc).WherePasses(doorInstancesFilter).GetElementIterator();
}
iter.Reset();
while (iter.MoveNext())
{
// find door instance
FamilyInstance door = iter.Current as FamilyInstance;
if (onlyUpdateSelect)
{
if (null == door)
{
continue;
}
if (null == door.Category)
{
continue;
}
if (!door.Category.Name.Equals("Doors"))
{
continue;
}
}
// find one door.
doorCount++;
// update one door.
UpdateFromToRoomofOneDoor(door, true);
doc.Regenerate();
}
if (onlyUpdateSelect)
{
System.Windows.Forms.MessageBox.Show("Updated all selected doors (" + doorCount +
" doors).\r\n (Selection may include miscellaneous elements.)",
"Door Swing");
}
else
{
System.Windows.Forms.MessageBox.Show("Updated all doors of this project (" +
doorCount + " doors).", "Door Swing");
}
}