Access to Key of KeyValuePair not possible with Python Interpreter
Dynamo Version
2.18.1
Host
Revit 24.1.0.66 20230701_1515(x64) 2024.1.0
Operating System
Windows 10
What did you do?
Trying to get the Key for the BindingMap always throws an exception
OUT = doc.ParameterBindings.ForwardIterator().Key
What did you expect to see?
A ParameterGroup, or at least a string
What did you see instead?
What packages or external references (if any) were used?
None
Stack Trace
No response
Details
EDIT
You can retrieve some information
sp = SharedParameterElement
CPython3
doc.ParameterBindings.get_Item(sp.GetDefinition())
IronPython
doc.ParameterBindings.Item[sp.GetDefinition()]
EDIT 2 Workaround
# CPython3
params = FilteredElementCollector(doc).OfClass(ParameterElement).ToElements()
def get_binding(param):
binding = doc.ParameterBindings.get_Item(param.GetDefinition())
if binding:
return param.GetDefinition().Name, binding
OUT = filter(None, [get_binding(p) for p in params])
Thank you for submitting the issue to us. We are sorry to see you get stuck with your workflow. While waiting for our team member to respond, please feel free to browse our forum at https://forum.dynamobim.com/ for more Dynamo related information.