Modify Select Sheets tool

Hi everyone,

I’d like to have the Select Sheets tool has a starting point from another tool.
I need to add few buttons and make some modifications.
What is the best way ? Do we have access to the code?

"""Select multiple sheets from a list"""

#pylint: disable=import-error,invalid-name
from pyrevit import revit
from pyrevit import forms

selection = revit.get_selection()
sel_sheets = forms.select_sheets(title='Select Sheets')
if sel_sheets:
    selection.set_to(sel_sheets)

I wanted to add that I also would like to make this form modeless .Do i need access to the xaml file ? or there’s another way ?

You can reuse the code, and run it after your code.
Hold the ALT key and LEFT CLICK the tool you want to see the code.
Warning: Editing that code will result in the editing of the tool.

You will be greeted with this code:

image

If you set up autocomplete and stubs, you can navigate to the specific functions in just a few clicks:

By the way here are some useful links to setup autocomplete and stubs:

and you can finally see the full code used here and implement it into your code:

2 Likes

@dezindzer thank you for your reply! .

Regarding my second question, I want to change the xaml file and add additional functionalities. The class SelectFromList is using the SelectFromList.xaml. is there a way to make it point to at a different file ?

image

The select_sheets function is calling SelectFromList.show and returning selected_sheets. I’m trying making it return a folder path selected by the user. I have added a method browse_click to the class SelectFromList but I’m not sure how I can get the selected folder.

image

image

image

image