Phyton not working with List

#1

Hi All, below is a simple python that works with single element,question is would it be possible to work also with a list of elements(floors)?

Thank you.

import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *

clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.GeometryConversion)

clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument

slabshape = UnwrapElement(IN[0])

TransactionManager.Instance.EnsureInTransaction(doc)
slabshape.SlabShapeEditor.ResetSlabShape()

TransactionManager.Instance.TransactionTaskDone()

OUT = slabshape

Ps: It’s working if i make it custom node and set lacing to longest, as part of learning just wanna know how it works with python itself

#2
#3

Not really sure how but for now I’ll use it as custom node. Thank you :slight_smile:

#4

You can do this with a for loop. You should check any basic python tutorial on how to do it:

slabshapes = UnwrapElement(IN[0])

TransactionManager.Instance.EnsureInTransaction(doc)
for slabshape in slabshapes:
	slabshape.SlabShapeEditor.ResetSlabShape()

TransactionManager.Instance.TransactionTaskDone()

OUT = slabshapes