Kill run

I typically use automatic mode while building the script and dealing with lists. Once I start making any changes to the model, I set the mode to manual and slide the dynamo screen over to the side.

I do this so that I can see if revit is regenerating the status bar.

If you happen to run yourself into an endless loop while in auto-mod, and have dynamo on the side, you might get lucky with the status bar and be able to mouse click cancel. If you can do this, it will pause the script for a user input, „do you really want to cancel?“

At this point, dynamo also freezes and you can set the mode to manual. That will get you out of am Autorun loop.

With Civil 3D that is not possible, you can only shutdown Civil 3D completely.

I wrote a ZT node that can be used as checkpoint:

The node is a passthrough for objects but with a bool parameter. If true it will show a message. If the user answers No, null is passed, else the objects. So actually there are two extra nodes needed (the passthrough and a node that generates a bool) and the disadvantage is that you need to place them yourself at strategic places. And set the level if needed.

For who is interested in the code (or want to convert it to Python):

        /// <summary>
        /// Pass object through the node if user clicks at Yes. Can be used to skip a long operation.
        /// </summary>
        /// <param name="objects">Objects to pass through at Yes</param>
        /// <param name="showMessage">If True, the messagebox is shown (i.e. "items.Count > 1000 ? True: False")</param>
        /// <param name="message">The message shown in the messagebox, leave empty to show default generated message</param>
        /// <returns>If user clicks No, null is returned, else the objects</returns>
        [Dynamo.Graph.Nodes.NodeCategory("Actions")]
        public static IList<object> PassThroughAtYes(IList<object> objects, bool showMessage, [DefaultArgument("null")]string message)
        {
            IList<object> returnValue = objects;

            if (string.IsNullOrWhiteSpace(message) == true) { message = string.Format("{0} objects to process, continue?", objects.Count.ToString()); }

            if (showMessage == true)
            {
                DialogResult dr = MessageBox.Show(message, "Pass through at Yes", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (dr == DialogResult.No) { returnValue = null; }
            }

            return returnValue;
        }
7 Likes