Hi there gurus,
Trying to ask if there is a way to read the dynamo scripts properly.
I am currently using powerBI / excel to query and transform the data to check for duplicates in the Id and Uuid.
Not really sure if there is a solution here but I just thought I should post this in to try my luck.
Image below on the structure of the data.
(redacted info for privacy)
i have managed to somewhat get this to work slightly but trying to find a more optimized solution.
Hope this perks the interest of any data scientists out there!
A .dyn is a json formatted string, so if you read the text with Dynamo (ReadText) you can then invert the text data to a dictionary by using the json Deserialize node, and from there you can query the file’s properties as desired.
Minimal code example
# CPython3
import json
from pathlib import Path
directory = Path(IN[0]).glob("*.dyn")
output = []
for file in directory:
with open(file) as f:
try:
data = json.load(f)
output.append(data["Uuid"])
except:
output.append(str(f))
OUT = output
2 Likes
Did a bit of experimentation so… it seems to work if i read the file via json.
Sharing two solutions here that I have found from the advice above.
First is the Sandbox method. Unfortunately, I couldn’t get the python script to work from Mike’s code.
I believe through dynamo it’ll be a bit more interesting when I downloaded a 2018 package that still works by @alvpickmans
Kinda opens up a bit of variety for dynamo solutions… Does this mean that I will be able to add certain group of nodes to multiple dyn scripts? Hmmm food for thought.
The second method, this is a transposed data with hidden Name on PowerBI.
It does make it nicer and easier to read so I will approach the json with this method instead.
Thus, the more suitable answer is by @jacob.small
Thanks and merry christmas!
2 Likes
Yes, that is doable.
Or swap nodes for non-deprecated versions in bulk. Change the Python engine. Alter scripts. Etc.
If you’d like to check out some examples of stuff like that, check out this post where I outline some tools I presented at BiLT a few years back. It has some Python code to bulk edit Dynamo graphs at scale, as well as some code to prep for automated testing thereof.
1 Like