forms.SelectFromList.show familytype name

Hello all,

I am trying to diplay with forms.SelectFromList.show the list of FamilyType Name. (in this instance the doortags) like the following:

listOfTag = DB.FilteredElementCollector(revit.doc)\
            .OfCategory(DB.BuiltInCategory.OST_DoorTags)\
            .WhereElementIsElementType()\
            .ToElements()
             




selTag = forms.SelectFromList.show(
            listOfTag,
            multiselect=True,
            name_attr = 'ToString',
            group_selector_title='Sheet Sets',
            button_name='Select Sheets'
            )

what I am getting is the object itself. like following :melting_face:

how can I get the that family type name amI Doing something wrong with the FilteredElementCollector?
Has anyone faced something like this?

thank you,
Gian Claudio S. :slight_smile:

ToString is a function/method. Not a property.
The syntax would be ToString().

I think you could also use Name

1 Like

@aaronrumple

thank you for your reply… :slight_smile:

if I am going to replace it with “Name” I have the following issue

if I am going to the Revit API I can see the following attribute

and I think the name in this case is just a set parameter

I think I have found a solution in this forum:

@AlexanderVDB in this post was parsing the rooms category.

I will post as soon as possible the solution :slight_smile:

thank you @aaronrumple @AlexanderVDB :slight_smile:

This is the solution:

first, we need to create a class that looks like that:
here an excellent explanation

pyrevit.forms — pyRevit 4.8.12.22247+0031 documentation

class elementListItem(forms.TemplateListItem):
    @property
    def name(self):
        return Element.Name.GetValue(self.item)

thank you can remove it the name_att

and replace the context attribute with that:

listOfTagSelectFromList = [Element.Name.GetValue(tag) for tag in listOfTag ]


selTag = forms.SelectFromList.show(
            listOfTagSelectFromList,
            multiselect=True,
            group_selector_title='Sheet Sets',
            button_name='Select Sheets'
            )
2 Likes

correct indeed ;).
pyrevit.forms i an easy, quick and good input way for these kind of selections.

@Gian_Claudio
Altho i also want too remark that i myself try to avoid selection al together by standardising naming or classification.
That way you can filter out elements from the wmodel without any input