Sequencing python nodes


Good morning,

I’m trying to make a python node run after the previous one has completed. What is the best way to accomplish this?


Thank you in advance!


You could connect the select model elements node to the first python node and connect the output from that node to your second python node.

Theoretically you could also just connect your first node to the second, but I think I’ve had some issues with correct sequencing in the past using that method.


I suppose that in your case the 2nd Python node inputs are not the outputs of the 1st, right?

Usually I use Orchid node Data.Await, for example when you have an element, you want to do something with it and then delete it. In a normal case it might be deleted before the other task is completed, causing the graph to fail.
With this node the 2nd node starts to work only when the 1st is over.


Good idea! I think this would work in most cases.

Unfortunately, in my specific case at the moment this solution is not working. It must be the methods I am using (post command & selection.setelementids)


Postcommand can only run once in a process!
you can tweak events but they can only run once anyway…

I have tweaked it this way so it can be processed the number of times you want it to by adding more purge nodes.


Do you have any experience to subscribing to Revit API events in Iron Python? I’m trying to subscribe to the Idling Event under UIApplication Class. Here is some documentation:

Iron Python - Accessing .NET events
Revit API - Idling Event

And here is my code. I’m pretty sure I’m close to the solution but can’t seem to get it figured out.

import sys
pyt_path = r'C:\Python27\Lib'
import clr

import Autodesk
from Autodesk.Revit.DB import *

import Revit

import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
from System.Collections.Generic import *

clr.AddReference ('RevitAPIUI')
from Autodesk.Revit.UI import *

doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
uidoc = DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument
app = uiapp.Application

#Postable Command
command = PostableCommand.MergeSurfaces
merge = RevitCommandId.LookupPostableCommandId(command)

def Merge():

def Idle(sender, IdlingEventsArgs):
print 'Idling'


#Subscribe Idling Event

uiapp += Idle

OUT = None

Thanks for any help in advance!


I work in .Net for everything else than quick fixes which I from time to time do in Python.


Do you think you could take a quick look at what I’m trying to accomplish above?

It seems that subscribing to an event should be a basic task, but I’m really struggling with subscribing to a .Net event in Python. I would greatly appreciate if you could give me your input since you are a much more experienced user! :slight_smile:

As a side question:
When you say you work in .Net for everything does this mean you are running your script through macros? And if so, is this a more valuable, efficient way to run scripts for Revit?


My entire package is a ZeroTouch package coded in C#. You can do much more with C# than you can do with IronPython 2.7.3.

If you want to start coding in .Net then go to this page for a start

I have a small demo sample you also can see.