When Dynamo Crashes Revit is Locked

Odd issue here, after a dynamo crash and report is summited, I try to access Revit and nothing except the windows issue sound effect happens, when trying to click the mouse. This is the same thing that happens if you were to say have a window like the type editor open and you tried to change something inside of Revit without closing the type editor. This issue means I have to task manager close Revit as Alt+F4 doesn’t appear to work either. Speaking of task manager searching for anything dynamo relates yields no results. After force closing Revit I can reopen dynamo and continue using it and Revit as normal (that is until it crashes again).

This wouldn’t be that big of an issue if I could at least SAVE the project I’m currently working on before closing Revit, but that is not possible as no keyboard inputs appear to work.

Any Revit/Dynamo Doctors who may have experience with this issue?

Dynamo for Revit acts as any other Revit add-in so that you can access the Revit API. This means that Revit is the primary host and is the only thing which will show up in task manager in most cases. It also means that if your Dynamo authoring calls the Revit API in such a way as to cause Revit to start an infinate loop, initiate a VERY LONG running process, or just causes a crash, then Revit will lock up or crash as well.

This was made more stable in recent years where sometimes if left to it’s own devices Revit will recover (or crash itself). But if you lock up Dynamo it is usually locking up Revit rather than Dynamo itself (try building a similar graph in Dynamo Core and see if that locks up as readily).

That tie in to the Revit core processes also means that if you need to force quit you will need to force quit Revit.

Moving out of Revit and into a ‘read with this tool, calculate with that tool, record selected results with the other tool’ is a good way to reduce processing, but the trade off for now is building 2 graphs in the Revit context and one graph in the isolated sandbox context.

Could you (or anyone reading this) explain the method you describe as

read with this tool, calculate with that tool, record selected results with the other tool

Sure. Pushing the required data to get the context for a decision out of a Revit and into another file (the read), then using Dynamo sandbox to make a decision and write an intermediate file (the calculate), and then use that intermediate file to add data back into Revit (the record).

Let’s try a hypothetical: say you wanted to place family instances for storage solutions in every room within a model. You need three things for this: (1) the geometry and clearances of the storage objects relative to a local origin, (2) the layout rules for storage element placement, and (3) the geometry of the available space into which they should be placed.

The first can be encoded once into an external file using a format such as JSON or the like - no need to open Revit thereafter for this info.

The second can be defined in a Dynamo graph to place geometry instances based on an array of coordinate systems. No need to use Revit for that info.

The third can be accessed by Revit and saved into an external file as well using JSON or similar using Dynamo. As long as the space geometry doesn’t change you can reuse the data over and over. Building a ‘read’ graph that read the space geometry data using Dynamo for Revit and writes to an intermediate file is pretty easy.

With those three things pulled out of Revit you can do the layouts infinitely using Dynamo sandbox - no need to tie up Revit - to identify the optimized layout of the storage units. You can save the idealized result out to another intermediate file - say a JSON file containing the coordinate systems which define the location and orientation of each instance grouped by the associated family type.

Finally you can write a 3rd Dynamo graph that reads the intermediate file and uses the data therein to place new instances of each family type according to the groups of coordinate systems in the JSON.