Dynamo, Element value assign to circuit value

Hello,
I am trying to fix the code that takes instant parameter from family and set it to circuit parameter.
(Reason: so you name it once in the element instant parameter, then run the code, and the load name becomes the name you named it in instant parameter.)

The code has values to enter. So, if I enter to replace any parameter in element parameters it works. But if I try to replace parameter in circuits, it doesn’t work. Can someone guide me what I am missing.
Thanks!!

I was only able to add one picture per post. So here is another one.

What is your python script returning? What do the warnings say for your SetParameter nodes?

It doesn’t return anything.
If I set to something that is common in circuits and elements like “Comments” parameter.
It returns a value in element but not in circuits.
Error
Warning: Internal error, please report: Dereferencing a non-pointer.

Can you post your python script as preformatted text so others don’t have to type it out?

Yes, sorry about that. here it is:
import clr
clr.AddReference(‘ProtoGeometry’)
from Autodesk.DesignScript.Geometry import *

#The inputs to this node will be stored as a list in the IN variables.
if isinstance(IN[0],list):
toggle = 0
element = UnwrapElement(IN[0])
else:
toggle = 1
element = [UnwrapElement(IN[0])]

def getSystem(elem):
system = elem.MEPModel.ElectricalSystems

if system.Size == 0:
	return None
elif system.Size == 1:	
	for sys in system:
		return sys
else:
	return [x for x in system]

listout = []
for x in element:
try:
system = getSystem(x)
listout.append(system)
except:
listout.append(None)
#Assign your output to the OUT variable.
if toggle:
OUT = system
else:
OUT = listout

Can you try that again? :wink:

import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
#The inputs to this node will be stored as a list in the IN variables.

if isinstance(IN[0],list):
	toggle = 0
	element = UnwrapElement(IN[0])
else:
	toggle = 1
	element = [UnwrapElement(IN[0])]
def getSystem(elem):
	system = elem.MEPModel.ElectricalSystems

if system.Size == 0:
	return None
elif system.Size == 1:	
	for sys in system:
		return sys
else:
	return [x for x in system]

listout = []	
for x in element:
	try:
		system = getSystem(x)
		listout.append(system)
	except:
		listout.append(None)
#Assign your output to the OUT variable.
if toggle:
	OUT = system
else:
	OUT = listout