Dynamo Node Python error TypeError: iteration over non-sequence of type FamilyInstance

Hi I’m trying to use a node from a package called RIE nodes and one specific node within this package is failing RIE.PowerElements, the node doesn’t output anything or show an error, but when I open the node and copy the python code into a python node and run it, it shows this error
Warning: IronPythonEvaluator.EvaluateIronPythonScript operation failed.
Traceback (most recent call last):
File “”, line 39, in
TypeError: iteration over non-sequence of type FamilyInstance

which I suppose is the source of my problem shown below. the code in this node was discussed in a previous post at the following link below and it seems to be working for the people using it there I compared it and the code appears identical I’m running revit 2018.2 and using dynamo 1.3.2.2480 can someone please point out whats wrong I think the problem may be in the For Loop?

import clr
clr.AddReference(‘ProtoGeometry’)
from Autodesk.DesignScript.Geometry import *

clr.AddReference(‘RevitServices’)
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
from System.Collections.Generic import *

clr.AddReference(‘RevitNodes’)
import Revit
clr.ImportExtensions(Revit.Elements)

clr.AddReference(‘RevitAPI’)
import Autodesk
from Autodesk.Revit.DB import *
from Autodesk.Revit.DB.Electrical import *
from Autodesk.Revit.DB import MEPSystem

clr.AddReference(‘DSCoreNodes’)
import DSCore
from DSCore.List import *

import sys
pyt_path = r’C:\Program Files (x86)\IronPython 2.7\Lib’
sys.path.append(pyt_path)

#/ Import List ( ICollection(ElementId) = ListElementId )
clr.AddReference(“System”)
from System.Collections.Generic import List

#The inputs to this node will be stored as a list in the IN variables.
input = UnwrapElement(IN[0])

electComponents = ListElementId

for i in input:
electComponents.Add(i.Id)

doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application
uidoc = DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument

TransactionManager.Instance.EnsureInTransaction(doc)

newcircuit = ElectricalSystem.Create(doc, electComponents, ElectricalSystemType.PowerCircuit)

OUT =
OUT.append(newcircuit)

TransactionManager.Instance.TransactionTaskDone()

1 Like

@raymond.humes do you have an item only in your input? If so you need to create a list.

image

image

2 Likes

That solved the problem thank you I didn’t realize it required that kind of input.

1 Like

@raymond.humes Please mark as solved.

if you want your graph to work all the times, add the code below. it’ll be sure you always have a list with the correct structure.

Hello. Nice to see that the issue has been resolved. I will update the RIE package to not require a list input for this particular node in the future.

1 Like

The RIE package has now been updated to version 0.4.6.

2 Likes

Hi Andre thanks I tried it, its working I came up with an improvement you may want to include as part of an updated version of the node this gets rid of the problem of getting that error where you try circuiting elements that are already powered using the node Element.ElectricalCircuit from MEPover so it’ll skip over the elements that are already powered I also included a snippet of code you may want to publish as a separate node so the selected elements are each circuited individually to there own electrical system. By the way for your node if its used to power a element where the voltage is an instance parameter the field gets grayed out and set to zero and can’t be changed it only works right and doesn’t get grayed out if the voltage is a type parameter do you have any idea how to fix that?

1 Like