Hello I got a code that gets the project parameters and their names, it works with current document but it does not work with links instances or documents because I get error:
Warning: IronPythonEvaluator.EvaluateIronPythonScript operation failed.
Traceback (most recent call last):
File "<string>", line 28, in <module>
AttributeError: 'NoneType' object has no attribute 'ParameterBindings
the code is this:
import System
import clr
clr.AddReference("RevitAPI")
from Autodesk.Revit.DB import *
import Autodesk
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
inputdoc = UnwrapElement(IN[0])
if inputdoc == None:
doc = DocumentManager.Instance.CurrentDBDocument
elif inputdoc.GetType().ToString() == "Autodesk.Revit.DB.RevitLinkInstance":
doc = inputdoc.GetLinkDocument()
elif inputdoc.GetType().ToString() == "Autodesk.Revit.DB.Document":
doc = inputdoc
else: doc = None
names = []
elems = []
iterator = doc.ParameterBindings.ForwardIterator()
while iterator.MoveNext():
names.append(iterator.Key.Name)
elems.append(doc.GetElement(iterator.Key.Id))
OUT = names, elems
How come the linked doc does not have ParameterBindings attribute?