Here’s what I use for drawing fill regions (originally designed for converting space boundaries):
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
clr.AddReference('RevitServices')
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
#The inputs to this node will be stored as a list in the IN variables.
dataEnteringNode = IN
spaceBoundaries = IN[0]
filledRegionName = IN[1]
for fr in FilteredElementCollector(doc).OfClass(FilledRegionType):
if Element.Name.GetValue(fr) == filledRegionName:
filledRegion = fr
break
viewId = doc.ActiveView.Id
TransactionManager.Instance.EnsureInTransaction(doc)
regions = []
spaceBoundaries
curveLoopList = []
spaceCurves = CurveLoop()
for boundarySegment in spaceBoundaries:
spaceCurves.Append(boundarySegment)
curveLoopList.Add(spaceCurves)
region = FilledRegion.Create(doc,filledRegion.Id,viewId,curveLoopList)
regions.append(region)
TransactionManager.Instance.TransactionTaskDone()
#Assign your output to the OUT variable.
OUT = regions
Creating a new fill region type works just like duplicating any other element type. The only new thing I ran into was the input value for Color. Revit was taking an integer based on RGB values. You just need a little formula for converting Dynamo colors to the correct integers:
Hope that gets you started!