BuildingCoder.CmdCollectorPerformance.GetAllDetailComponentCustomParamValues C# (CSharp) Метод

GetAllDetailComponentCustomParamValues() приватный Метод

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.
private GetAllDetailComponentCustomParamValues ( Document doc ) : double>.Dictionary
doc Document
Результат double>.Dictionary
        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;
        }