本文整理汇总了C#中FilteredElementCollector.MoveNext方法的典型用法代码示例。如果您正苦于以下问题:C# FilteredElementCollector.MoveNext方法的具体用法?C# FilteredElementCollector.MoveNext怎么用?C# FilteredElementCollector.MoveNext使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FilteredElementCollector
的用法示例。
在下文中一共展示了FilteredElementCollector.MoveNext方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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;
}
示例2: 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;
}
示例3: PrepareDoorFamilies
/// <summary>
/// get all the door families in the project.
/// And store them in two lists separately based on opening parameter.
/// </summary>
private void PrepareDoorFamilies()
{
// prepare DoorFamilies
FilteredElementIterator familyIter = new FilteredElementCollector(m_app.ActiveUIDocument.Document).OfClass(typeof(Family)).GetElementIterator();
while (familyIter.MoveNext())
{
Family doorFamily = familyIter.Current as Family;
if (null == doorFamily.FamilyCategory) // some family.FamilyCategory is null
{
continue;
}
if (!doorFamily.FamilyCategory.Name.Equals("Doors"))
{
continue;
}
// create one instance of self class DoorFamily.
DoorFamily tempDoorFamily = new DoorFamily(doorFamily, m_app);
// store the created DoorFamily instance
m_doorFamilies.Add(tempDoorFamily);
}
}
示例4: CheckFamilySymbol
/// <summary>
/// 1. Find all family symbols in current Revit document and store them
/// 2. Find the index of default family symbol
/// Point("Point-based"); Line("Line-based")
/// </summary>
public void CheckFamilySymbol(BasedType type)
{
m_defaultIndex = -1;
m_familySymbolList.Clear();
Autodesk.Revit.DB.FilteredElementIterator familySymbolItor =
new FilteredElementCollector(m_revitDoc.Document).OfClass(typeof(FamilySymbol)).GetElementIterator();
String defaultSymbolName = String.Empty;
switch (type)
{
case BasedType.Point:
defaultSymbolName = "Point-based";
break;
case BasedType.Line:
defaultSymbolName = "Line-based";
break;
default:
break;
}
bool hasDefaultSymbol = false;
int ii = 0;
while (familySymbolItor.MoveNext())
{
FamilySymbol symbol = (FamilySymbol)familySymbolItor.Current;
if(null == symbol)
{
continue;
}
if (!hasDefaultSymbol && 0 == String.Compare(defaultSymbolName, symbol.Name))
{
hasDefaultSymbol = true;
m_defaultIndex = ii;
}
// family symbol
m_familySymbolList.Add(symbol);
// family symbol name
String familyCategoryname = String.Empty;
if (null != symbol.Family.FamilyCategory)
{
familyCategoryname = symbol.Family.FamilyCategory.Name + " : ";
}
m_familySymbolNameList.Add(String.Format("{0}{1} : {2}"
, familyCategoryname, symbol.Family.Name, symbol.Name));
ii++;
}
if (!hasDefaultSymbol)
{
FamilySymbol loadedfamilySymbol = null;
try
{
m_revitDoc.Document.LoadFamilySymbol(String.Format(@"{0}.rfa", defaultSymbolName)
, defaultSymbolName
, out loadedfamilySymbol);
}
catch(Exception)
{
MessageBox.Show("Can't load the prepared rfa.");
}
if (null == loadedfamilySymbol)
{
return;
}
m_familySymbolList.Add(loadedfamilySymbol);
String familyCategoryname = String.Empty;
if (null != loadedfamilySymbol.Family.FamilyCategory)
{
familyCategoryname = loadedfamilySymbol.Family.FamilyCategory.Name +": ";
}
m_familySymbolNameList.Add(String.Format("{0}{1}: {2}"
, familyCategoryname, loadedfamilySymbol.Family.Name, loadedfamilySymbol.Name));
m_defaultIndex = m_familySymbolList.Count - 1;
}
return;
}
示例5: 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.");
}
}