Need help transferring data from Mechanical to Electrical model using Dynamo

I’m looking for some massive help improving a Dynamo script that I’m hoping will save me hours and hours of time if I can get it working. I have created an Electrical Fixture power tap family which acts as a power tap. I place one of these at each piece of mechanical equipment, fill out the electrical parameters based on information provided to me by our mechanical team, and then connect it to my electrical panels. The power tap family is inspired by abulla’s solution here:
https://forums.autodesk.com/t5/revit-mep-forum/circuiting-mechanical-equipment/m-p/5295593/highlight/true#M24682

Right now, the script can automatically create the power taps and place them at each mechanical equipment, and transfer the Mark parameter as well. But if our mechanical department adds six new exhaust fans, re-running this script would create duplicate power taps at any existing equipment. Here’s sort of a high level idea of what I’d like the Dynamo routine to do:

  1. Store non-changing ID (can we access GUIDs?) of mechanical equipment as a parameter in the electrical fixture power tap
  2. If there’s already an electrical fixture with that ID, don’t create a new one.
  3. If there’s not an electrical fixture, with that ID, create a new one.
  4. In either case, update the parameters from the electrical fixture with matching parameters from the mechanical equipment. Including: “Requires Power”, “Electrical Load”, “Electrical Voltage”, “Electrical Poles”, “Motor HP”, “Mark”.
  5. Use the “Requires Power” boolean to determine the visibility of the electrical fixture icon (through the visibility settings of the electrical fixture family, sort of out of this scope) as well as the visibility in an electrical equipment fixture schedule.
  6. Ideally, there would also be some boolean toggles to control which information gets transferred. Two ideas come to mind here. One, a bool to determine if running the script will update the positions of any existing power taps. Two, an instance parameter bool called “Override Mechanical” which would prevent the routine from updating the load/poles/voltage parameters for that power tap.
  7. As if all of this isn’t difficult enough, it’s fairly likely that the mechanical department will load in a mechanical equipment family that is missing the required parameters, so the routine needs to somehow error trap these cases…

Place Electrical Fixtures at Linked Mechanical Equipment.dyn (80.1 KB)

Edit: Here’s a copy of the power tap family as well:
EF Mechanical Equipment Power Tap.rfa (368 KB)

Take a look at the discussion below. It’s a similar problem dealing with updating elements that may or may not already exist. This is a common issue with different types of graphs that rely on updating element specific information, however the solutions tend to follow similar approaches.

1 Like