Need to modify Python script to run

Hello,

I have a problem.
I start my Dynamo script. When it finishes I find that it completed one branch, but another branch with Python script was not performed. I can click the “Run” button again and again, but nothing happens. Then I open the Python script and add a blank line anywhere. Then click “Run” and get it done! Is it possible to fix?

I would be appreciated for any suggestion.

Thank you,
Evgeny.

It’s hard to give good advice without the script or at least images of the script for context.

However, if one branch should run before the other then try using the pass through node from clockwork. Also, depending on what you are doing, you may need to force close the transaction but this is rare. In other cases, again with the revit api you may need to regenerate the document, but usually this is when you are creating elements and trying to access them in the same code.

1 Like

Hi Daniel,
Thank you for sharing the ideas. I don’t think I do something special with the Dynamo script. I just reload the links which are “Room Bounding” and delete the rest. Here is the script:

And here is the Python code:

import os.path

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

from System.Collections.Generic import *

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

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

clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)

links= UnwrapElement(IN[0])
names= UnwrapElement(IN[1])
folder = BasicFileInfo.Extract(doc.PathName).CentralPath
folder = os.path.dirname(folder)
config = WorksetConfiguration(WorksetConfigurationOption.OpenLastViewed)
listOut = []
listOut.append("CENTRAL FILE LOCATION: " + folder)
i = 0 # index


for t in links:	
	name = names[i]
	i = i + 1
	n = name.find('.rvt')
	if n>1:
		name=name[0:n+4]
		if os.path.isfile(folder + "\\" + name) :
			fp=folder + "\\" + name
			fpm=ModelPathUtils.ConvertUserVisiblePathToModelPath(fp)
# remove BIM360 path
			try:
				t.LoadFrom(fpm, config)
			except:
				i=i
# Set path to Relative
			try:
				t.PathType = PathType.Relative
			except:
				name=name

OUT= listOut

I removed the branch which deletes unwanted links. So there is only one linear Dynamo script and the Python module doesn’t work in it. :cry: