# Filter Rule

**URL:** <https://forum.dynamobim.com/t/filter-rule/103934>\
**Category:** Dynamo Player\
**Created:** [August 28, 2024, 7:31am UTC](https://forum.dynamobim.com/t/filter-rule/103934 "2024-08-28T07:31:08Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![Potato](https://avatars.discourse-cdn.com/v4/letter/p/a6a055/32.png) [@Potato](https://forum.dynamobim.com/u/Potato)\
**Post date:** [August 28, 2024, 7:31am UTC](https://forum.dynamobim.com/t/filter-rule/103934/1 "2024-08-28T07:31:08Z")

</div>

Hi

I’m trying to make it so that when I select a Structural Framing, a View Filter will be created.  
But it always comes back with a “blank” Reference Level.  
Did I do something wrong with the Rule Type? It’s already set to “Equals”  
 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/5/a/5a5c7336c50eb87c330ac63934e308f40cceea6e.png)

Also, when I run it in Dynamo Player / re-run it in Dynamo by selecting a different element, the previous run will be overwritten. How do I stop this?  
I tried placing the Transaction.Start and Transaction.End. But it still doesn’t work.

Also, is there other ways of selecting Colour Palette for Dynamo Player? It seems to be unsupported  
 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/b/0/b095229e1aafa8b1acbc1b2d7ec6a35afb73d473.png)

Thanks  
[View Filter.dyn](https://forum.dynamobim.com/uploads/short-url/7xHyYREOoPX6UL5wq4uCy412UlY.dyn) (49.3 KB)

Edit:  
I’m using Revit 2022

---

<div class="post-metadata">

**Author:** ![bvs1982](https://avatars.discourse-cdn.com/v4/letter/b/43a26b/32.png) [@bvs1982](https://forum.dynamobim.com/u/bvs1982)\
**Post date:** [August 28, 2024, 7:39am UTC](https://forum.dynamobim.com/t/filter-rule/103934/2 "2024-08-28T07:39:45Z")

</div>

> [@Potato](#):
>
> re-run it in Dynamo by selecting a different element, the previous run will be overwritten.

This should only happen(?) when the graph is ran in Dynamo.  
It is because of Element binding. See this [post](https://forum.dynamobim.com/t/element-binding-in-revit/31612).  
Remove the Element binding save it and then only run it with the Dynamo Player.

**PS**  
Most of the time it is also a good idea to not only post your .dyn but also a screenshot  
with previews of the node.  
 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/0/e/0e3c7f93bfd6871dd2e76d65c41a2c169e5e02ad.png)

Some people on this forum - who might be able to help you - might have no access to a computer but can help just by seeing a screenshot of the graph.

---

<div class="post-metadata">

**Author:** ![Potato](https://avatars.discourse-cdn.com/v4/letter/p/a6a055/32.png) [@Potato](https://forum.dynamobim.com/u/Potato)\
**Post date:** [August 28, 2024, 7:57am UTC](https://forum.dynamobim.com/t/filter-rule/103934/3 "2024-08-28T07:57:05Z")

</div>

Thanks for the reply  
Went through the post. Downloaded Dynamo Beyond to remove the bind. Works! 😃  
Thanks!

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/a/3/a345ea84a49540dbea5ab6cf728a7dec91b99108.png)  
This is a Screenshot of the FilterRule.ByRuleType part

---

<div class="post-metadata">

**Author:** ![bvs1982](https://avatars.discourse-cdn.com/v4/letter/b/43a26b/32.png) [@bvs1982](https://forum.dynamobim.com/u/bvs1982)\
**Post date:** [August 28, 2024, 8:24am UTC](https://forum.dynamobim.com/t/filter-rule/103934/4 "2024-08-28T08:24:51Z")

</div>

I guess we miss a part of the graph (right of ‘Filter Naming’)?

Also don’t forget to show the output of the nodes.  
 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/0/e/0e3c7f93bfd6871dd2e76d65c41a2c169e5e02ad.png)

Maybe [this](https://forum.dynamobim.com/t/cant-get-value-in-view-filter-created-with-dynamo/46946/7) topic will get you somewhere?

> [@Can't get value in view filter created with dynamo](https://forum.dynamobim.com/t/cant-get-value-in-view-filter-created-with-dynamo/46946/7):
>
> Okay, the problem is: Level in Filters are in API different. I remember that situation from that post.  
> You should use Python to get levels there.
> 
> > [@](#):
> >
> > Gotcha! [[image]](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/a/9/a9fb4c9f412b11d40c6b9abe0d354a59964693e4.png) The first BIP LEVEL\_PARAM didn’t work, it needs the 2nd… I’ll have to run some kind of check… pId = ElementId(BuiltInParameter.SCHEDULE\_LEVEL\_PARAM) sRule = ParameterFilterRuleFactory.CreateEqualsRule(pId, level.Id) fRule = ElementParameterFilter(sRule) #Do some action in a Transaction TransactionManager.Instance.EnsureInTransaction(doc) for name,cat in zip(filtNames,cats): paraele = ParameterFilterElement.Create(doc,name,catids) paraele.SetElementFilter(fRule) Parafilel…

---

<div class="post-metadata">

**Author:** ![Nick\_Boyts](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/nick_boyts/32/76313_2.png) [@Nick\_Boyts](https://forum.dynamobim.com/u/Nick_Boyts)\
**Post date:** [August 29, 2024, 1:28pm UTC](https://forum.dynamobim.com/t/filter-rule/103934/5 "2024-08-29T13:28:40Z")

</div>

The filter is looking for the Reference Level _element_. You’re providing the name. Skip the `Element.Name` node when creating the filter in your graph and try again.

---

<div class="post-metadata">

**Author:** ![Potato](https://avatars.discourse-cdn.com/v4/letter/p/a6a055/32.png) [@Potato](https://forum.dynamobim.com/u/Potato)\
**Post date:** [August 30, 2024, 1:58am UTC](https://forum.dynamobim.com/t/filter-rule/103934/6 "2024-08-30T01:58:38Z")

</div>

With how it’s currently set up, it creates a Filter, just that it doesn’t set the Reference Level directly.  
If I skip the Element.Name, it comes back with error, and no filter is created.

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/5/9/59a8995e21dfcb202874bc0b58ceb2033c84af25.png)

![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/4/f/4ff71c8d6398e84fa89263f59e5fe6f9f6d18161.png)

---

<div class="post-metadata">

**Author:** ![Potato](https://avatars.discourse-cdn.com/v4/letter/p/a6a055/32.png) [@Potato](https://forum.dynamobim.com/u/Potato)\
**Post date:** [August 30, 2024, 3:11am UTC](https://forum.dynamobim.com/t/filter-rule/103934/7 "2024-08-30T03:11:00Z")

</div>

His method seems to work on Level, but not Reference Level

---

<div class="post-metadata">

**Author:** ![sovitek](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/sovitek/32/116237_2.png) [@sovitek](https://forum.dynamobim.com/u/sovitek)\
**Post date:** [August 30, 2024, 6:26am UTC](https://forum.dynamobim.com/t/filter-rule/103934/8 "2024-08-30T06:26:48Z")

</div>

Hi @Potato have you tried OOTB or archilab

 ![Skærmbillede 2024-08-30 082523](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/e/c/ec69373102281d35af0f27ddaa005a0656456d2a.jpeg)

---

<div class="post-metadata">

**Author:** ![Potato](https://avatars.discourse-cdn.com/v4/letter/p/a6a055/32.png) [@Potato](https://forum.dynamobim.com/u/Potato)\
**Post date:** [August 30, 2024, 7:12am UTC](https://forum.dynamobim.com/t/filter-rule/103934/9 "2024-08-30T07:12:32Z")

</div>

![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/d/c/dc310fba9dab9ec3841f0f1876f6fc8ba19e6a83.png)

I followed exactly like yours, but the Filter Rule comes back as Null

---

<div class="post-metadata">

**Author:** ![sovitek](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/sovitek/32/116237_2.png) [@sovitek](https://forum.dynamobim.com/u/sovitek)\
**Post date:** [August 30, 2024, 7:14am UTC](https://forum.dynamobim.com/t/filter-rule/103934/10 "2024-08-30T07:14:54Z")

</div>

seems you use archilab now…for ruletype is equal and not Equal…use archilabs ruletype node…and see if it could be better

---

<div class="post-metadata">

**Author:** ![Potato](https://avatars.discourse-cdn.com/v4/letter/p/a6a055/32.png) [@Potato](https://forum.dynamobim.com/u/Potato)\
**Post date:** [August 30, 2024, 8:11am UTC](https://forum.dynamobim.com/t/filter-rule/103934/11 "2024-08-30T08:11:37Z")

</div>

Arhhh  
I didn’t know they are different o.o  
The name and the function shows the same, but doesn’t work if swapped. Weird.

It works now

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/2/5/251f4492221b428693c20ff305fe57005d7e4628.png)

The next thing that I want to do is to set it so that for each Reference Level, there will be one Filter.  
my Current flow creates mutiple Filter Rules instead.

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/8/e/8e990764d550797d2a52731666dbf79f8ed9bce4.png)

What did I do wrong here?

EDIT: Arh… List.Chop…

---

<div class="post-metadata">

**Author:** ![sovitek](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/sovitek/32/116237_2.png) [@sovitek](https://forum.dynamobim.com/u/sovitek)\
**Post date:** [August 30, 2024, 8:30am UTC](https://forum.dynamobim.com/t/filter-rule/103934/12 "2024-08-30T08:30:22Z")

</div>

Its all about list level and lacing 😉  
 ![Revit_qxF6ciCTO7](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/9/6/96e6d9c121090d08f8b8bac65d3f8b772b33ecad.gif)

---

<div class="post-metadata">

**Author:** ![Potato](https://avatars.discourse-cdn.com/v4/letter/p/a6a055/32.png) [@Potato](https://forum.dynamobim.com/u/Potato)\
**Post date:** [August 30, 2024, 8:38am UTC](https://forum.dynamobim.com/t/filter-rule/103934/13 "2024-08-30T08:38:01Z")

</div>

Is there a Dynamo Node that counts all of the LEVELS created in the project?  
I tried looking around the forum and it keeps coming back with info on LEVELS in Lists.

I want to find the number of LEVELS created in the project.  
If its 5 levels, then it becomes 0,1,2,3,4 and place them in colour range, so that I can Override the Graphic Settings.  
I saw guides for doing this, but not on the count of all levels created in the project

![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/9/d/9d8862c711610889db800541068051724ed73fe6.png)

This only comes back with a 1… lol

---

<div class="post-metadata">

**Author:** ![sovitek](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/sovitek/32/116237_2.png) [@sovitek](https://forum.dynamobim.com/u/sovitek)\
**Post date:** [August 30, 2024, 8:42am UTC](https://forum.dynamobim.com/t/filter-rule/103934/14 "2024-08-30T08:42:09Z")

</div>

you could try this one here, if i understand ;😉

 ![Skærmbillede 2024-08-30 104053](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/b/b/bbb4e66e63722fb6d77b7075ffa27ede5b2aa31d.png)

or

 ![Skærmbillede 2024-08-30 104053](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/1/a/1a5c1da938ad5922233013e48771f8a3d45698eb.png)

---

<div class="post-metadata">

**Author:** ![Potato](https://avatars.discourse-cdn.com/v4/letter/p/a6a055/32.png) [@Potato](https://forum.dynamobim.com/u/Potato)\
**Post date:** [August 30, 2024, 10:48am UTC](https://forum.dynamobim.com/t/filter-rule/103934/15 "2024-08-30T10:48:25Z")

</div>

[View Filter Overall.dyn](https://forum.dynamobim.com/uploads/short-url/bfY7xyBfphxlbsspsq0zL110O3i.dyn) (62.9 KB)

Thank you very much!  
Managed to do this for Structural Framing

Now I want to make it so that it works for Structural Column for Base Level and Floor for Level  
I tried and it didn’t work, can you see whats wrong with my work?

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/f/4/f42f2454e2bd51a24ca855aa9c6cc9325421f94b.png)  
 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/1/3/13234c2cad0dcbb6b576acbf9f7ea8445d8e5334.png)

I transpose the filters, but it didn’t work

Thanks!

---

<div class="post-metadata">

**Author:** ![sovitek](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/sovitek/32/116237_2.png) [@sovitek](https://forum.dynamobim.com/u/sovitek)\
**Post date:** [August 30, 2024, 10:59am UTC](https://forum.dynamobim.com/t/filter-rule/103934/16 "2024-08-30T10:59:28Z")

</div>

no not really, but guess its about some sorting…try with first one element and then scale up when that works…

---

<div class="post-metadata">

**Author:** ![Potato](https://avatars.discourse-cdn.com/v4/letter/p/a6a055/32.png) [@Potato](https://forum.dynamobim.com/u/Potato)\
**Post date:** [September 2, 2024, 3:16am UTC](https://forum.dynamobim.com/t/filter-rule/103934/17 "2024-09-02T03:16:34Z")

</div>

![View Filter Overall_2024-09-02_11-11-13](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/e/6/e6b4d242d0e1d83afe4c4f61bc064d5087983fab.png)

I still can’t understand what I did wrong

Works when it’s only Structural Framing, but doesn’t when I add in Floor

Does it mean that Rules have to be Categories which contains the exact same parameter?  
If thats the case, Reference Level =/= Level, so the dyn is failing?

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/e/f/ef2d2a739bd0b5573a05370d65983c4322ee5c62.png)

I don’t think it should be an issue cuz Revit allows multiple categories of different parameter, but I can’t understand what I did wrong from the error given.

[Multiple categories in View Filter Create rule](https://forum.dynamobim.com/t/multiple-categories-in-view-filter-create-rule/12486)

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/4/1/41de68b381263ab6ed4248dadcff26adcfdc8fb7.png)

---

<div class="post-metadata">

**Author:** ![sovitek](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/sovitek/32/116237_2.png) [@sovitek](https://forum.dynamobim.com/u/sovitek)\
**Post date:** [September 2, 2024, 7:17am UTC](https://forum.dynamobim.com/t/filter-rule/103934/18 "2024-09-02T07:17:18Z")

</div>

allright have just given a fast test…it works…just about sorting ,list level, lacing…play around with it 😉

> **[About | Dynamo](https://primer2.dynamobim.org/)**
