Hi,
I’m building a Dynamo tool to number Doors and Windows according to their ToRoom and FromRoom parameters. I’ve just solved a major roadblock outlined here (Order of execution problem: changing same parameter twice) but now I’m running into an even more alarming bug that’s potentially going to cause lots of trouble.
Basically, it’s this old issue: https://github.com/DynamoDS/Dynamo/issues/5238
If a Revit node takes a List as an input, and the FIRST item in the List is a null, the execution of the entire node fails. I understand this is because the data type of the node input is determined by the first item, in case of mixed-type Lists. (as a sidenote: I don’t think this is a wise approach, but the datatype should be determinable by the author of the script. If you have mixed lists, you probably don’t know the order of the list items beforehand either.)
In my Dynamo definition there’s a List of Doors (every door in the active project), and 2 corresponding Lists of Rooms (the FromRoom instance of each Door, and the ToRoom instance of each Door). The problem is that the Room lists might be incomplete, in case some Door is an exterior door and has no Room on the other side. So
- there will be nulls in the Room list
- there’s no way of knowing where in the list these nulls are, because the doors are retrieved automatically, so…
- …there might be a null as the FIRST item in the list - which causes the script to fail
- I need to keep the Door list and the Room lists as being the same length in order to input the Room properties into the corresponding door, so List.Clean is out of the question.
I’ve just fixed one problem with Nulls in the list using the Clockwork node List.ReplaceNull - but in that case the List datatype was a String which is easy. Now I’d essentially need to replace the null entries in the Room list with Room objects to prevent the next node from failing. Is this possible? How can I create a new Room and then delete it after I no longer need it?