Hey folks, im getting an unexpected indent error following my attempted addition of the try and except area of my python script. (near the bottom) I had to make this addition because the script was failing on missing files. This may be something obvious, my python is pretty rusty.
#python nodes in dynamo 1.0.0
#originally by Nicklas Østertgaard nvo@bimshark.com / nvo@shl.fk
#adapted to handle suffixes by Lucas Cunningham
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
# Import ToDSType(bool) extension method
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
# Import geometry conversion extension methods
clr.ImportExtensions(Revit.GeometryConversion)
# 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 *
doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application
uidoc=DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument
collector = Autodesk.Revit.DB.FilteredElementCollector(doc)
linkInstances = collector.OfClass(Autodesk.Revit.DB.RevitLinkInstance)
folderpath = IN[0]
suffix = IN[1]
reloadedlinks = []
for i in linkInstances:
name = i.Name
path = folderpath + "\\" + name
path = path.rsplit(' : ',2)[0]
plist = list(path)
plist.insert(-4, suffix)
cpath = ''
for s in plist:
cpath += s
filepath = FilePath(cpath)
RevitLinkType = doc.GetElement(i.GetTypeId())
try:
RevitLinkType.LoadFrom(filepath,None)
except:
reloadedlinks.append('failed on ' + filepath)
reloadedlinks.append(RevitLinkType)
OUT= reloadedlinks, suffix, cpath
As always thanks for the help.