I’m using Dynamo for my first time, and i’m trying to recreate a crane script from and autodesk university lecture, to use for my own models, but when i do this i run in to problems. I have firstly tried to understand how it works with the case model, that came with the lecture, but when i do the same for my own models an error comes up.
It’s an error with a codeblock programmed after the lecture, which says “List indecis must be numeric”
The “if” statement before, does not contain any nulls, only the name “structural columns”, i do not understant why the “Element.GetParameterValueByName” is empty, and dont know if the problem occurs here.
Can you post the DYN and a sample RVT here or to another web source (google drive, dropbox, onedrive, etc)?
Hi @Pedersen,
Please look at this node:

I think there is no need for a dictionary here, also the list
variable is not defined anywhere in your graph.
-biboy
I have linked the Dyn and the sample revit file to this WeTransfer link.
@blsalvio
The codeblock i made from the Autodesk University lecture, but i understand it as a way to make one list of the different element categories i choose to calculate. If i were to add another categori it would have the varible “string_enum[“Another Category”] = b;”
These categories need to be in a joint list to calculate the volume for each element.
Or am i on a completely wrong path here?
Hi @Pedersen;
You are declaring a dictionary variable, you cannot initialize a dictionary that way without declaring it to be a dictionary. I think DesignScript (programming language of code blocks) will treat it as a list because you did not initialize it as a dictionary that is why you are getting an error. Dictionary requires string while lists requires integer inside the open-and-close brackets. Also, the second line string_enum[list]
, the list
variable is not defined.
1 Like
Thanks for your help @blsalvio
I think i understand what you are saying, but i dont know how to solve my problem.
Im gonna rethink the strcuture, because there could be another way to calculate the volume for the chosen element.
1 Like