Mapping parameter from one family to another


I am new to Dynamo and desperately need some help. I am trying to make a script to take the room location from an Electrical Equipment family and map it to the text parameter “room name” in a detail component family of the same name. We use the type name to distinguish between individual electrical equipment components (not an instance parameter). Ex. Panel A, Panel B, and Panel C will all be different family types labeled “Panel A”, “Panel B”, and “Panel C”. The detail component family has an instance parameter “Panel Name”. I would like to copy over the room name automatically associated with the electrical equipment family to it’s corresponding detail component family. 3D Panel A location to 2D Panel A detail component parameter “room name”. I hope I have explained that in a way that someone can understand.

I have a script started that collects both revit families within the project, and refines the final list so that only 3d components with corresponding 2d components are in the list. It also extracts the correct information and parameters from each family. My problem now is how do I make sure that when I set the parameter value for “room name” on the detail component, that it is from the correct corresponding 3d electrical equipment component? They both have the same name so I wouldn’t think it would be too difficult to do, but I cannot figure it out.

Also I could be going about this the wrong way so I’m open to any suggestions!

Option 1: Create a dictionary. The dictionary would use the “Panel #” as the key, and the values stored out be the room data. Since they are apparently completely uniquely ID’d, you can use a flattened EE component list to build the dictionary. Once the dictionary is built, you can use the keys to SetParameterByName on the Detail Component side of the graph.

Option 2: Use a combination of IndexOf and GetItemByIndex, using the list of Panel Names to generate the correct indices. You’ll notice that this is basically the same concept as the Dictionary option.