本文整理汇总了C#中FilteredElementCollector.GetElementCount方法的典型用法代码示例。如果您正苦于以下问题:C# FilteredElementCollector.GetElementCount方法的具体用法?C# FilteredElementCollector.GetElementCount怎么用?C# FilteredElementCollector.GetElementCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FilteredElementCollector
的用法示例。
在下文中一共展示了FilteredElementCollector.GetElementCount方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetAllDetailComponentCustomParamValues
// cf. http://forums.autodesk.com/t5/revit-api/get-parameter-value-for-a-collection-of-family-instances/m-p/5896191
/// <summary>
/// Retrieve all Detail Component family instances,
/// read the custom parameter value from each,
/// assuming it is a real number, and return a
/// dictionary mapping all element ids to the
/// corresponding param values.
/// </summary>
Dictionary<int, double> GetAllDetailComponentCustomParamValues(
Document doc)
{
FilteredElementCollector dcs
= new FilteredElementCollector( doc )
.OfClass( typeof( FamilyInstance ) )
.OfCategory( BuiltInCategory
.OST_DetailComponents );
int n = dcs.GetElementCount();
const string param_name = "Custom_Param";
Dictionary<int, double> d
= new Dictionary<int, double>( n );
foreach( Element dc in dcs )
{
IList<Parameter> ps = dc.GetParameters(
param_name );
if( 1 != ps.Count )
{
throw new Exception(
"expected exactly one custom parameter" );
}
d.Add( dc.Id.IntegerValue, ps[0].AsDouble() );
}
return d;
}