Filling Region between two circles

Hi to everybody,

I am trying to fill a region between two circles with a Dynamo Script and I am not getting good results because I have the next issue.

This curve will make the loop not contiguous.
Parameter name: pCurve

Someone knows how can I get solved the next issue?


You have to create the hatch as a separate items and then edit the sketch accordingly. Good illustration of the process here: I want to edit the sketch of an existing floor or slab

Hi @JacobSmall, thanks for the response.

I am getting Empty.Lists from this node.

Because you aren’t sending a sketch based element just yet - you need to create a sketch based element (ie: a hatch) first, then set the location of the curves to the new location.

There’s two issues that you’re facing.

The first one is that Revit can’t create sketches with a single closed curve and therefore you have to always split the curve into at least two segments. The second one is that the OOTB FiledRegion.ByCurves is exposed in a less than ideal way, compared to what is provided by the API and you’ll need to use a script instead:

import clr

clr.AddReference('RevitAPI')
import Autodesk.Revit.DB as DB

clr.AddReference('RevitServices')
from RevitServices.Persistence import DocumentManager
doc = DocumentManager.Instance.CurrentDBDocument
from RevitServices.Transactions import TransactionManager

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

clr.AddReference('System')
from System.Collections.Generic import List

view, dynLoops, type = UnwrapElement(IN)
OUT = []
rvtLoops = List[DB.CurveLoop]()
for crvs in dynLoops:
	loop = DB.CurveLoop.Create([c.ToRevitType() for c in crvs])
	rvtLoops.Add(loop)

TransactionManager.Instance.EnsureInTransaction(doc)
fr = DB.FilledRegion.Create(doc, type.Id, view.Id, rvtLoops)
OUT.append(fr.ToDSType(False) )
TransactionManager.Instance.TransactionTaskDone()
8 Likes

Ok…
Amazing one more time. Thanks to all of you for the solutions @Dimitar_Venkov @JacobSmall

Hi @Dimitar_Venkov and @JacobSmall

Do you know why can I not give the filled Region Type from a List and only works with the node “Select Filled Region Type”?

The python node has the next issue in the line 27:

Warnung:IronPythonEvaluator.EvaluateIronPythonScript fehlgeschlagen.
Traceback (most recent call last):
File “”, line 27, in
AttributeError: ‘List[object]’ object has no attribute ‘Id’

Is it possible to solved in this code?

the code above expects a single value. Try using List.FirstItem or a codeblock with mylist[0]

1 Like

Works perfect with List.FirstItem.

Thanks a lot

What is this madness? :smiley:

***Squirrels this nugget away for future reference

Cheers,

Mark