# Dynamo, Element value assign to circuit value

**URL:** <https://forum.dynamobim.com/t/dynamo-element-value-assign-to-circuit-value/25678>\
**Category:** Revit\
**Tags:** dynamo\
**Created:** [September 7, 2018, 4:31pm UTC](https://forum.dynamobim.com/t/dynamo-element-value-assign-to-circuit-value/25678 "2018-09-07T16:31:38Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![ekaterina.belyaeva](https://avatars.discourse-cdn.com/v4/letter/e/9de0a6/32.png) [@ekaterina.belyaeva](https://forum.dynamobim.com/u/ekaterina.belyaeva)\
**Post date:** [September 7, 2018, 4:31pm UTC](https://forum.dynamobim.com/t/dynamo-element-value-assign-to-circuit-value/25678/1 "2018-09-07T16:31:39Z")

</div>

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!!

 ![2](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/a/6/a6f9ad767f9dad1c4394425b4408e109c36cf1b3.png)

---

<div class="post-metadata">

**Author:** ![ekaterina.belyaeva](https://avatars.discourse-cdn.com/v4/letter/e/9de0a6/32.png) [@ekaterina.belyaeva](https://forum.dynamobim.com/u/ekaterina.belyaeva)\
**Post date:** [September 7, 2018, 4:32pm UTC](https://forum.dynamobim.com/t/dynamo-element-value-assign-to-circuit-value/25678/2 "2018-09-07T16:32:19Z")

</div>

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

 ![1](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/d/4/d42359b736ac17cf2c236ee1b7eae84132380d2d.png)

---

<div class="post-metadata">

**Author:** ![Nick\_Boyts](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/nick_boyts/32/76313_2.png) [@Nick\_Boyts](https://forum.dynamobim.com/u/Nick_Boyts)\
**Post date:** [September 7, 2018, 4:57pm UTC](https://forum.dynamobim.com/t/dynamo-element-value-assign-to-circuit-value/25678/3 "2018-09-07T16:57:54Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ekaterina.belyaeva](https://avatars.discourse-cdn.com/v4/letter/e/9de0a6/32.png) [@ekaterina.belyaeva](https://forum.dynamobim.com/u/ekaterina.belyaeva)\
**Post date:** [September 7, 2018, 5:27pm UTC](https://forum.dynamobim.com/t/dynamo-element-value-assign-to-circuit-value/25678/4 "2018-09-07T17:27:15Z")

</div>

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.

 ![3](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/8/0/80070f003bb33b9faabd6f4d53153d1c65b7ccb3.png)

---

<div class="post-metadata">

**Author:** ![Nick\_Boyts](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/nick_boyts/32/76313_2.png) [@Nick\_Boyts](https://forum.dynamobim.com/u/Nick_Boyts)\
**Post date:** [September 7, 2018, 7:19pm UTC](https://forum.dynamobim.com/t/dynamo-element-value-assign-to-circuit-value/25678/5 "2018-09-07T19:19:22Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ekaterina.belyaeva](https://avatars.discourse-cdn.com/v4/letter/e/9de0a6/32.png) [@ekaterina.belyaeva](https://forum.dynamobim.com/u/ekaterina.belyaeva)\
**Post date:** [September 7, 2018, 7:55pm UTC](https://forum.dynamobim.com/t/dynamo-element-value-assign-to-circuit-value/25678/6 "2018-09-07T19:55:47Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Nick\_Boyts](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/nick_boyts/32/76313_2.png) [@Nick\_Boyts](https://forum.dynamobim.com/u/Nick_Boyts)\
**Post date:** [September 7, 2018, 8:43pm UTC](https://forum.dynamobim.com/t/dynamo-element-value-assign-to-circuit-value/25678/7 "2018-09-07T20:43:23Z")

</div>

Can you try that again? 😉

---

<div class="post-metadata">

**Author:** ![ekaterina.belyaeva](https://avatars.discourse-cdn.com/v4/letter/e/9de0a6/32.png) [@ekaterina.belyaeva](https://forum.dynamobim.com/u/ekaterina.belyaeva)\
**Post date:** [September 7, 2018, 8:58pm UTC](https://forum.dynamobim.com/t/dynamo-element-value-assign-to-circuit-value/25678/8 "2018-09-07T20:58:08Z")

</div>

```
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
```
