How do I get the Name of a filled region?

Hello, I want to get the name and then rename a filled region, however I am a bit stuck.

First I use a filtered element collector to get all OfClass FilledRegion Type

Filled_Regions_elements = DB.FilteredElementCollector(doc).OfClass(DB.FilledRegionType)

Then I am trying to loop over this list and then get the .Name of all of these, however, I think that perhaps I am getting the type as opposed to the Element? any help to get me on the right track much appreciated!

Can you paste a screen shot of your graph?

@ssw9UZNL use this collector (category instead of class):
FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_DetailComponents).WhereElementIsNotElementType().ToElements()

Thanks tradelie, once I have isolated down all the filled regions, how do I get the actual type name of the object?

you can filter by name if you want using an If statement with python, or a simple Filter.ByBoolMask in Dynamo.

But it doesnt give me the actual name of the type, I want to return the name of the type itself and then possibly change that name?

check out this:

A simplified code to your request:

import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *

clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)

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

doc = DocumentManager.Instance.CurrentDBDocument
 

fRegions = FilteredElementCollector(doc).OfClass(FilledRegionType).ToElements()
TransactionManager.Instance.EnsureInTransaction(doc)
for f in fRegions:
	if Element.Name.__get__(f) == "Vertical":
		f.Name = "Horizontal"
TransactionManager.Instance.TransactionTaskDone()
OUT = fRegions
1 Like

Thankyou, what I dont understand is what is the ‘Element’ part of the script, why cant I just write

f. Name to retrieve the name)?

Sam

It’s currently an inheritance bug (getter) in IronPython (same in Python.Net), there are several workarounds

3 Likes


@ssw9UZNL . Use Element.Parameters Node.
you will get the filled region name :slightly_smiling_face: