You have to add a loop over families. Something like that:
families=UnwrapElement[IN0]
z=
for fam in families:
z.append(fam.Family)
and I see that you have sublists… you might have another loop for sublists. If that could be complicated you can flatten the list and do over one loop.
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
# Import ToDSType(bool) extension method
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
# Import DocumentManager and TransactionManager
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
from System.Collections.Generic import *
# Import RevitAPI
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *
doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application
def Action(e):
type = UnwrapElement(e.Family.Name)
name = UnwrapElement(e.Name)
family = UnwrapElement(e).Family
TransactionManager.Instance.ForceCloseTransaction()
famDoc = doc.EditFamily(family)
famCollector = FilteredElementCollector(famDoc)
sketch = famCollector.OfClass(Sketch)
for i in sketch:
cArray = list(i.Profile)
cArray[:] = [[Revit.GeometryConversion.RevitToProtoCurve.ToProtoType(y, True ) for y in x] for x in cArray]
return cArray
OUT = []
for i in IN[0]:
a = []
for k in i:
a.append(Action(k))
OUT.append(a)