Filter Rules

Hi everyone,

When creating filters using dynamo, the FilterRule.ByRuleType node (or maybe it’s the ParameterFilterElement.ByRules node) will default to OR (Any rule may be true). If I manually create a new filter in revit, or if I clear filter rules using dynamo, the default rule is AND (All rules must be true). Is there a way to create a filter in dynamo with AND as the default setting? Thanks

2 Likes

Hi,

OUT = []

for i in IN[0]:
if i == 1 and 2:
	OUT.append("OK")
else:
	OUT.append("-")

I tried - it is a pit of … maybe there is a python solution ? it is true it is weard

OUT = []

for i in IN[0]:
if i == 1 or 2:
	OUT.append("OK")
else:
	OUT.append("-")

Also posted a question about this today, you’ve worded it better. Pre-Revit 2019 the script works fine, but now that we have the AND / OR option it always defaults to OR…

2 Likes

1 Like

thanks “or” condition works… …but not AND … and i think the list is not able to make it(?)

1 and 2 can`t not exist as “and” condition? i tried “12” and “1.2” List is not readable {(1,2),1,2,3,4}

how is it correct to get an AND condition?

Your list is not appropriate for that. You should have two values to check. For example:
A = [(1,2), (1,1),(2,2)]

OUT = []

for el in IN[0]:
	i,j =el
	if i == 1 and j==2:
		OUT.append("OK")
	else:
		OUT.append("-")

1 Like

I hope my subject line wasn’t confusing but I am looking for information pertaining to filters / filter rules to modify the visibility and graphics of elements. Thanks

1 Like

Hello,

This has been passed for long time since you ever posted this creating filter rule by dynamo setting to “OR” as default.
Archilab nodes could make your task worked without Python coding, please see image below.
Nodes underlining in red are made by Archilab.

after that you could feed the “viewFilter” into “parameterFilter” in “View.SetFilterOvewrrides” node to complete your visibility and graphics of elements task.

@c.poupin had already solved it on forum. You can search for it on this website.

2 Likes