Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Access to Key of KeyValuePair not possible with Python Interpreter #14728

Open
tinrobot2000 opened this issue Dec 9, 2023 · 1 comment
Open

Comments

@tinrobot2000
Copy link
Contributor

tinrobot2000 commented Dec 9, 2023

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?

image

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])
Copy link

github-actions bot commented Dec 9, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Triage
Development

No branches or pull requests

1 participant