I have two lists being passed along into ScheduleView.AddFilters, one contains a list of ScheduleViews and the other a list of ScheduleFilters. My current issue is I am getting a warning as if I am trying to add over 8 filters to one schedule, where instead, I am trying to assign one per schedule. If I send over the list of ScheduleViews and one ScheduleFilter it works but assigns the wrong filter of coarse.
I do not know if this is the reason but why is the list of ScheduleViews spaced differently to the list of ScheduleFilters?
Should I nix the Node and create a python script node to assign the filters? Am I using the ScheduleView.AddFilters Node incorrectly?
I learned about Lacing after I had noticed that this was the cause of a few issues others had but sadly in my cause, none of the Lacing options worked.
I did fix the issue using python but that also had its own weird issues. I figured I could create a new filter and assign the filter within the same for loop but it was adding every filter I created to each schedule I created.
In order to get the python method to work I had to use a for loop and zip the scheduled and filters, which does what I thought my original idea would do. I suspect that there was some issues with the data not being overwritten correctly but I did try to Dispose the data without success.
# Enable Python support and load DesignScript library
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
# Import RevitAPI
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *
# Import DocumentManager and TransactionManager
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application
# The inputs to this node will be stored as a list in the IN variables.
schedule_views = UnwrapElement(IN[0])
field = ScheduleFieldId(0)
target_definitions = []
target_filters = []
# Place your code below this line
TransactionManager.Instance.EnsureInTransaction(doc)
count = 0
for view in schedule_views:
target_def = view.Definition
target_definitions.append(target_def)
for view in schedule_views:
single_filter = ScheduleFilter(field, ScheduleFilterType.Equal, view.Name)
target_filters.append(single_filter)
for this_def, this_filter in zip(target_definitions, target_filters):
this_def.InsertFilter(this_filter, 0)
TransactionManager.Instance.TransactionTaskDone()
# Assign your output to the OUT variable.
OUT = schedule_views
I don’t want to mark this as solved because I would like to know how to correctly use the node but it may not be possible.
Looks like a list levels issue. Set your inputs to Views @L2 and Filters @L1 and it should work.
I believe this node is expecting the filters to be one level deeper in list nesting with the default inputs. Either it’s a single view and a list of filters, or a list of views and a list of lists of filters.
I attempted your solution and it no longer errors but it only sets the value to the first in the filter list. So each view is filtered by the same value. I will mess with this some more tomorrow, Thank you for your time.
EDIT:
I thought the same as you did also and tried a bunch of way to organize the filter list all with no success.
Try @L1 on both then, or flip the L1/L2 around. Just shooting from the hip, would have to pull up a project to see for sure. Doing a list.chop on your filters list at length 1 and using the default inputs without levels should also do the trick to get your filters 1 level deeper than your views.