本文整理汇总了C#中FilteredElementCollector.Reset方法的典型用法代码示例。如果您正苦于以下问题:C# FilteredElementCollector.Reset方法的具体用法?C# FilteredElementCollector.Reset怎么用?C# FilteredElementCollector.Reset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FilteredElementCollector
的用法示例。
在下文中一共展示了FilteredElementCollector.Reset方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetAllLabelsOfGrids
/// <summary>
/// Get all grid labels in current document
/// </summary>
/// <param name="document">Revit's document</param>
/// <returns>ArrayList contains all grid labels in current document</returns>
private static ArrayList GetAllLabelsOfGrids(Document document)
{
ArrayList labels = new ArrayList();
FilteredElementIterator itor = new FilteredElementCollector(document).OfClass(typeof(Grid)).GetElementIterator();
itor.Reset();
for (; itor.MoveNext(); )
{
Grid grid = itor.Current as Grid;
if (null != grid)
{
labels.Add(grid.Name);
}
}
return labels;
}
示例2: Initialize
/// <summary>
/// iterate all the symbols of levels, columns, beams and braces
/// </summary>
/// <returns>A value that signifies if the initialization was successful for true or failed for false</returns>
private bool Initialize()
{
try
{
FilteredElementIterator i = new FilteredElementCollector(m_revit.ActiveUIDocument.Document).OfClass(typeof(Level)).GetElementIterator();
i.Reset();
while (i.MoveNext())
{
//add level to list
Level level = i.Current as Level;
if (null != level)
{
levels.Add(level.Elevation, level);
}
}
i = new FilteredElementCollector(m_revit.ActiveUIDocument.Document).OfClass(typeof(Family)).GetElementIterator();
while (i.MoveNext())
{
Family f = i.Current as Family;
if (f != null)
{
foreach (object symbol in f.Symbols)
{
FamilySymbol familyType = symbol as FamilySymbol;
if (null == familyType)
{
continue;
}
if (null == familyType.Category)
{
continue;
}
//add symbols of beams and braces to lists
string categoryName = familyType.Category.Name;
if ("Structural Framing" == categoryName)
{
m_beamMaps.Add(new SymbolMap(familyType));
m_braceMaps.Add(new SymbolMap(familyType));
}
else if ("Structural Columns" == categoryName)
{
m_columnMaps.Add(new SymbolMap(familyType));
}
}
}
}
}
catch
{
return false;
}
return true;
}
示例3: PrepareData
/// <summary>
/// initialize members using data from current Revit project
/// </summary>
private void PrepareData()
{
UIDocument doc = m_commandData.Application.ActiveUIDocument;
m_beamTypes.Clear();
// iterate all selected beams
foreach (object obj in doc.Selection.Elements)
{
FamilyInstance beam = obj as FamilyInstance;
if (null == beam)
{
continue;
}
// add beam to lists according to category name
string categoryName = beam.Category.Name;
if ("Structural Framing" == categoryName
&& beam.StructuralType == StructuralType.Beam)
{
m_beams.Add(beam);
}
}
//iterate all beam types
FilteredElementIterator itor = new FilteredElementCollector(doc.Document).OfClass(typeof(Family)).GetElementIterator();
itor.Reset();
while (itor.MoveNext())
{
// get Family to get FamilySymbols
Family aFamily = itor.Current as Family;
if (null == aFamily)
{
continue;
}
foreach (FamilySymbol symbol in aFamily.Symbols)
{
if (null == symbol.Category)
{
continue;
}
// add symbols to lists according to category name
string categoryName = symbol.Category.Name;
if ("Structural Framing" == categoryName)
{
m_beamTypes.Add(symbol.Family.Name + ":" + symbol.Name, symbol);
}
}
}
if (m_beams.Count == 0)
{
throw new ErrorMessageException("Please select beams.");
}
if (m_beamTypes.Count == 0)
{
throw new ErrorMessageException("There is no Beam families loaded in current project.");
}
}