Could I get some help? I’m using this code by now:
# The inputs to this node will be stored as a list in the IN variables.
ArrayCurves = IN[0]
floorType = UnwrapElement(IN[1])
level = UnwrapElement(IN[2])
structural = IN[3]
curveList = []
out = []
for curve in ArrayCurves:
curveArray = CurveArray()
for c in curve:
curveArray.Append(c.ToRevitType())
curveList.Add(curveArray)
# Place your code below this line
for c in curveList:
TransactionManager.Instance.EnsureInTransaction(doc)
floor = Floor.Create(doc, c, floorType.Id, level.Id)
TransactionManager.Instance.TransactionTaskDone()
# Assign your output to the OUT variable.
OUT = floor
import sys
import clr
import System
from System.Collections.Generic import List
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import Curve,CurveLoop,Floor,Transaction,Level,Line,XYZ
doc = DocumentManager.Instance.CurrentDBDocument
ArrayCurves=IN[0]
floortype=UnwrapElement(IN[1])
level=UnwrapElement(IN[2])
structural=IN[3]
revc=Autodesk.Revit.DB.Curve
outerCurv=List[revc]([c.ToRevitType() for c in ArrayCurves[1]])
innerCurv=List[revc]([c.ToRevitType() for c in ArrayCurves[0]])
outL=CurveLoop.Create(outerCurv)
innL=CurveLoop.Create(innerCurv)
listCL=List[CurveLoop]([outL,innL])
lslope=Line.CreateBound(XYZ(0,0,0),XYZ(1,0,0))
t=Transaction(doc,"Create a Floor")
t.Start()
floor=Floor.Create(doc,listCL,floortype.Id,level.Id,structural,lslope,0)
t.Commit()
OUT = type(outerCurv),type(outL),type(listCL),floor
Thank you for your quick answer!
Unless I’m wrong, doing those changes I get only 1 floor as a result. Unfortunately I need to proccess the list from python to create as many floors as polygons are in input[0]
I thought you were trying to create the ground between these 2 curveloops as there is common matter between the 2 grounds it will generate warnings
what you are trying to do is achievable with the ootb node
if you make a for on the list this should create 2 floors
I’m writing this from phone so be careful t.Start() floors=[] for c in listCL: f=Floor.Create(doc,c,floortype.Id,level.Id,structural,lslope,0) floors.append(f) t.Commit() OUT = floors
edit:
t.Start()
floors=[]
for c in listCL:
f=Floor.Create(doc,List[CurveLoop]([c]),floortype.Id,level.Id,structural,lslope,0)
floors.append(f)
t.Commit()
OUT = floors