How to force nodes to rerun without changes / When nodes rerun?

Since you are running in revit add the below code into a python node without any inputs or outputs.

Then rename the nodes you want to reload with “*Force” at the front of them(without the quotes), see video of how to use it from roughly 1 minute 50 seconds on wards.

Video of it in action from 1 minute 50 seconds : https://knowledge.autodesk.com/support/civil-3d/learn-explore/caas/screencast/Main/Details/23d7d023-37ac-479f-827b-0d054bec838e.html

Note: This Code Will Only Work In Dynamo For Revit

# Original Code by John Peirson
# https://forum.dynamobim.com/t/force-run-python/31709/2

# Code has been updated/modified by Brendan Cassidy(@brencass86)
# The Creator of DynaStandard

import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *

clr.AddReference('DynamoRevitDS')
import Dynamo
#access to the current Dynamo instance and workspace
dynamoRevit = Dynamo.Applications.DynamoRevit()
currentWorkspace = dynamoRevit.RevitDynamoModel.CurrentWorkspace

def onEvaluationcompleted(obj, e):
	for i in currentWorkspace.Nodes:
		if i.Name.StartsWith("*Force"):
			i.MarkNodeAsModified(True)
#the handlers for when a script has been run
currentWorkspace.EvaluationCompleted += onEvaluationcompleted

#output
OUT = "Done"
6 Likes