Does View.AddFilter supports Area Plans?

Is there a workaround for Add.ViewFilter (OOTB) when working with AreaPlans?
It doesn’t seem to accept the ViewType when it is an AreaPlan,
Other ViewTypes do seem work in the same graph.

Dynamo 1.3.2
Revit 2017.2

I feel like this is something @Konrad_K_Sobon has fixed / or has a PR for.

1 Like

The package Hot Gear has a node called “Add Filter to View” that works with area plans

4 Likes

Area Plans support was merged here: https://github.com/DynamoDS/DynamoRevit/pull/1679

That would mean it is available in 2.0 or in dailies.

@Michael_Kirschner2 you did cherry picks for it, and fixed bunch of stuff on that PR. Thanks!

2 Likes

:stuck_out_tongue: @Konrad_K_Sobon it’s tough to keep track sometimes, thanks for your prs!

1 Like

@awilliams

I tested the Hot Gear package and it’s Node, i’m sorry to take back the solution tickmark as its not working for me. i will try a latest stable (1.3.3) (2018-11-april) to see if that works. Since the change in login routine on the forum i cannot login in from my computer at work, therefore i’m not able to post my workflow, and not having the time to clear this up doesn’t help also.

@Marcel_Rijsmus I just had a look and I couldn’t get the Hot Gear node to function without taking it out of the custom node and chopping the script up, so I just rewrote it differently. Tested and it works for area plans in Revit 2018.3 with Dynamo 1.3.2

import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *

clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *

doc = DocumentManager.Instance.CurrentDBDocument


clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)

views = IN[0]
if not isinstance(views,list):
	views = [views]
filters = IN[1]
if not isinstance(filters,list):
	filters = [filters]

def addFilter(views,filterid):
	for view in views:
		view = UnwrapElement(view)
		view.AddFilter(filterid)
		
TransactionManager.Instance.EnsureInTransaction(doc)

for filter in filters:
	filter = UnwrapElement(filter).Id
	addFilter(views,filter)
	
TransactionManager.Instance.TransactionTaskDone()

OUT = views,filters
6 Likes

thank you for your time, i will give it a go on monday and let you know.

Marcel

1 Like

Nice one!!!

I tested it on Area plan and it was working :slight_smile:

Was also looking for a code like this

Thank you a lot, been looking for long for some codes solve the area plans issues with view filters.

It would be really great help if you can post 2 important code to complete solving the issues with area plans

1- collecting view filters from area plan view
2- area plan views set filter override

Thanks you

@mohamed.mostafaDQCGU glad that the script is helpful for you!

Please read this post if you have not already: https://forum.dynamobim.com/t/how-to-get-help-on-the-dynamo-forums/

@awilliams what i am actually trying to do, is, thanks for you we can add filter to area plans which wasnt applicable before, but the a bit step further i am looking for, to override these filters in th area plans as you can se below
image

Unfortunately am not a python user yet, so i would really be thankful if you can help with another code for this step
Thank you a lot