RIE.PowerElements

Hi,

I’ve been using the RIE package and so far has worked amazing on Revit 2018, however I believe the API for 2017 is maybe a little different. Is anyone able to help me change it to suit or can advise an alternative?

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

def tolist(obj):
if isinstance(obj, list):
return UnwrapElement(obj)
else:
return [UnwrapElement(obj)]

#The inputs to this node will be stored as a list in the IN variables.
input = tolist(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()

@Vykr What node is that? what error you get?