I am attempting to read in information to Dynamo through a zero touch node with multiple outputs, and then use that information in my script. One of the outputs from the read node is a dictionary. At this moment, the read node is working beautifully, but my Zero Touch node that is supposed to read the dictionary output doesn’t work. I attempted to write a python node (something I’m more familiar with) to read the dictionary, and it won’t work. There’s something about the Design Script dictionary that doesn’t want to properly convert into a dictionary used by either of the two methods I’ve attempted to use. The input dictionary has Strings for keys and values of either type String or type List(Of String).
Using VB.net to create the Zero Touch node, I used roughly the following code, using objects for now to attempt to broaden my chance of success before narrowing down types to restrict input:
Public Shared Function GetCategoryValues(ByVal category As Object, ByVal name as Object) As Object Return category.Item(name.ToString()) End Function
This function is supposed to retrieve one value by the key, or name input, of the node. The warning I receive from this attempt is:
Warning: Object must implement IConvertible.
This warning occurs no matter how broad or restrictive I attempt to make the type of either inputs or the output.
For the Python node attempt at reading the dictionary, I get a myriad of issues depending on how I attempt to read or convert the input to a python dict, but the most common warning I received was:
AttributeError: ‘Dictionary’ object has no attribute ‘keys’
Now I don’t know about you all, but I understand dictionaries to have both keys and values, neither of which apparently a member or “attribute” of this particular dictionary. The syntax I most recently attempted with Python was simply:
OUT = IN[0][str(IN[0])]
I should note, the dictionary is originally being generated from a VB.net Zero Touch node, using the <MultiReturn({“out1”,“out2”})> approach, and I am using Revit 2019.2, Dynamo 2.0.3. The dictionary nodes of OOTB Dynamo read the dictionary output of my node perfectly fine, with no issue, but I want the ability to control both this GetValue node and other nodes in my script with a single Category node, such that Category: Doors would be converted to a string inside my GetValue node and then used as a key, instead of having an OOTB node with a Code Block node containing "Doors";
.
Any help on this very confusing and frustrating matter would be greatly appreciated!