del;
wall;
[Imperative]{
still = [];
for (w in wall){
if (del){
Revit.Element.Delete(w);
still.Add("Deleted!");
}
else{
still.Add("Still here!");
}
}
return = still;
};
Tbh python is my go to but I thought I can do it with a simple âif condition ? {true} : {false}â but turns out more is necessary. From here to there, I continued to perform it with designscriptâŚ
The first line filters a new list containing the list of walls by the boolean âdelâ and pulls just the stuff which passed the filter. if you provide true the one item in the list (the list of walls) will be returned. Otherwise nothing will return.
The second line deletes every object in the list of objs from the first line. If objs is an empty list no warning will trigger and nothing will happen in Revit, but if objs is a list of elements itâll try to delete them all.
List.FilterByBoolMask is a Dynamo node you likely know of. It has multiple outputs, one for âinâ which is stuff that passed the filter, and one for âoutâ which is stuff which didnât pass the filter.
Typically we think of the two outputs as single items, but in reality nodes with multiple outputs return a dictionary where the port name is the key and the content of the port is the value. As such we have to call for the value of âinâ from the dictionary that List.FilterByBoolMask returns, this is easiest to do with the ["in"] after the dictionary object which the node returns. You can also use the Dictionary.ValueAtKey method to parse the value, but that is a LOT more typing and youâll get carpel tunnel by not taking the clean shortcuts which are available to you.