Thanks but I can already iterate through cells and get an Autodesk.Revit.Db.CurtainCell object.
Tried initialising an ICollection anyway and assigned the retrieved cells to that collection, then getting the property. Same exception is thrown:
cells = []
cellsCol = List[CurtainCell](cells)
curtainGrid = wall.CurtainGrid
cellsCol = curtainGrid.GetCurtainCells()
# and then
for cell in cellsCol:
curves = cell.CurveLoops # throws the same error
Can you verify that the walls that you are inputing are curtain walls? Your code works fine for me in Revit 2019.2 / Dynamo 2.0.3.0.
I can generate similar errors when the inputed wall does not have a CurtainGrid. I can generate this exact error when the curtain grid contains grids that have segments removed from them.
I suggest wrapping your code in a try/except:
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
clr.ImportExtensions(Revit.Elements)
doc = DocumentManager.Instance.CurrentDBDocument
wall = UnwrapElement(IN[0])
cells = wall.CurtainGrid.GetCurtainCells()
curveArrays = []
exceptions = []
try:
for cell in cells:
curveArrays.append(cell.CurveLoops)
except Exception, e:
exceptions.append(str(e))
OUT = curveArrays, exceptions
Uh so glad to hear that. Was driving me crazy. I tested a few things and it seems that it throws this error when a segment of a grid line from the curtain wall has been removed.