Can't add filter rules with FilterRule.ByRuleType

I’m trying to us Dynamo to add a few filters to new projects once worksets are enabled. I’ve been able to make a filter which grabs things that are on the workset containing the string “Demo”. See below


Add%20filter%2003

The filter for elements that need callout is more complicated because I don’t want to collect things in links so I have a workset rule and a shared parameter-project parameter rule. When I run this script I can’t create either rule. The second rule doesn’t even get started. Also note that the filter rules on this is set to “OR” when it should be “AND”. I don’t know how to set that.

Add%20filter%2001
Add%20filter%2004

Revit Dev - Project Startup.dyn (243.2 KB)

FilterRule.ByRuleType should be returning two rules. List levels aren’t needed but that shouldn’t be the problem either.

I’ve removed the list levels from the FilterRule.ByRuleType but like you said, doesn’t seem to be the problem.

Make sure both parameters are available to be used in filters. I was able to make a test filter with two rules using the same nodes.

I think it might be because I’m using Text Notes as my category for the “All Elements of Category” node. It works for the demo filter because everything has a workset and because this is a brand new project there is not another category that has any elements to use for Parameter.ParameterByName. The callout parameter is not assigned to text notes. Is there another way to get the parameter to use for the FilterRule.ByRuleType.

I’ve tried separating this into two node and changed how I was getting the parameter, but I’m running into new issues.

I’m not sure how to create a “Yes” value.

Secondly I’m still not sure how to create a parameter input without an element. I’ve tried with the Document.ProjectParameter node but it is giving me the wrong argument types.

The workset portion of the script is still not working. It doesn’t give any errors but it is not filling in the filter value which should be HVAC.

Bump

Any ideas for these issues?

I can’t get both filters rules to be added.

Can’t change whether the filter uses "and or “or.”

I can’t set the filters value for the Com_NeedsCallout Parameter to yes. It doesn’t accept a string or boolean. The FilterRule.ByRuleType node wants a different parameter variable that I don’t know how to get without elements.Revit Dev - Project Startup.dyn (280.5 KB)

1 Like

I believe the parameter does need to come from an element. What you’re using is the project parameter definition so to speak. You need to supply the parameter element that is associated with the category that the project parameter was applied to.

That makes it difficult because no elements are placed yet.

If it’s a type parameter you can still get it from the FamilyType. If it’s an instance parameter it may be a little trickier. You can always place an instance, get the parameter, create the filter, then delete the instance if you have to.

Yeah, I think I’m going to have to place it and delete because it is an instance parameter.

sadly to say,


so you would need an element to get the parameter object

anyway the function you require can be generated via python/revit api. below is the graph of it.


1 Like

Mind sharing that python node?

1 Like

heyhey, sorry for the late reply yea. will share with you the code next week as im not available this week

I notice that you used built in parameters. How do you get the id of a shared parameter for the ParameterValueProvider.

Search “ParameterBindings” on the forum or in the Revit API to see the methods to get the id of shared parameters. I just showed how to do it with BuiltInParameter “Comments” because I knew that was common ground for everyone.

1 Like

I looked into that a determined it’s way above my head. I decided to add a element that I’ll delete after I make the filter. I’ve been able to create the filter but it is still set to OR and I can’t seem to set the value to “Yes”.