HI, I’m bit of a newbie with Dynamo and Python, I’m currently running into wall and stuck, i will be greatly appreciated if anyone could help.
1.)I’m creating a script that count the number of unit type(name) on each of the level from Revit Room. The script first filter the level of the room parameter, then the type of unit and count the count the occurrence of the particular unit type.
I manage to create a code block that return the number of the desired unit type on the desired level. However when I try to make a def of that script it return a list instead of the number that generated in the code block. Could anyone point me out where did I went wrong with the def?
2.)I’m also trying to get the code block to return 0 if it run into an empty list. This is to make sure the number of unit is 0 when it search through level that has no rooms, it always return 1 instead of 0 when I run it through level that has no rooms.
3.)The reason I want to make the design block into a def is to allow me to create a for loop that search through all of the level to generate the unit number, I can sort of achieve that right now by copy and pasting the code block for each of the level, it would be much smarter if I can incorporate the design script into the for loop.
I’m also wondering if I should do the for loop at a design block or python? what are the pros and cons of doing it either way? and is it hard to ‘translate’ the code in the design block to python, it doesn’t seem to be quite straight forward when I test run it.
I know it a very long post… I really have to thanks anyone who read through it…
Thanks again…