I’ve been trying to tackle this challenge for a bit, and I think I’ve accomplished it in the most inelegant way possible. I have an excel file with a list of names (of elements) and a list of values to assign to a parameter. Right now what I’m doing is getting the parameter name and value at index, and then filtering the elements by the name, and assigning the value. However, having to type each index (1 - 113) and have that many nodes is a mess…
Looks so dirty Instead of using to many "“List.GetItemAtIndex” nodes. One of the possible way is to use code block and Rename the watch node as per your requirement.
That would get rid of all of the get item at index nodes for each row in the excel sheet, but it’ll still leave me with 113 of the last set of nodes (the ones that are grouped in the screenshot)
Is there any way to execute this operation en masse, ie - if panel name = line 1, assign value from line 1, elif 2, assign value from 2, and soforth…
I’m sure there’s a way to do it with python, but I was hoping there’d be a built in node.
if x = [name]:
y = [value];
elif x = …
I’m trying to learn it, but still working my way through. Anyway, if there’s a way to do this with built in nodes that’s great! If not, I’ll try to get it to work with my limited coding chops It’s a good exercise, anyway - gotta have problems to solve to learn how to do it! If someone could point me in the right direction - ie, what are the first lines to get the string from the dynamo output to the python script, I would appreciate that as well!
Or if someone could give me some pointers on how to open up the nodes that come built in with Dynamo or with packages, so that I could take a look at the code, that might help too. Is that possible?
I don’t know the complete extent of your problem, but in regards to assigning numbers to panel names you could try out Dictionaries.
SpringNodes has a node for this, where you assign key and value pairs, so if it finds a 1 it will return the assigned panel.
Try it out, it might just be what you need.
For custom packages you can just double click on them and they will open up so you can view their code. Try it on the above Dictionaries node from SpringNodes.
Thanks! I’ll take a look at the custom nodes. Really it shouldn’t be this complicated to assign values to parameters over a large number of objects. What makes it complicated is assigning the correct value to the correct object…
In terms of code, I’m thinking something like this (this is conceptual, I’ll have to work to get it from my thoughts to something the computer can understand):
For [1 . . 113], where #s = rows and values are in columns 1 & 2,
If parameter value = excel value (column 1, row [1 . . 113]
Get element
Set Element.parametervalue = excel value (column 2, row [1 . . 113])
break
Basically I’ve set up dynamo to pull the “Panel Name” value from each electrical element. I’m using the panel name value from excel to filter & select the correct element, then assigning another another value (from excel) to that parameter.
It seems like there’d be an easier way to import values from excel and write those values to the parameters of specific objects, but I can’t seem to figure one out. Maybe something to do with schedules in Revit?
Anyway, if I can find the right snippets of code I’ll (hopefully) be able to put it together.
@William_Speakman I am trying to apply what you and @T_Pover show in your screen shots. Would you share another screen shot of the end result please? it would really help me!
My plan is to create an excel sheet that has all the information for all Panelboards. I have two types of families. One is Equipment Families and that includes all my Panelboards that I will place on the floor plans. Two is Detail Item Families and that will be used for my Single Line Diagram to represent Panelboards in Revit. Both families will get their parameter fields populated based on their Panelboard Names. If I figure out how to link and collect data in a smart way from an Excel sheet to one of these Families I will be able to do it for both.