Revit crashing when running script in complex Revit-files


I’m af student and fairly new to Dynamo, only done af few scripts before.
I’m currently working on af new script. I ran the script in a very simple revit-model, with 3 different types of generic walls and generic floors. And it worked just fine. But when I try to run the script in the file I want to use it in (more complex), it chrashes. I’ve detached the file, and I’ve tried other files frem earlier semesters. I’ve also tried making a new dynamo file, and running it with just the 4 first nodes of the script, it still crashed.

Hope you can help.

You are overriding elements which are not visible in the view, which is likely going to confuse Revit, which is going to take some time. Is there an actual crash (as in Revit and Dynamo stop working), or does it just go unresponsive for a long time? My gut says that you are just asking for a LOT of stuff here, most of which can’t have a meaningful result.

Imagine you’re Revit and your professor is Dynamo - they tell you where to go and what to do when you get there (hopefully not an accurate analogy). They they say ‘go to the square in town and use sidewalk chalk to put an X on the sidewalk in front of these buildings,’ handing you a list of buildings. You go to the square and the list of buildings is: the Eiffel Tower, the Empire State Building, and the Sydney Opera House. You would be pretty confused huh? You buy airline tickets, fly to the two (lucky to go to school in one of those locations!) or three (likely) cities, draw the X in front of each, and head home. The prof goes to the square the next day and says ‘huh, I can’t see the X from here, but I’ll take your word for it.’

That is what Revit is up - setting things it can’t see to be ‘pink’ or whatever override you give it. And there are a lot more than 3 walls after all. Try limiting your collection to just walls in the view, that way Revit won’t have to fly all the way around the world to accomplish the instructions given by Dynamo. Also be patient. With large data sets things can take a bit. Be sure there are no element bindings in the file, and hit ‘run’ before you head to another lecture - Revit and Dynamo will likely be some when that ends (and be happy there is only one core in use as it means you’ll be able to zoom call on the same system - a second monitor helps if you have it though).

Hi JacobSmall

Thank you for the fast reply, love your analogy!
You’re correct that it does go unresponsive for a long time, and if I click the Dynamo window, the usual windows box pops up with “Dynamo stopped working. Windows is checking for a solution to the problem”.

I get that I have to limit the amount of data dynamo has to get. But that kinda ruins the purpose of the script I’m doing, if I can’t use it in more complex files. The script is supposed to be able to find certain walls and floors in a view, and color them a specific color, according to the value of a type parameter.

I’ve tried running it with only the two first nodes, and it worked fine, though with the next two nodes (when it has to find the walls with the “Lydklasse” type parameter) it goes unresponsive. I’ll try to be more patient when running the script. Otherwise I don’t really know how to work around it.
Thanks for the help

Perhaps try grabbing only the walls in the active view, reducing the amount of data processed significantly.

Said another way: focus on the buildings in the square, not all the ones in the world.

I believe that data shapes has a node for ‘all elements of category in view’, and I recall there is a similar node introduced around Revit 2020 or 2021.

1 Like