Combine multiple parameters (strings) with a filter and then copy to circuit(s)


I am attempting to edit the load name of all electrical circuits. Each circuit always equals one device/element. I would like to combine five parameters from each said element and copy to it’s circuit as the load name.

The short story is that I can’t figure out how to filter for empty strings. The first 4 parameters will always have a value but the last parameter may sometimes be empty. All parameters need to be combined and separated by “_” except the last one uses “.”. I am trying to filter so that if the last parameter is empty it uses a different string.join nodes and does not add a “.”. Examples: AAA_AAA_AA_AAAA or AAA_AAA_AA_AAAA.AA.

Besides the filtering aspect I was able to get it working in my testing on single elements. I wanted to figure out the string manipulation before before the next hurdle of performing the list operations to copy this info to all circuits at once.

Using some custom nodes from MEPover (get panels and elements from circuit) and Zebra (get instance or type parameter value by name).

ElecCircuitLoadNamefromDevice.dyn (24.9 KB)

@GPnmulder Could you reupload the image of your graph with previews showing and/or your watch nodes populated (after running the script)? It’ll be easier to tell what is working so far to help identify which area needs to be fixed.

Without seeing your outputs though, for your question I would probably handle testing for blanks with a conditional ternary operator in a code block written like so:

value == ""? value: "." + value;

this essentially translates to “if the value is blank, show the value, if it is not blank, show the value with a period in front of it”

Thanks for the reply. Your solution worked great! The translation of the code block also helps me understand. I’m curious…is this the ‘best’ solution or can it also be achieved with nodes? I don’t have a full grasp of code blocks and design script yet so rely pretty heavily on nodes and custom nodes/packages.

Next I am going to try changing the graph to work on all circuits/elements, not just those manually selected.

I’m stuck. I think my logic and list skills need a lot of work:grinning: Can I request a nudge in the right direction?

I am able to get it to copy the desired parameter values to multiple elements. But I am not able to do so and perform the solution you provided. Am I right in thinking I will need to perform that operation on those items/index separately and then join/re-join the list somehow? That is what I can’t figure out.

ElecCircuitLoadNamefromDeviceMultiple.dyn (20.8 KB)

Finally got back to this challenge after several months. I was able to get it working for my needs. It probably isn’t the cleanest solution. Uploading here in case it helps someone else. I would also be interested in feedback on ways to improve it, particularly on ways to use OOTB nodes as much as possible. Version 1.3.

ElecCircuitLoadNamefromDeviceMultiple.dyn (22.5 KB)

Hi, I was looking at your Dyn but there a several nodes that are not loaded “custom nodes”. Do you recall where these came from? Thanks!

They are all from packages I believe, no custom nodes I had to make.

ElectricalCircuit Get Panels and Elements is from MEPover
Element.GetInstanceOrTypeParameterValueByName is from Zebra
String From List is from archilab

I think that is all of them but let me know if not.

Wow, time flies…I have been very distracted apparently. Thanks for the reply!