BuildingCoder.ParamFilterTest.Execute C# (CSharp) Метод

Execute() публичный Метод

public Execute ( ExternalCommandData commandData, string &message, ElementSet elements ) : System.Result
commandData ExternalCommandData
message string
elements ElementSet
Результат System.Result
        public Result Execute(
            ExternalCommandData commandData,
            ref string message,
            ElementSet elements)
        {
            UIApplication uiapp = commandData.Application;
              UIDocument uidoc = uiapp.ActiveUIDocument;
              Application app = uiapp.Application;
              Document doc = uidoc.Document;

              Reference r = uidoc.Selection.PickObject(
            ObjectType.Element );

              // 'Autodesk.Revit.DB.Reference.Element' is
              // obsolete: Property will be removed. Use
              // Document.GetElement(Reference) instead.
              //Wall wall = r.Element as Wall; // 2011

              Wall wall = doc.GetElement( r ) as Wall; // 2012

              //Parameter parameter = wall.get_Parameter( "Unconnected Height" ); // 2014, causes warning CS0618: 'Autodesk.Revit.DB.Element.get_Parameter(string)' is obsolete: 'This property is obsolete in Revit 2015, as more than one parameter can have the same name on a given element. Use Element.Parameters to obtain a complete list of parameters on this Element, or Element.GetParameters(String) to get a list of all parameters by name, or Element.LookupParameter(String) to return the first available parameter with the given name.'
              Parameter parameter = wall.get_Parameter( BuiltInParameter.WALL_USER_HEIGHT_PARAM ); // 2015, avoids warning, in language indepependent and more effective to look up

              ParameterValueProvider pvp
            = new ParameterValueProvider( parameter.Id );

              FilterNumericRuleEvaluator fnrv
            = new FilterNumericGreater();

              FilterRule fRule
            = new FilterDoubleRule( pvp, fnrv, 20, 1E-6 );

              ElementParameterFilter filter
            = new ElementParameterFilter( fRule );

              FilteredElementCollector collector
            = new FilteredElementCollector( doc );

              // Find walls with unconnected height
              // less than or equal to 20:

              ElementParameterFilter lessOrEqualFilter
            = new ElementParameterFilter( fRule, true );

              IList<Element> lessOrEqualFounds
            = collector.WherePasses( lessOrEqualFilter )
              .OfCategory( BuiltInCategory.OST_Walls )
              .OfClass( typeof( Wall ) )
              .ToElements();

              TaskDialog.Show( "Revit", "Walls found: "
            + lessOrEqualFounds.Count );

              return Result.Succeeded;
        }
ParamFilterTest