title: Find a view filter Revit Api
body: <p>I am trying to use a filter to show/hide a certain element on the view. The family is from catogary GenericModel. I use the same code snippet that on the help on the autodesk site it works fine in its original state (catogary is walls) but when I changed it to GenericModel I got the following error:
  "One of the given rules refers to a parameter that does not apply to this filter's categories."
  I suspect that something wrong with the typeOf(FamilyInstance).
  The original code on Autodesk site is:</p>
  
  <p><a href="http://help.autodesk.com/view/RVT/2014/ENU/?guid=GUID-B6FB80F2-7A17-4242-9E95-D6056090E85B" rel="nofollow">http://help.autodesk.com/view/RVT/2014/ENU/?guid=GUID-B6FB80F2-7A17-4242-9E95-D6056090E85B</a></p>
  
  <p>and here is my code</p>
  
  <pre><code>Transaction trans = new Transaction(doc);
           trans.Start("Hide_or_Unhide");
          //
          List&lt;ElementId&gt; categories = new List&lt;ElementId&gt;();
          categories.Add(new ElementId(BuiltInCategory.OST_GenericModel));
          ParameterFilterElement parameterFilterElement = ParameterFilterElement.Create(doc, "elementNo = 102", categories);
          FilteredElementCollector parameterCollector = new FilteredElementCollector(doc);
          Parameter parameter = parameterCollector.OfClass(typeof(FamilyInstance)).FirstElement().get_Parameter("elementNo");
          List&lt;FilterRule&gt; filterRules = new List&lt;FilterRule&gt;();
          filterRules.Add(ParameterFilterRuleFactory.CreateEqualsRule(parameter.Id, 102));   
          try
          {
              parameterFilterElement.SetRules(filterRules);
          }
          catch (Exception ex)
          {
              TaskDialog.Show("", ex.Message);
          }
          OverrideGraphicSettings filterSettings = new OverrideGraphicSettings();
          // outline walls in red            
          filterSettings.SetProjectionLineColor(new Autodesk.Revit.DB.Color(255, 0, 0));
          Autodesk.Revit.DB.View curView = doc.ActiveView;
          curView.SetFilterOverrides(parameterFilterElement.Id, filterSettings);
          trans.Commit();
  </code></pre>