GET A VIEWFILTERS AND SET IT TO OTHER VIEWS

GET A VIEWFILTERS AND SET IT TO OTHER VIEWS

MiguelGT17
Advocate Advocate
392 Views
2 Replies
Message 1 of 3

GET A VIEWFILTERS AND SET IT TO OTHER VIEWS

MiguelGT17
Advocate
Advocate

Let's say I've created a filter without using the API, then I want to set it in other views:

MiguelGT17_0-1638423473513.png

MiguelGT17_1-1638423513672.png

So far Revit lookup identifies my filter view as a ParameterFilterElement and I'm making this task work bypassing its Id to a ElementId class, then I deploy the view.AddFilter() class. However, ironpython throws me back the following error :

 

view=doc.ActiveView
ogs=OverrideGraphicSettings()
filterId=ElementId(442768)
filter=doc.GetElement(filterId)
tr=Transaction(doc,"filter")
tr.Start()
view.AddFilter(filter.Id)
tr.Commit()
 
MiguelGT17_2-1638424108937.png

 

How can I query the filterElement Id of an actual View filter manually built without using API

Thanks In advance

 

 

0 Likes
393 Views
2 Replies
Replies (2)
Message 2 of 3

jeremy_tammik
Alumni
Alumni

If the element you created is database resident, you can explore it interactively using RevitLookup. For instance, add the filter manually via the UI and use RevitLookup and other tools to determine how that affects the database afterwards:

  

https://thebuildingcoder.typepad.com/blog/2017/01/virtues-of-reproduction-research-mep-settings-onto...

   

That should enable you to determine the element id you need as well as where it is stored and thus how it can be retrieved programmatically.

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
0 Likes
Message 3 of 3

piotrekchoromanski
Observer
Observer

Hello Jeremy. First of all thank you very much for your activity in Revit programming. I find you a very inspiring personality in this environment. I am a beginner in API and I think I have a similar problem which was described above. Unfortunately I don't understand why even though the script doesn't report errors it still doesn't do the job. Please advise me very much.

example.jpg

 

:

0 Likes