How can you get a Dynamo Dictionary out of a Python Node?
Thanks!
This will import the dictionary libraries.
Python:
import clr
clr.AddReference('DesignScriptBuiltin')
from DesignScript import *
OUT = Builtin.Dictionary.ByKeysValues(["S"],[3])
But to get the nested lists and all that to work would require more effort and probably sample files that represent your list structure, etc… It would also require someone who knows Python better than me.
2 Likes
Hello an example
another way is to create a custom object from element (instance of a Python Class)
class MyCustomDataElement():
def __init__(self, elem):
self.connectors = #.......
self.mepSystems = #.......
self.location = #.......
6 Likes
Really handy. I have a question: will the “custom class” works also outside the python block? I mean, don’t it will passed to Dynamo as “ironpython.something” ?
@FabioDeAgostini
a small example with a cable Tray
Note:
To be purist, attributes should be passed into properties
2 Likes