had this all working fine in Iron Python, but trying to get everything moved up to Cpython3.
I’m just getting the loops from a filled region and using the outer loop to get the gross arae.
#! python3
import clr
import sys
import System
from System.Collections.Generic import *
clr.AddReference("RevitNodes")
import Revit
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
clr.AddReference("RevitAPI")
clr.AddReference("RevitAPIUI")
clr.AddReference("RevitAPIIFC")
import Autodesk
from Autodesk.Revit.DB import *
from Autodesk.Revit.UI import *
ifc = Autodesk.Revit.DB.IFC
doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application
uidoc = uiapp.ActiveUIDocument
#######OK NOW YOU CAN CODE########
e = UnwrapElement(IN[0])
i = IN[0]
myRegions = FilteredElementCollector(doc).OfClass(FilledRegion).WhereElementIsNotElementType()
a = []
for f in myRegions:
a.append(f)
e = a[0]
myAreaValue = e.get_Parameter(BuiltInParameter.HOST_AREA_COMPUTED).AsDouble()
myCurveLoops = e.GetBoundaries()
x = myCurveLoops[:1]
myOuterCurveLoop = List[CurveLoop](x)
myGrossAreaValue = ifc.ExporterIFCUtils.ComputeAreaOfCurveLoops(myOuterCurveLoops)
OUT = myGrossAreaValue
So I haven’t been able to cast list back to an IList of CurveLoops - which is where the problem lies.
As noted. works fine in Iron Python. Just missing something on casting the list back properly. (Unless I really have to pull it all apart and rebuild a CurveLoop from the curves. That would be a real pain.)