I’m trying to convert a dictionary to a list because my script won’t work by using the dictionary. I used a file from the primer and added my own parameters to it. The dictionary seems to have problems reading out the excel that’s composed by me.
My goal is to create a space plan in Dynamo with my own parameters based on the script of the primer. The primer script fails when you make changes in number of rooms in excel. The dictionary node seems to be a big problem and I want to resolve this problem by using list nodes. But I don’t know how to rewrite the dictionary node with list nodes. My output would be the same as the primer script, just with less rooms. Can you help?
Thanks in advance!
Since I wrote the graph you’re looking at, likely. Which primer are you referring to as I don’t recall that being in the Dynamo primer. I do know that I have run this graph with anywhere between 3 and 18 spaces to layout, all by updating the excel file.
The dictionary node is actually key to making the graph run in a reasonable time - dictionaries process the data much faster than lists, and they have the added benefit of maintaining an ordered structure no matter what you do.
In reviewing the content you provided, there are multiple errors before the dictionary is used.
Your color listing has only two values for both the toilet and bedroom 2. You need to provide an R, G, and a B value for the graph to work. One failed input like this will cause a failure no matter what method you use for moving and organizing your data.
You’re dropping one of the spaces which is going ot make it difficult to get the results you’re after - change the List.DropItems after your read the excel values from 2 to 1.
In my example I had a hallway which connected everything - if you perform a design without one or if you’d like to add it yourself later you need to not drop the hall. Currently you’re putting a kitchen there, which is either very cutting edge, or more likely a result of some difficulty using the tool - sorry bout that.
Spelling matters quite a bit - you don’t have to be accurate but you have to be consistent (true fact: I spent a weekend writing dependancies instead of dependencies and the code ran fine right up until I caught and started to correct the spelling error). In your case, Color isn’t Colour, and Living room isn’t the same as Living room . Be sure to remove all the spaces at the end of your text or use a String.TrimWhiteSpace to do the work for you. This change in your excel data will resolve both the Dictionary.ValueAtKey node as well as the List.IndexOf node which follows.
Be sure to toggle true/false values to get your data output as well.
I’ve managed to make the script work but the errors aren’t fully resolved. I had to delete spaces after some words that I’d put in my excel file. I’ve also deleted all my capitals and removed spaces after “,” in excel. Then I had to delete some empty cells in excel which were recognized by my nodes as “null”. But I seem te have one problem on the end of the script. I’m getting negative numbers in my lists which resolve in “null”, because of this my script won’t run to it’s full capacities.
Do you know what I’m doing wrong?
Thanks in advance!
Double check that you don’t have an extra space at the tail end of every list of spaces (this was the case on at least two of the sheets in the excel file you posted last time). String.Length can confirm in Dynamo. String.TrimWhiteSpace will remove any spaces on the front or back of a string.
Thanks, the script runs perfectly in Dynamo. My new task is to run it in Refinery. If I randomize the solution the outcome is only graphic content of the proximity score. There are some nodes whom aren’t resolved but that’s also the case in the original script, so I think those errors doesn’t affect the outcomes in Refinery.
Any ideas of what is going wrong?
Thanks in advance! BA20004.DYN.GenerateFloorPlanParametersJan_v2.dyn (251.3 KB)
Are your excel files in a location which has any kind of cloud mirroring?
Try remembering the excel data and then unwired the excel input from the remember node and then freeze the file path leading into excel. This will narrow down if it’s an excel issue caused by the file locking you out from concurrent access (usually due to a cloud mirroring tool like onedrive, box, Dropbox, google drive, panzura, some other server hardware/software fixes, etc…)
I’ve been trying to run my script into Refinery. If I randomize my results I become some results. The rooms that are defined in my own script don’t show up in Refinery. I get rooms like “foyer and bathroom 2” but none of my sheets contain a foyer nor a bathroom 2.
Any idea why the Refinery keeps being linked to the original example file and not mine? I open generative design in the dynamo whilst running my own functioning script.
Thanks in advance!