Hi Guys,
I’m new here and i have a question about python in Revit. I’m trying to make a Wall by profile using Python. This is the code i’m using:
import clr
clr.AddReference(“RevitNodes”)
import Revit
clr.ImportExtensions(Revit.Elements)
clr.ImportExtensions(Revit.GeometryConversion)
clr.AddReference(“RevitServices”)
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
from System.Collections.Generic import List as Lst
clr.AddReference(‘RevitApi’)
from Autodesk.Revit.DB import Wall, Curve
doc = DocumentManager.Instance.CurrentDBDocument
curves = IN[0]
levels = IN[1]
types = IN[2]
walls = []
index = 0
TransactionManager.Instance.EnsureInTransaction(doc)
# Validatie
# if (validatie not ok)
# show error
# else
for curve in curves:
** for loop in curve:**
** profile = LstCurve**
** for i in loop:**
** profile.Add(i.ToRevitType())**
** wall = Wall.Create(doc, profile, UnwrapElement(types[index]).Id, UnwrapElement(levels[index]).Id, False)**
** walls.append(wall)**
** index = index + 1**
TransactionManager.Instance.TransactionTaskDone()
OUT = walls
I didn’t write it myself: a collegue found it somewere online. In Revit 2018/Dynamo 1.3.3 the code worked fine, but using Revit 2019/Dynamo 2.0.3 i can’t get it to work.
Ik keep getting this error:
Warning: IronPythonEvaluator.EvaluateIronPythonScript operation failed. **
Traceback (most recent call last):
** File “”, line 38, in
TypeError: iteration over non-sequence of type Curve
Can someone please help me? I’m a little bit lost here!
I apologize for my Eglish, it’s not my native language… sorry!
Thank you in advance!