Hi people way smarter than me!
Overall, I’m having Dynamo analyze Revit Areas and perform various calculations based on their Use, Level, and other factors. The overall framework is nearly finished, with the main stumbling block being if Levels do not contain matching Areas. I had it working completely before I added the ability to group output by levels (key to some of the formulas).
To the left of my screen cap, Areas have been grouped by Level and then evaluated on the value of their “Use” (custom parameter). List[0] = true, List[1] = false. List[0][0] = Level 1, List[0][1] = Level 2. If there were more Levels, this would continue to …[2],…[3] and so on. As you can see, there are no Areas matching the Use evaluation on Level 1 but there is on Level 2. If I send this directly into an Element.GetParameterValueByName node, Dynamo indicates “Dereferencing a non-pointer.” I get that and I’m fine with that, except I need (in the end… not yet attached to the right) to have the total area for each level… so Level 1 could just sum to 0, and we could go on to the next Levels.
I’ve tried injecting artificial values to get a non-Empty List, and tried some List functions but nothing seems to get me past this error. So as you can see in my above screen cap, I have resorted to DesignScript. Except now I’m not sure if DesignScript is really reading my lists and sublists.
What am I missing? Am I going about this the wrong way?
Thank you in advance!
Ok so I changed my approach a bit. Instead, I “pre-evaluated” everything in the code,and used those values for the function:
This method seems more expandable anyway.
That’s usually the best way to go, for multiple reasons. If you can clean your data as you move along it’ll keep things moving smoother and quicker and you’re less likely to have data management issues in the end.
Another thing to mention, and this may not have been the problem in the first place, is that some nodes will give an error if a Null
or EmptyList
is the first item it iterates through - even when the node can normally handle those values. Just something to keep in mind.
1 Like
Thanks, Nick, good tip! Any advice on how to bypass the first value? That’s probably a loaded question but in this case with regards to gathering parameter values, skipping any null
or EmptyList
values while maintaining list structure?
1 Like
You can use the List.ReplaceEmpty node (I think from Clockwork) to replace the list with the first functional value in a flattened version of the list, and then replace item at index with an empty list after doing the calculation. This will slow your run time some but it avoids the error. Might be a better way to do it but i’d need more info on the overall workflow.
That said I prefer the method you used in the code block.
1 Like
There are a few workarounds, but nothing concrete really - that I’ve found at least. Like Jacob said, you can replace them with other values or you can try removing them from your graph until you need the list structure again and just insert them back into your list. Whatever works best for your workflow really.