Need simple help with python script delaying start

I want to use passthrough to delay an archi-lab node BK.GetAllViews from starting until previous operation is done but it doesn’t have any inputs to make that happen. Could you help me modify it’s code to start operation only after it receives “TRUE” Boolean input?
Here is the setup:


The input wasn’t there originally, I added it:

But right now the input doesn’t do anything because I haven’t modified the code.
Here’s the code, could someone help me modify it to only run after receiving that “TRUE” input?

Code:

#Copyright(c) 2015, Konrad Sobon
# @arch_laboratory, http://archi-lab.net

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

# Import DocumentManager and TransactionManager
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

# Import RevitAPI
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *

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

from System.Collections.Generic import *

# Import ToDSType(bool) extension method
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)

#The inputs to this node will be stored as a list in the IN variable.
dataEnteringNode = IN

#collect all views in the model
collector = FilteredElementCollector(doc)
views = collector.OfClass(View).ToElements()

#sort views into separate lists based on view type
areaPlans, ceilingPlans, columnSchedules = [], [], []
costReport, details, draftingViews = [], [], []
drawingSheets, elevations, engineetingPlans = [], [], []
floorPlans, internal, legends, loadReports = [], [], [], []
panelSchedules, pressureLossReports, renderings = [], [], []
reports, schedules, sections, threeD = [], [], [], []
undefined, walkthrough = [], []
for i in views:
	if not i.IsTemplate:
		if i.ViewType == ViewType.AreaPlan:
			areaPlans.append(i.ToDSType(True))
		elif i.ViewType == ViewType.CeilingPlan:
			ceilingPlans.append(i.ToDSType(True))
		elif i.ViewType == ViewType.ColumnSchedule:
			columnSchedules.append(i.ToDSType(True))
		elif i.ViewType == ViewType.CostReport:
			costReport.append(i.ToDSType(True))
		elif i.ViewType == ViewType.Detail:
			details.append(i.ToDSType(True))
		elif i.ViewType == ViewType.DraftingView:
			draftingViews.append(i.ToDSType(True))
		elif i.ViewType == ViewType.DrawingSheet:
			drawingSheets.append(i.ToDSType(True))
		elif i.ViewType == ViewType.Elevation:
			elevations.append(i.ToDSType(True))
		elif i.ViewType == ViewType.EngineeringPlan:
			engineetingPlans.append(i.ToDSType(True))
		elif i.ViewType == ViewType.FloorPlan:
			floorPlans.append(i.ToDSType(True))
		elif i.ViewType == ViewType.Internal:
			internal.append(i.ToDSType(True))
		elif i.ViewType == ViewType.Legend:
			legends.append(i.ToDSType(True))
		elif i.ViewType == ViewType.LoadsReport:
			loadReports.append(i.ToDSType(True))
		elif i.ViewType == ViewType.PanelSchedule:
			panelSchedules.append(i.ToDSType(True))
		elif i.ViewType == ViewType.PresureLossReport:
			pressureLossReports.append(i.ToDSType(True))
		elif i.ViewType == ViewType.Rendering:
			renderings.append(i.ToDSType(True))
		elif i.ViewType == ViewType.Report:
			reports.append(i.ToDSType(True))
		elif i.ViewType == ViewType.Schedule:
			schedules.append(i.ToDSType(True))
		elif i.ViewType == ViewType.Section:
			sections.append(i.ToDSType(True))
		elif i.ViewType == ViewType.ThreeD:
			threeD.append(i.ToDSType(True))
		elif i.ViewType == ViewType.Undefined:
			undefined.append(i.ToDSType(True))
		elif i.ViewType == ViewType.Walkthrough:
			walkthrough.append(i.ToDSType(True))
		else:
			continue

#Assign your output to the OUT variable
OUT = areaPlans, ceilingPlans, columnSchedules, costReport, \
	details, draftingViews, drawingSheets, elevations, \
	engineetingPlans, floorPlans, internal, legends, \
	loadReports, panelSchedules, pressureLossReports, \
	renderings, reports, schedules, sections, threeD, \
	undefined, walkthrough

Hi @1bitBoolean ,

I recommend highly against editing Custom Nodes from packages since then they won’t update on other computers.

What you can do is add an Transaction.End node to force the previous code to finish completely, you would have to add that in between the current data stream which is connect to the “waitfor” input.

Then you can add a List.FilterByBoolmask AFTER the custom node to only parse through the data if you select “true” in the boolean input.

That’s not how a passthrough/wait node works. A passthrough node takes two inputs, one being the data to “passthrough” (the output) and the other being the “code” that needs to finish executing before passing the output. This works because Dynamo nodes only execute once all of their inputs are valid. So instead of passing one node an input directly, you can pass it through a passthrough/wait node with the input from another part of the graph that you want to execute first.

Oh so it should work if it’s connected even if nothing in code asks for input?

Correct. The node is expecting an input even if it does nothing.

In fact, you’ve essentially created your own “wait” function by adding the input. The passthrough node isn’t even necessary at this point because the custom node won’t run until it has an input value.

1 Like