Issue Creating Filters When using a Shared Instance Parameter in Linked File

Hi All,

I am trying to automate the process of creating a large amount of filters for a certain view.

Following the tutorials and advice online, I have managed to set up a filter which works and that I can apply to a view- which is what I set out to do which is great.

However, there are two items that seem to be causing me issues

  1. I am working in a file which is made up soley of linked revit views
  2. I am trying to create my filter rules using some shared parameters that I have made within the family and have then applied to my revit file. These are instance parameters. The family is a casework family.

The task is to assign a seat code to all of these seat elements, that I then want to filter within a sheet file.

The crux of question is can anyone see a reason why I can create the filter using the standard casework family inputs such as Comments or Tier, but when I try and use my instance based paramters that I have made, I get an error that reads as the follow:

One of the given rules refers to a parameter that does not apply to this filter’s categories.
Parameter name: rules

I believe its maybe one little change away from working, but would very much appreciate any help.

I have also attached one screenshot below as it only me allows to do so as a new user. You will see the Tier parameter which is throwing the error to the left hand side.

Thankyou, Sam

I think the issue is that you’re trying to add a filter using a parameter that isn’t in your host model. For example, if your parameter “test” is a parameter in the linked model, but not a project parameter in the host model, it will throw this error (which is a bit misleading). I recently ran into a very similar issue and have implemented a check into my own graph to avoid this. See below:

class ParameterNotFoundError(Exception):

import clr
from Autodesk.Revit.DB import FilteredElementCollector, ParameterElement

from RevitServices.Persistence import DocumentManager
doc = DocumentManager.Instance.CurrentDBDocument

name = IN[0]

parameter_elems = FilteredElementCollector(doc).OfClass(ParameterElement)
parameter_defs = [p.GetDefinition() for p in parameter_elems]
parameter_names = [p.Name for p in parameter_defs]

if name not in parameter_names:
	raise ParameterNotFoundError('Parameter \'{}\' not found in host document. Please create one for all categories and re-run the graph.'.format(name))

It is not possible to programmatically add project parameters to a document, so you have to do it manually.


Thanks for getting back so quickly.

I had the same idea and I have added the shared paramter within the Host Model. Please see attached image.

Is there a way of doing a check within dynamo/revit of this.

I can manually make a filter within revit using the shared instance paramter which I can not pick up.


I solved my own problem after some further testing.

I was trying to define the paramter using an element from a linked file. When I placed a casework object in the actual file in which I was setting up the filter and chose that element (as opposed to an element in a linked file) it worked.

Thankyou for your help.