BuildingCoder.CmdPressKeys.GetFirstWallUsingType C# (CSharp) Метод

GetFirstWallUsingType() статический приватный Метод

Return the first wall found that uses the given wall type.
static private GetFirstWallUsingType ( Document doc, WallType wallType ) : Wall
doc Document
wallType WallType
Результат Wall
        static Wall GetFirstWallUsingType(
            Document doc,
            WallType wallType)
        {
            // built-in parameter storing this
              // wall's wall type element id:

              BuiltInParameter bip
            = BuiltInParameter.ELEM_TYPE_PARAM;

              ParameterValueProvider provider
            = new ParameterValueProvider(
              new ElementId( bip ) );

              FilterNumericRuleEvaluator evaluator
            = new FilterNumericEquals();

              FilterRule rule = new FilterElementIdRule(
            provider, evaluator, wallType.Id );

              ElementParameterFilter filter
            = new ElementParameterFilter( rule );

              FilteredElementCollector collector
            = new FilteredElementCollector( doc )
              .OfClass( typeof( Wall ) )
              .WherePasses( filter );

              return collector.FirstElement() as Wall;
        }