Custom function is calling specified family type

I have a lot of families in a template, but just of them are using often. I would like to make a function which is calling defined family. Once user clicks at button, drop down menu is appearing to select necessary type of this family.
Can someone give me a hint is it possible to do it with Revit API?

Hi @denisyukj welcome to the forum. Do you want to sort a the list of types by usage? As far as I am aware, this data is not available. You could collect the count of type instances and use that to sort the dropdown list?

Hello, @GooseG. Thank you for reply.
Not really. I want to bind calling of family to custom button. Dropdown list shows only availble types for family binded for this button.
I found this method in lib, BUT as there is crucial moment:

  1. Placement point should be defined, but I want to define it with a mouse pointer.

Have you looked at .content bundles?
It allows you to bind a family to a button. Downside is you have to have the family saved with the proper type selected or only that one type

Hello, @Jean-Marc
Thank you. Could you be so kind to clarify where I can find this bundle?

check this example pyRevit-BILT_NA_2022/ of buttons.panel/03_Content Button.content at master · jmcouffin/pyRevit-BILT_NA_2022 · GitHub

you could try it for yourself installing my sample extensions using the command line
pyrevit extend ui pyBiltNA --dest="C:\pyRevit"

basically the .content extension on a folder name (for a button bundle) works as a pushbutton one, you create a foldername.content except that it will load the rfa file name whatever_content.rfa

you could use the ‘new’ bundle creator extension I made to try it out. You would have to download the latest installers from the action tab in github or use the pyrevit CLI to install the develop branch.
see it in action

1 Like

also see the documentation Notion – The all-in-one workspace for your notes, tasks, wikis, and databases.

1 Like

Thank you very much, I have to dive into this solution :grinning: