Filled Region With Hole in the Middle - like a donut

Hello,
I have been using Dynamo to create a filled Region with an empty space in the middle. I can create the filled Region just fine but when I add the extra linework to add the empty space in the middle, it gives an error. I been using FilledRegion.ByCurves node. Is there a way to create a filled Region with a hole in the middle, using Dynamo?
See image below for filled Region. Thank you,

image

I don’t think it’s possible…

a similar post for floors:

import clr

clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
import System.Collections.Generic
from System.Collections.Generic import List

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

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

doc = DocumentManager.Instance.CurrentDBDocument

filledType = ElementId(IN[0])
viewId = ElementId(IN[1])
boundaries = IN[2]
boundariesLoop = List[CurveLoop]()

for i in boundaries:
	curves = List[Curve]()
	for x in i:
		curves.Add(x.ToRevitType())
		
	boundariesLoop.Add(CurveLoop.Create(curves))

TransactionManager.Instance.EnsureInTransaction(doc)
filled = FilledRegion.Create(doc, filledType, viewId, boundariesLoop)
TransactionManager.Instance.TransactionTaskDone()

OUT = filled

FilledRegion.dyn (83.2 KB)

7 Likes

Julian,
Thank you for the script, it works very well. I can create any Filled Region in any view.
I was woundering if I can do the same but with multiple Filled Regions in different views? I get an error when I tried to.

Thank you,

@jbo Nice! Thanks for sharing!

I think with a custom node it should work. At the moment the script is just designed for one view. I can’t try it out at the moment. But I think you get the idea.

1 Like

Has anyone managed to get this python node to work for multiple filled regions in different views? I’ve been trying to work it out, but I don’t fully understand what’s happening in the for loop that groups the curves, or how to lace the filled region creation when there are multiple input lists.
Thanks

@bscott

I did not modify the script. I created a custom node as Julian mention it. Once you create a custom node you can lace it (see images below).

3 Likes

Hi there, could you please share the script?
I’m trying to create the custom node as you shown but it doesn’t work.
Also in the custom node element id’s are set to accept string as input, but from the node in the full script element.id node return int

Many thanks

Damiano,
yeah, ignore the string input. It does require int.
The script is below and in the link are the dyn file and the custom nodes I made.
Hope this helps.

https://dreyfussblackford-my.sharepoint.com/:f:/g/personal/gbardales_db-arch_com/Ei8RUIUJDShGszpUFap7ZFcBp_pTrw4uvCPf4IIjSsbIaQ?e=dojMWr

import clr

clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
import System.Collections.Generic
from System.Collections.Generic import List

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

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

doc = DocumentManager.Instance.CurrentDBDocument

filledType = ElementId(IN[0])
viewId = ElementId(IN[1])
boundaries = IN[2]
boundariesLoop = List[CurveLoop]()

for i in boundaries:
	curves = List[Curve]()
	for x in i:
		curves.Add(x.ToRevitType())
		
	boundariesLoop.Add(CurveLoop.Create(curves))

TransactionManager.Instance.EnsureInTransaction(doc)
filled = FilledRegion.Create(doc, filledType, viewId, boundariesLoop)
TransactionManager.Instance.TransactionTaskDone()

OUT = filled
1 Like

Many thanks for this, the script works nicely. Unfortunately it doesn’t process elements with sharing edges though, basically each slab/curve must be apart. Do you know if there’s a way around this?
Otherwise we just going to use it for single slabs or multiple if they don’t share edges.
Thank you