I’ve been tring to get the name of the project parameters through python and the API but it keeps getting me the error message: The managed object is not valid.
Here is the code:
import clr
clr.AddReference("RevitServices")
from RevitServices.Persistence import DocumentManager
doc = DocumentManager.Instance.CurrentDBDocument
res = []
iterador = doc.ParameterBindings.ForwardIterator()
while iterador.MoveNext():
res.append(iterador.Key)
OUT = [a.Name for a in res]
I have run into this issue before specifically with ParameterBindings. I think the only way to solve this (temporarily) was to restart Dynamo and/or Revit. The code you have written is syntactically correct, but I think the error is out of your control.
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
clr.AddReference("RevitServices")
from RevitServices.Persistence import DocumentManager
doc = DocumentManager.Instance.CurrentDBDocument
res = []
iterador = doc.ParameterBindings.ForwardIterator()
while iterador.MoveNext():
res.append(iterador.Key.Name)
OUT = res