Hi - I have seen lots of posts on this topic but am having no luck finding a solution to this question.
I am trying to rename system family and types in a project. I start with ‘Element Types’ to select all the system family content I will be working with, pull this into a list, collect element types, and then try to get the Family and Type name for the elements.
No ‘Element.GetParameterValueByName’ or version of return the Family or Type parameters as text? and even if I go through and filter family and type (preference to have these separate though) from a list of all parameters I can search the bool result?
Hi @MJB-online - thanks!!
That helps work out the type rename if I use Element.SetName!
Is there an equivalent node that might work for the family rename for system families?
I was trying Element.SetParameterByName by this returns only nulls.
if you are comfortable with python you can use the ‘filtered element collector’ to get the element ids for system family types, then pass that to clockwork’s Element.SetName
formatting is slightly different when using python from string
"
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import \\
Element, FilteredElementCollector, BuiltInCategory,\\
CeilingType, FillPatternElement, FilledRegionType, FloorType,\\
GraphicsStyleType, RoofType, WallType
from Autodesk.Revit.DB.Architecture import \\
HandRailType, RailingType, StairsType, TopRailType
clr.AddReference('RevitServices')
from RevitServices.Persistence import DocumentManager
doc = DocumentManager.Instance.CurrentDBDocument
fec = FilteredElementCollector
ceilings = fec(doc).OfClass(CeilingType).ToElements()
fillpatterns = fec(doc).OfClass(FillPatternElement).ToElements()
filledregions = fec(doc).OfClass(FilledRegionType).ToElements()
floors = fec(doc).OfClass(FloorType).ToElements()
handrails = fec(doc).OfClass(HandRailType).ToElements()
railings = fec(doc).OfClass(RailingType).ToElements()
roofs = fec(doc).OfClass(RoofType).ToElements()
stairs = fec(doc).OfClass(StairsType).ToElements()
toprails = fec(doc).OfClass(TopRailType).ToElements()
walls = fec(doc).OfClass(WallType).ToElements()
elem_types = ceilings, fillpatterns, filledregions, floors, handrails, railings, roofs, stairs, toprails, walls
ceiling_names = [Element.Name.__get__(i) for i in ceilings]
fillpattern_names = [Element.Name.__get__(i) for i in fillpatterns]
filledregion_names = [Element.Name.__get__(i) for i in filledregions]
floor_names = [Element.Name.__get__(i) for i in floors]
handrail_names = [Element.Name.__get__(i) for i in handrails]
railing_names = [Element.Name.__get__(i) for i in railings]
roof_names = [Element.Name.__get__(i) for i in roofs]
stair_names = [Element.Name.__get__(i) for i in stairs]
toprail_names = [Element.Name.__get__(i) for i in toprails]
wall_names = [Element.Name.__get__(i) for i in walls]
elem_names = ceiling_names, fillpattern_names, filledregion_names, floor_names, handrail_names, railing_names, roof_names, stair_names, toprail_names, wall_names
OUT = elem_types, elem_names
";
shorter version, not sure if this should be under share, but thought I’d put it here for now, might be useful to refer to if anyone wanted to make the class an input to the script…
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
from Autodesk.Revit.DB.Architecture import *
clr.AddReference('RevitServices')
from RevitServices.Persistence import DocumentManager
doc = DocumentManager.Instance.CurrentDBDocument
fec = FilteredElementCollector
elem_types = []
elem_names = []
clazz = ('CeilingType' , 'FillPatternElement' , 'FilledRegionType',
'FloorType', 'HandRailType' , 'RailingType' , 'RoofType' , 'StairsType',
'TopRailType' , 'WallType')
for claz in clazz :
elem_type = fec(doc).OfClass(eval(claz)).ToElements()
elem_types.append(elem_type)
for elems in elem_type :
elem_name = Element.Name.__get__(elems)
elem_names.append(elem_name)
OUT = elem_types, elem_names
maybe someone can correct me, I couldn’t find a class for structural foundations, so I used the built in category instead…
hope that helps, stay safe ! #covid
a.
import clr
clr.AddReference('RevitAPI')
# if you want to load everything
#from Autodesk.Revit.DB import *
# if you would rather just load what you need
from Autodesk.Revit.DB import Element, FilteredElementCollector, BuiltInCategory
clr.AddReference('RevitServices')
from RevitServices.Persistence import DocumentManager
doc = DocumentManager.Instance.CurrentDBDocument
fec = FilteredElementCollector
# we need to use clockworks chop function to return multiple lists
# of multiple categories of the same length for easy comaprison
# between category types and category names
def clock_chop_10 (chop_list, chop_lengths):
# ' clockwork https://github.com/andydandy74/ClockworkForDynamo/blob/master/nodes/1.x/List.Chop%2B.dyf
chopped = []
count = 0
max = len(chop_list)
for num in chop_lengths :
if count + num > max : end = max;
else : end = count + num
chopped.append(chop_list[count:end])
count = end
return chopped
cat_types = []
cat_names = []
type_elems = []
numtypes = []
# if you want to use fec to collect multiple built in catgories add them to this list
# it needs to be wrapped in a list otherwise we couldn't iterate of a single string
cats = ['OST_StructuralFoundation']
# in this example with only a single item in list we could simplify code to not iterate
# leaving like this allows others to more easily adapt to find multiple categoires
# to find other built in categories go to revitapidocs.com and search for BuiltInCategory Enumeration
# https://www.revitapidocs.com/2015/ba1c5b30-242f-5fdc-8ea9-ec3b61e6e722.htm
# element types are filtered out so that we only find the modelled instances not all category types
for cat in cats :
cat_type = fec(doc).OfCategory(eval('BuiltInCategory.' + cat)).WhereElementIsNotElementType()
cat_types.append(cat_type)
# find the length of the list that we can use to chop lists
num_types = 0
for i in cat_type :
name = Element.Name.__get__(i)
cat_names.append(name)
num_types += 1
numtypes.append(num_types)
# chop the list of category names using the length
chopped_names = clock_chop_10(cat_names,numtypes)
# here we find the elements of the individual instances of the category types
# we filter out the elements that are the category types not the modelled instances
for cat_type in cat_types :
type_elem = cat_type.WhereElementIsNotElementType().ToElements()
type_elems.append(type_elem)
OUT = chopped_names, type_elems
the above works for families, not system families, but unless you can tell me what type of system family you are modelling structural foundations from (wall? / floor?) I cant help sorry